@serwist/build 9.5.10 → 9.5.12
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/{constants-BLOVm9H2.js → constants-nOu8OVD-.js} +1 -1
- package/dist/chunks/{constants-BLOVm9H2.js.map → constants-nOu8OVD-.js.map} +1 -1
- package/dist/chunks/{error-Cl4d1Wf-.js → error-B_o2bTQE.js} +1 -1
- package/dist/chunks/{error-Cl4d1Wf-.js.map → error-B_o2bTQE.js.map} +1 -1
- package/dist/chunks/{get-manifest-De0D0LAJ.js → get-manifest-C45pHnFK.js} +3 -3
- package/dist/chunks/{get-manifest-De0D0LAJ.js.map → get-manifest-C45pHnFK.js.map} +1 -1
- package/dist/chunks/{glob-B4_meZ_o.js → glob-CZkjMdJs.js} +3 -6
- package/dist/chunks/glob-CZkjMdJs.js.map +1 -0
- package/dist/chunks/{inject-manifest-DNqDY-04.js → inject-manifest-8Ec3euyW.js} +3 -3
- package/dist/chunks/{inject-manifest-DNqDY-04.js.map → inject-manifest-8Ec3euyW.js.map} +1 -1
- package/dist/chunks/{manifest-transform-BCUeQ0-V.d.ts → manifest-transform-B-PM_veR.d.ts} +10 -11
- package/dist/chunks/manifest-transform-B-PM_veR.d.ts.map +1 -0
- package/dist/index.d.mts +6 -38
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.schema.d.mts +45 -55
- package/dist/index.schema.d.mts.map +1 -1
- package/dist/index.schema.mjs +9 -4
- package/dist/index.schema.mjs.map +1 -0
- package/package.json +12 -9
- package/src/lib/get-string-hash.ts +1 -1
- package/dist/chunks/glob-B4_meZ_o.js.map +0 -1
- package/dist/chunks/manifest-transform-BCUeQ0-V.d.ts.map +0 -1
- /package/dist/chunks/{rolldown-runtime-CzwdidQP.js → rolldown-runtime-D7D4PA-g.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants-
|
|
1
|
+
{"version":3,"file":"constants-nOu8OVD-.js","names":[],"sources":["../../src/lib/constants.ts"],"sourcesContent":["export const DEFAULT_GLOB_PATTERNS = [\"**/*.{js,css,html}\"];\n"],"mappings":";AAAA,MAAa,wBAAwB,CAAC,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-
|
|
1
|
+
{"version":3,"file":"error-B_o2bTQE.js","names":[],"sources":["../../src/schema/error.ts"],"sourcesContent":["import type { z } from \"zod\";\n\nexport class SerwistConfigError extends Error {\n constructor({ moduleName, message }: { moduleName?: string; message?: string }) {\n super(`Invalid ${moduleName ?? \"Serwist\"} configuration:\\n${message}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nconst parsedType = (data: any): string => {\n const t = typeof data;\n\n switch (t) {\n case \"number\": {\n return Number.isNaN(data) ? \"NaN\" : \"number\";\n }\n case \"object\": {\n if (Array.isArray(data)) {\n return \"array\";\n }\n if (data === null) {\n return \"null\";\n }\n\n if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {\n return data.constructor.name;\n }\n }\n }\n return t;\n};\n\nexport const validationErrorMap: z.core.$ZodErrorMap = (error) => {\n /* This is where you override the various error codes */\n switch (error.code) {\n case \"invalid_type\": {\n return `${error.message ?? \"Received invalid type\"}: expected ${error.expected}, received ${parsedType(error.input)}.`;\n }\n case \"invalid_value\": {\n return `${error.message ?? \"Received invalid value\"}: expected ${error.expected}, received ${parsedType(error.input)}.`;\n }\n case \"invalid_union\": {\n return `${error.message ?? \"Received invalid union\"}:\\n${error.errors.flatMap((err) => err.map((e) => ` → ${e.message}`)).join(\"\\n\")}`;\n }\n case \"unrecognized_keys\": {\n return `${error.message ?? \"Received unrecognized keys\"}: ${error.keys.join(\".\")}`;\n }\n case \"custom\": {\n return error.message ?? undefined;\n }\n }\n return undefined;\n};\n"],"mappings":";AAEA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YAAY,EAAE,YAAY,WAAsD;EAC9E,MAAM,WAAW,cAAc,UAAU,mBAAmB,SAAS;EACrE,OAAO,eAAe,MAAM,IAAI,OAAO,SAAS;CAClD;AACF;AAEA,MAAM,cAAc,SAAsB;CACxC,MAAM,IAAI,OAAO;CAEjB,QAAQ,GAAR;EACE,KAAK,UACH,OAAO,OAAO,MAAM,IAAI,IAAI,QAAQ;EAEtC,KAAK;GACH,IAAI,MAAM,QAAQ,IAAI,GACpB,OAAO;GAET,IAAI,SAAS,MACX,OAAO;GAGT,IAAI,OAAO,eAAe,IAAI,MAAM,OAAO,aAAa,KAAK,aAC3D,OAAO,KAAK,YAAY;CAG9B;CACA,OAAO;AACT;AAEA,MAAa,sBAA2C,UAAU;CAEhE,QAAQ,MAAM,MAAd;EACE,KAAK,gBACH,OAAO,GAAG,MAAM,WAAW,wBAAwB,aAAa,MAAM,SAAS,aAAa,WAAW,MAAM,KAAK,EAAE;EAEtH,KAAK,iBACH,OAAO,GAAG,MAAM,WAAW,yBAAyB,aAAa,MAAM,SAAS,aAAa,WAAW,MAAM,KAAK,EAAE;EAEvH,KAAK,iBACH,OAAO,GAAG,MAAM,WAAW,yBAAyB,KAAK,MAAM,OAAO,SAAS,QAAQ,IAAI,KAAK,MAAM,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI;EAEtI,KAAK,qBACH,OAAO,GAAG,MAAM,WAAW,6BAA6B,IAAI,MAAM,KAAK,KAAK,GAAG;EAEjF,KAAK,UACH,OAAO,MAAM,WAAW,KAAA;CAE5B;AAEF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { i as basePartial, r as requiredGlobDirectoryPartial, t as globPartial } from "./glob-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { i as basePartial, r as requiredGlobDirectoryPartial, t as globPartial } from "./glob-CZkjMdJs.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/schema/get-manifest.ts
|
|
5
5
|
var get_manifest_exports = /* @__PURE__ */ __exportAll({ getManifestOptions: () => getManifestOptions });
|
|
@@ -11,4 +11,4 @@ const getManifestOptions = z.strictObject({
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { get_manifest_exports as n, getManifestOptions as t };
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=get-manifest-
|
|
14
|
+
//# sourceMappingURL=get-manifest-C45pHnFK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-manifest-
|
|
1
|
+
{"version":3,"file":"get-manifest-C45pHnFK.js","names":[],"sources":["../../src/schema/get-manifest.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { GetManifestOptions, GetManifestOptionsComplete } from \"../types.js\";\nimport { assertType, type Equals } from \"./assert-type.js\";\nimport { basePartial } from \"./base.js\";\nimport { globPartial, requiredGlobDirectoryPartial } from \"./glob.js\";\n\nexport const getManifestOptions = z.strictObject({\n ...basePartial.shape,\n ...globPartial.shape,\n ...requiredGlobDirectoryPartial.shape,\n});\n\nassertType<Equals<GetManifestOptions, z.input<typeof getManifestOptions>>>();\nassertType<Equals<GetManifestOptionsComplete, z.output<typeof getManifestOptions>>>();\n"],"mappings":";;;;;AAMA,MAAa,qBAAqB,EAAE,aAAa;CAC/C,GAAG,YAAY;CACf,GAAG,YAAY;CACf,GAAG,6BAA6B;AAClC,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { t as DEFAULT_GLOB_PATTERNS } from "./constants-
|
|
1
|
+
import { t as DEFAULT_GLOB_PATTERNS } from "./constants-nOu8OVD-.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
//#region src/schema/assert-type.ts
|
|
4
|
-
function assertType() {}
|
|
5
|
-
//#endregion
|
|
6
3
|
//#region src/schema/manifest-entry.ts
|
|
7
4
|
const manifestEntry = z.strictObject({
|
|
8
5
|
integrity: z.string().optional(),
|
|
@@ -62,6 +59,6 @@ const globPartial = z.strictObject({
|
|
|
62
59
|
const optionalGlobDirectoryPartial = z.strictObject({ globDirectory: z.string().optional() });
|
|
63
60
|
const requiredGlobDirectoryPartial = z.strictObject({ globDirectory: z.string() });
|
|
64
61
|
//#endregion
|
|
65
|
-
export { manifestTransform as a, fn as c, basePartial as i, manifestEntry as l, optionalGlobDirectoryPartial as n, manifestTransformResult as o, requiredGlobDirectoryPartial as r, asyncFn as s, globPartial as t
|
|
62
|
+
export { manifestTransform as a, fn as c, basePartial as i, manifestEntry as l, optionalGlobDirectoryPartial as n, manifestTransformResult as o, requiredGlobDirectoryPartial as r, asyncFn as s, globPartial as t };
|
|
66
63
|
|
|
67
|
-
//# sourceMappingURL=glob-
|
|
64
|
+
//# sourceMappingURL=glob-CZkjMdJs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob-CZkjMdJs.js","names":[],"sources":["../../src/schema/manifest-entry.ts","../../src/schema/utils.ts","../../src/schema/manifest-transform.ts","../../src/schema/base.ts","../../src/schema/glob.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const manifestEntry = z.strictObject({\n integrity: z.string().optional(),\n revision: z.string().nullable().optional(),\n url: z.string(),\n});\n","import { z } from \"zod\";\n\nexport const fn = <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output }: { input: TInput; output: TOutput }) => {\n const schema = z.function({\n input: z.tuple(input),\n output,\n });\n return z\n .custom<z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>>((arg) => typeof arg === \"function\")\n .transform((arg) => schema.implement(arg));\n};\n\nexport const asyncFn = <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({\n input,\n output,\n}: {\n input: TInput;\n output: TOutput;\n}) => {\n const schema = z.function({\n input: z.tuple(input),\n output,\n });\n return z\n .custom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>((arg) => typeof arg === \"function\")\n .transform((arg) => schema.implementAsync(arg));\n};\n","import { z } from \"zod\";\nimport { manifestEntry } from \"./manifest-entry.js\";\nimport { asyncFn } from \"./utils.js\";\n\nconst sizeObject = z.object({ size: z.number() });\n\nconst manifestEntryWithSize = z.object({ ...manifestEntry.shape, ...sizeObject.shape });\n\nexport const manifestTransformResult = z.strictObject({\n manifest: z.array(manifestEntryWithSize),\n warnings: z.array(z.string()).optional(),\n});\n\nexport const manifestTransform = asyncFn({\n input: [z.array(manifestEntryWithSize), z.unknown().optional()],\n output: manifestTransformResult,\n});\n","import { z } from \"zod\";\n\nimport type { BasePartial, BaseResolved } from \"../types.js\";\nimport { assertType, type Equals } from \"./assert-type.js\";\nimport { manifestEntry } from \"./manifest-entry.js\";\nimport { manifestTransform } from \"./manifest-transform.js\";\n\nexport const basePartial = z.strictObject({\n additionalPrecacheEntries: z.array(z.union([z.string(), manifestEntry])).optional(),\n disablePrecacheManifest: z.boolean().default(false),\n dontCacheBustURLsMatching: z.instanceof(RegExp).optional(),\n manifestTransforms: z.array(manifestTransform).optional(),\n maximumFileSizeToCacheInBytes: z.number().default(2097152),\n modifyURLPrefix: z.record(z.string(), z.string()).optional(),\n});\n\nassertType<Equals<BasePartial, z.input<typeof basePartial>>>();\nassertType<Equals<BaseResolved, z.output<typeof basePartial>>>();\n","import { z } from \"zod\";\nimport { DEFAULT_GLOB_PATTERNS } from \"../lib/constants.js\";\nimport type {\n GlobPartial,\n GlobResolved,\n OptionalGlobDirectoryPartial,\n OptionalGlobDirectoryResolved,\n RequiredGlobDirectoryPartial,\n RequiredGlobDirectoryResolved,\n} from \"../types.js\";\nimport { assertType, type Equals } from \"./assert-type.js\";\n\nexport const globPartial = z.strictObject({\n globFollow: z.boolean().default(true),\n globIgnores: z.array(z.string()).default([\"**/node_modules/**/*\"]),\n globPatterns: z.array(z.string()).default(DEFAULT_GLOB_PATTERNS),\n globStrict: z.boolean().default(true),\n templatedURLs: z.record(z.string(), z.union([z.string(), z.array(z.string())])).optional(),\n});\n\nexport const optionalGlobDirectoryPartial = z.strictObject({\n globDirectory: z.string().optional(),\n});\n\n// This needs to be set when using GetManifest or InjectManifest. This is\n// enforced via runtime validation, and needs to be documented.\nexport const requiredGlobDirectoryPartial = z.strictObject({\n globDirectory: z.string(),\n});\n\nassertType<Equals<GlobPartial, z.input<typeof globPartial>>>();\nassertType<Equals<GlobResolved, z.output<typeof globPartial>>>();\nassertType<Equals<OptionalGlobDirectoryPartial, z.input<typeof optionalGlobDirectoryPartial>>>();\nassertType<Equals<OptionalGlobDirectoryResolved, z.output<typeof optionalGlobDirectoryPartial>>>();\nassertType<Equals<RequiredGlobDirectoryPartial, z.input<typeof requiredGlobDirectoryPartial>>>();\nassertType<Equals<RequiredGlobDirectoryResolved, z.output<typeof requiredGlobDirectoryPartial>>>();\n"],"mappings":";;;AAEA,MAAa,gBAAgB,EAAE,aAAa;CAC1C,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACzC,KAAK,EAAE,OAAO;AAChB,CAAC;;;ACJD,MAAa,MAA6E,EAAE,OAAO,aAAiD;CAClJ,MAAM,SAAS,EAAE,SAAS;EACxB,OAAO,EAAE,MAAM,KAAK;EACpB;CACF,CAAC;CACD,OAAO,EACJ,QAA2E,QAAQ,OAAO,QAAQ,UAAU,CAAC,CAC7G,WAAW,QAAQ,OAAO,UAAU,GAAG,CAAC;AAC7C;AAEA,MAAa,WAAkF,EAC7F,OACA,aAII;CACJ,MAAM,SAAS,EAAE,SAAS;EACxB,OAAO,EAAE,MAAM,KAAK;EACpB;CACF,CAAC;CACD,OAAO,EACJ,QAAgF,QAAQ,OAAO,QAAQ,UAAU,CAAC,CAClH,WAAW,QAAQ,OAAO,eAAe,GAAG,CAAC;AAClD;;;ACtBA,MAAM,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAEhD,MAAM,wBAAwB,EAAE,OAAO;CAAE,GAAG,c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,OAAO,CAAC,CAAC,SAAS,EACrC,CAAC;AAID,MAAa,+BAA+B,EAAE,aAAa,EACzD,eAAe,EAAE,OAAO,EAC1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { i as basePartial, r as requiredGlobDirectoryPartial, t as globPartial } from "./glob-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { i as basePartial, r as requiredGlobDirectoryPartial, t as globPartial } from "./glob-CZkjMdJs.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/schema/sw-dest.ts
|
|
5
5
|
const optionalSwDestPartial = z.strictObject({ swDest: z.string().optional() });
|
|
@@ -24,4 +24,4 @@ const injectManifestOptions = z.strictObject({
|
|
|
24
24
|
//#endregion
|
|
25
25
|
export { requiredSwDestPartial as a, optionalSwDestPartial as i, injectManifestOptions as n, inject_manifest_exports as r, baseInjectPartial as t };
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=inject-manifest-
|
|
27
|
+
//# sourceMappingURL=inject-manifest-8Ec3euyW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-manifest-
|
|
1
|
+
{"version":3,"file":"inject-manifest-8Ec3euyW.js","names":[],"sources":["../../src/schema/sw-dest.ts","../../src/schema/inject-manifest.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { OptionalSwDestPartial, OptionalSwDestResolved, RequiredSwDestPartial, RequiredSwDestResolved } from \"../types.js\";\nimport { assertType, type Equals } from \"./assert-type.js\";\n\nexport const optionalSwDestPartial = z.strictObject({\n swDest: z.string().optional(),\n});\n\nexport const requiredSwDestPartial = z.strictObject({\n swDest: z.string(),\n});\n\nassertType<Equals<OptionalSwDestPartial, z.input<typeof optionalSwDestPartial>>>();\nassertType<Equals<OptionalSwDestResolved, z.output<typeof optionalSwDestPartial>>>();\nassertType<Equals<RequiredSwDestPartial, z.input<typeof requiredSwDestPartial>>>();\nassertType<Equals<RequiredSwDestResolved, z.output<typeof requiredSwDestPartial>>>();\n","import { z } from \"zod\";\nimport type { InjectManifestOptions, InjectManifestOptionsComplete, InjectPartial, InjectResolved } from \"../types.js\";\nimport { assertType, type Equals } from \"./assert-type.js\";\nimport { basePartial } from \"./base.js\";\nimport { globPartial, requiredGlobDirectoryPartial } from \"./glob.js\";\nimport { requiredSwDestPartial } from \"./sw-dest.js\";\n\nexport const baseInjectPartial = z.strictObject({\n injectionPoint: z.string().default(\"self.__SW_MANIFEST\"),\n swSrc: z.string(),\n});\n\nexport const injectManifestOptions = z.strictObject({\n ...basePartial.shape,\n ...globPartial.shape,\n ...baseInjectPartial.shape,\n ...requiredSwDestPartial.shape,\n ...requiredGlobDirectoryPartial.shape,\n});\n\nassertType<Equals<InjectPartial, z.input<typeof baseInjectPartial>>>();\nassertType<Equals<InjectResolved, z.output<typeof baseInjectPartial>>>();\nassertType<Equals<InjectManifestOptions, z.input<typeof injectManifestOptions>>>();\nassertType<Equals<InjectManifestOptionsComplete, z.output<typeof injectManifestOptions>>>();\n"],"mappings":";;;;AAIA,MAAa,wBAAwB,EAAE,aAAa,EAClD,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,EAC9B,CAAC;AAED,MAAa,wBAAwB,EAAE,aAAa,EAClD,QAAQ,EAAE,OAAO,EACnB,CAAC;;;;;;;ACHD,MAAa,oBAAoB,EAAE,aAAa;CAC9C,gBAAgB,EAAE,OAAO,CAAC,CAAC,QAAQ,oBAAoB;CACvD,OAAO,EAAE,OAAO;AAClB,CAAC;AAED,MAAa,wBAAwB,EAAE,aAAa;CAClD,GAAG,YAAY;CACf,GAAG,YAAY;CACf,GAAG,kBAAkB;CACrB,GAAG,sBAAsB;CACzB,GAAG,6BAA6B;AAClC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
2
|
//#region src/schema/manifest-entry.d.ts
|
|
4
3
|
declare const manifestEntry: z.ZodObject<{
|
|
5
4
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -10,66 +9,66 @@ declare const manifestEntry: z.ZodObject<{
|
|
|
10
9
|
//#region src/schema/manifest-transform.d.ts
|
|
11
10
|
declare const manifestTransformResult: z.ZodObject<{
|
|
12
11
|
manifest: z.ZodArray<z.ZodObject<{
|
|
13
|
-
size: z.ZodNumber;
|
|
14
12
|
integrity: z.ZodOptional<z.ZodString>;
|
|
15
13
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
14
|
url: z.ZodString;
|
|
15
|
+
size: z.ZodNumber;
|
|
17
16
|
}, z.core.$strip>>;
|
|
18
17
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
18
|
}, z.core.$strict>;
|
|
20
19
|
declare const manifestTransform: z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
21
|
-
size: z.ZodNumber;
|
|
22
20
|
integrity: z.ZodOptional<z.ZodString>;
|
|
23
21
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
22
|
url: z.ZodString;
|
|
23
|
+
size: z.ZodNumber;
|
|
25
24
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
26
25
|
manifest: z.ZodArray<z.ZodObject<{
|
|
27
|
-
size: z.ZodNumber;
|
|
28
26
|
integrity: z.ZodOptional<z.ZodString>;
|
|
29
27
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
28
|
url: z.ZodString;
|
|
29
|
+
size: z.ZodNumber;
|
|
31
30
|
}, z.core.$strip>>;
|
|
32
31
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
32
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
34
|
-
size: z.ZodNumber;
|
|
35
33
|
integrity: z.ZodOptional<z.ZodString>;
|
|
36
34
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
35
|
url: z.ZodString;
|
|
36
|
+
size: z.ZodNumber;
|
|
38
37
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
39
38
|
manifest: z.ZodArray<z.ZodObject<{
|
|
40
|
-
size: z.ZodNumber;
|
|
41
39
|
integrity: z.ZodOptional<z.ZodString>;
|
|
42
40
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
41
|
url: z.ZodString;
|
|
42
|
+
size: z.ZodNumber;
|
|
44
43
|
}, z.core.$strip>>;
|
|
45
44
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
45
|
}, z.core.$strict>>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
47
|
-
size: z.ZodNumber;
|
|
48
46
|
integrity: z.ZodOptional<z.ZodString>;
|
|
49
47
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
48
|
url: z.ZodString;
|
|
49
|
+
size: z.ZodNumber;
|
|
51
50
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
52
51
|
manifest: z.ZodArray<z.ZodObject<{
|
|
53
|
-
size: z.ZodNumber;
|
|
54
52
|
integrity: z.ZodOptional<z.ZodString>;
|
|
55
53
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
54
|
url: z.ZodString;
|
|
55
|
+
size: z.ZodNumber;
|
|
57
56
|
}, z.core.$strip>>;
|
|
58
57
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
59
58
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
60
|
-
size: z.ZodNumber;
|
|
61
59
|
integrity: z.ZodOptional<z.ZodString>;
|
|
62
60
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
61
|
url: z.ZodString;
|
|
62
|
+
size: z.ZodNumber;
|
|
64
63
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
65
64
|
manifest: z.ZodArray<z.ZodObject<{
|
|
66
|
-
size: z.ZodNumber;
|
|
67
65
|
integrity: z.ZodOptional<z.ZodString>;
|
|
68
66
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
67
|
url: z.ZodString;
|
|
68
|
+
size: z.ZodNumber;
|
|
70
69
|
}, z.core.$strip>>;
|
|
71
70
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
71
|
}, z.core.$strict>>>>;
|
|
73
72
|
//#endregion
|
|
74
73
|
export { manifestTransformResult as n, manifestEntry as r, manifestTransform as t };
|
|
75
|
-
//# sourceMappingURL=manifest-transform-
|
|
74
|
+
//# sourceMappingURL=manifest-transform-B-PM_veR.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-transform-B-PM_veR.d.ts","names":[],"sources":["../../src/schema/manifest-entry.ts","../../src/schema/manifest-transform.ts"],"mappings":";;cAEa,eAAa,EAAA;;;;GAIxB,EAAA,KAAA;;;cCEW,yBAAuB,EAAA;;;;;;;;GAGlC,EAAA,KAAA;cAEW,mBAAiB,EAAA,QAAA,EAAA,UAAA,EAAA,KAAA,6BAAA,EAAA,UAAA,EAAA,SAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAG5B,EAAA,KAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { n as manifestTransformResult, r as manifestEntry } from "./chunks/manifest-transform-
|
|
1
|
+
import { n as manifestTransformResult, r as manifestEntry } from "./chunks/manifest-transform-B-PM_veR.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { MaybePromise, Require } from "@serwist/utils";
|
|
4
4
|
import { RawSourceMap } from "source-map";
|
|
5
5
|
import { PackageJson } from "type-fest";
|
|
6
|
-
|
|
7
6
|
//#region src/types.d.ts
|
|
8
7
|
type ManifestEntry = z.input<typeof manifestEntry>;
|
|
9
8
|
type ManifestTransformResult = z.input<typeof manifestTransformResult>;
|
|
@@ -306,29 +305,13 @@ declare const errors: {
|
|
|
306
305
|
declare const escapeRegExp: (str: string) => string;
|
|
307
306
|
//#endregion
|
|
308
307
|
//#region src/lib/get-file-manifest-entries.d.ts
|
|
309
|
-
declare const getFileManifestEntries: ({
|
|
310
|
-
additionalPrecacheEntries,
|
|
311
|
-
dontCacheBustURLsMatching,
|
|
312
|
-
globDirectory,
|
|
313
|
-
globFollow,
|
|
314
|
-
globIgnores,
|
|
315
|
-
globPatterns,
|
|
316
|
-
globStrict,
|
|
317
|
-
manifestTransforms,
|
|
318
|
-
maximumFileSizeToCacheInBytes,
|
|
319
|
-
modifyURLPrefix,
|
|
320
|
-
templatedURLs,
|
|
321
|
-
disablePrecacheManifest
|
|
322
|
-
}: GetManifestOptionsComplete) => Promise<GetManifestResult>;
|
|
308
|
+
declare const getFileManifestEntries: ({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest }: GetManifestOptionsComplete) => Promise<GetManifestResult>;
|
|
323
309
|
//#endregion
|
|
324
310
|
//#region src/lib/get-source-map-url.d.ts
|
|
325
311
|
declare function getSourceMapURL(srcContents: string): string | null;
|
|
326
312
|
//#endregion
|
|
327
313
|
//#region src/lib/rebase-path.d.ts
|
|
328
|
-
declare function rebasePath({
|
|
329
|
-
baseDirectory,
|
|
330
|
-
file
|
|
331
|
-
}: {
|
|
314
|
+
declare function rebasePath({ baseDirectory, file }: {
|
|
332
315
|
baseDirectory: string;
|
|
333
316
|
file: string;
|
|
334
317
|
}): string;
|
|
@@ -369,13 +352,7 @@ interface ReplaceAndUpdateSourceMapOptions {
|
|
|
369
352
|
* originalSource with the replacement applied, and the modified originalMap.
|
|
370
353
|
* @private
|
|
371
354
|
*/
|
|
372
|
-
declare function replaceAndUpdateSourceMap({
|
|
373
|
-
jsFilename,
|
|
374
|
-
originalMap,
|
|
375
|
-
originalSource,
|
|
376
|
-
replaceString,
|
|
377
|
-
searchString
|
|
378
|
-
}: ReplaceAndUpdateSourceMapOptions): Promise<{
|
|
355
|
+
declare function replaceAndUpdateSourceMap({ jsFilename, originalMap, originalSource, replaceString, searchString }: ReplaceAndUpdateSourceMapOptions): Promise<{
|
|
379
356
|
map: string;
|
|
380
357
|
source: string;
|
|
381
358
|
}>;
|
|
@@ -438,16 +415,7 @@ interface TransformManifestOptions extends Pick<BaseResolved, "additionalPrecach
|
|
|
438
415
|
fileDetails: FileDetails[];
|
|
439
416
|
transformParam?: unknown;
|
|
440
417
|
}
|
|
441
|
-
declare function transformManifest({
|
|
442
|
-
additionalPrecacheEntries,
|
|
443
|
-
dontCacheBustURLsMatching,
|
|
444
|
-
fileDetails,
|
|
445
|
-
manifestTransforms,
|
|
446
|
-
maximumFileSizeToCacheInBytes,
|
|
447
|
-
modifyURLPrefix,
|
|
448
|
-
transformParam,
|
|
449
|
-
disablePrecacheManifest
|
|
450
|
-
}: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings>;
|
|
418
|
+
declare function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, disablePrecacheManifest }: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings>;
|
|
451
419
|
//#endregion
|
|
452
420
|
//#region src/lib/translate-url-to-sourcemap-paths.d.ts
|
|
453
421
|
declare function translateURLToSourcemapPaths(url: string | null, swSrc: string, swDest: string): {
|
|
@@ -471,5 +439,5 @@ declare const stringify: {
|
|
|
471
439
|
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
472
440
|
};
|
|
473
441
|
//#endregion
|
|
474
|
-
export { BasePartial, BaseResolved, BuildResult, BuildType, DEFAULT_GLOB_PATTERNS, FileDetails, GetManifestOptions, GetManifestOptionsComplete, GetManifestResult, GlobPartial, GlobResolved, InjectManifestOptions, InjectManifestOptionsComplete, InjectPartial, InjectResolved, ManifestEntry, ManifestTransform, ManifestTransformResult, MethodNames, OptionalGlobDirectoryPartial, OptionalGlobDirectoryResolved, OptionalSwDestPartial, OptionalSwDestResolved, RequiredGlobDirectoryPartial, RequiredGlobDirectoryResolved, RequiredSwDestPartial, RequiredSwDestResolved, ResolvedManifestTransform, SerwistPackageJSON, errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
|
|
442
|
+
export { type BasePartial, type BaseResolved, type BuildResult, type BuildType, DEFAULT_GLOB_PATTERNS, type FileDetails, type GetManifestOptions, type GetManifestOptionsComplete, type GetManifestResult, type GlobPartial, type GlobResolved, type InjectManifestOptions, type InjectManifestOptionsComplete, type InjectPartial, type InjectResolved, type ManifestEntry, type ManifestTransform, type ManifestTransformResult, type MethodNames, type OptionalGlobDirectoryPartial, type OptionalGlobDirectoryResolved, type OptionalSwDestPartial, type OptionalSwDestResolved, type RequiredGlobDirectoryPartial, type RequiredGlobDirectoryResolved, type RequiredSwDestPartial, type RequiredSwDestResolved, type ResolvedManifestTransform, type SerwistPackageJSON, errors, escapeRegExp, getFileManifestEntries, getManifest, getSourceMapURL, injectManifest, rebasePath, replaceAndUpdateSourceMap, stringify, transformManifest, translateURLToSourcemapPaths, validateGetManifestOptions, validateInjectManifestOptions };
|
|
475
443
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/get-manifest.ts","../src/inject-manifest.ts","../src/lib/constants.ts","../src/lib/errors.ts","../src/lib/escape-regexp.ts","../src/lib/get-file-manifest-entries.ts","../src/lib/get-source-map-url.ts","../src/lib/rebase-path.ts","../src/lib/replace-and-update-source-map.ts","../src/lib/transform-manifest.ts","../src/lib/translate-url-to-sourcemap-paths.ts","../src/lib/validate-options.ts","../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/get-manifest.ts","../src/inject-manifest.ts","../src/lib/constants.ts","../src/lib/errors.ts","../src/lib/escape-regexp.ts","../src/lib/get-file-manifest-entries.ts","../src/lib/get-source-map-url.ts","../src/lib/rebase-path.ts","../src/lib/replace-and-update-source-map.ts","../src/lib/transform-manifest.ts","../src/lib/translate-url-to-sourcemap-paths.ts","../src/lib/validate-options.ts","../src/index.ts"],"mappings":";;;;;;KAMY,gBAAgB,EAAE,aAAa;KAE/B,0BAA0B,EAAE,aAAa;KAEzC,qBAAqB,UAAU;EAAkB;MAAmB,qBAAqB,aAAa;KAEtG,6BAA6B,UAAU;EAAkB;MAAmB,qBAAqB,QAAQ;UAEpG;;;;;EAKf,sCAAsC;;;;;;EAMtC;;;;;;;;;EASA,4BAA4B;;;;;;EAM5B,qBAAqB;;;;;;;EAOrB;;;;;;;;;;;;;;;;;;;;EAoBA;KACG;;;UAIY,qBAAqB,QAAQ;EAC5C,qBAAqB;;UAKN;;;;;EAKf;;KAGU,gCAAgC;UAE3B;;;;;EAKf;;KAGU,gCAAgC;UAE3B;;;;;;;EAOf;;;;;;;;;;EAUA;;;;;;;;;;EAUA;;;;;;;;EAQA;;;;;;;;;;EAUA;KACG;;;KAIO,eAAe,QAAQ;UAElB;;;;;;EAMf;;;;;EAKA;;KAGU,iBAAiB,QAAQ;UAEpB;;;;;EAKf;;KAGU,yBAAyB;UAEpB;;;;;;EAMf;;KAGU,yBAAyB;KAEzB,qBAAqB,cAAc,cA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;cCRW,6BAA0B,mBAA2B,QAAQ;cAW7D,gCAA6B,mBAA2B,QAAQ;;;;;;;;cCIvE"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as validationErrorMap, t as SerwistConfigError } from "./chunks/error-
|
|
2
|
-
import { t as DEFAULT_GLOB_PATTERNS } from "./chunks/constants-
|
|
1
|
+
import { n as validationErrorMap, t as SerwistConfigError } from "./chunks/error-B_o2bTQE.js";
|
|
2
|
+
import { t as DEFAULT_GLOB_PATTERNS } from "./chunks/constants-nOu8OVD-.js";
|
|
3
3
|
import assert from "node:assert";
|
|
4
4
|
import { oneLine } from "common-tags";
|
|
5
5
|
import crypto from "node:crypto";
|
|
@@ -363,7 +363,7 @@ const getFileManifestEntries = async ({ additionalPrecacheEntries, dontCacheBust
|
|
|
363
363
|
//#endregion
|
|
364
364
|
//#region src/lib/validate-options.ts
|
|
365
365
|
const validateGetManifestOptions = async (input) => {
|
|
366
|
-
const result = await (await import("./chunks/get-manifest-
|
|
366
|
+
const result = await (await import("./chunks/get-manifest-C45pHnFK.js").then((n) => n.n)).getManifestOptions.spa(input, { error: validationErrorMap });
|
|
367
367
|
if (!result.success) throw new SerwistConfigError({
|
|
368
368
|
moduleName: "@serwist/build",
|
|
369
369
|
message: z.prettifyError(result.error)
|
|
@@ -371,7 +371,7 @@ const validateGetManifestOptions = async (input) => {
|
|
|
371
371
|
return result.data;
|
|
372
372
|
};
|
|
373
373
|
const validateInjectManifestOptions = async (input) => {
|
|
374
|
-
const result = await (await import("./chunks/inject-manifest-
|
|
374
|
+
const result = await (await import("./chunks/inject-manifest-8Ec3euyW.js").then((n) => n.r)).injectManifestOptions.spa(input, { error: validationErrorMap });
|
|
375
375
|
if (!result.success) throw new SerwistConfigError({
|
|
376
376
|
moduleName: "@serwist/build",
|
|
377
377
|
message: z.prettifyError(result.error)
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/errors.ts","../src/lib/get-composite-details.ts","../src/lib/get-string-hash.ts","../src/lib/get-file-hash.ts","../src/lib/get-file-size.ts","../src/lib/get-file-details.ts","../src/lib/get-string-details.ts","../src/lib/additional-precache-entries-transform.ts","../src/lib/maximum-size-transform.ts","../src/lib/escape-regexp.ts","../src/lib/modify-url-prefix-transform.ts","../src/lib/no-revision-for-urls-matching-transform.ts","../src/lib/transform-manifest.ts","../src/lib/get-file-manifest-entries.ts","../src/lib/validate-options.ts","../src/get-manifest.ts","../src/lib/get-source-map-url.ts","../src/lib/rebase-path.ts","../src/lib/replace-and-update-source-map.ts","../src/lib/translate-url-to-sourcemap-paths.ts","../src/inject-manifest.ts","../src/index.ts"],"sourcesContent":["/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport { oneLine as ol } from \"common-tags\";\n\nexport const errors = {\n \"unable-to-get-rootdir\": \"Unable to get the root directory of your web app.\",\n \"no-extension\": ol`Unable to detect a usable extension for a file in your web\n app directory.`,\n \"invalid-file-manifest-name\": ol`The File Manifest Name must have at least one\n character.`,\n \"unable-to-get-file-manifest-name\": \"Unable to get a file manifest name.\",\n \"invalid-sw-dest\": `The 'swDest' value must be a valid path.`,\n \"unable-to-get-sw-name\": \"Unable to get a service worker file name.\",\n \"unable-to-get-save-config\": ol`An error occurred when asking to save details\n in a config file.`,\n \"unable-to-get-file-hash\": ol`An error occurred when attempting to create a\n file hash.`,\n \"unable-to-get-file-size\": ol`An error occurred when attempting to get a file\n size.`,\n \"unable-to-glob-files\": \"An error occurred when globbing for files.\",\n \"unable-to-make-manifest-directory\": ol`Unable to make output directory for\n file manifest.`,\n \"read-manifest-template-failure\": \"Unable to read template for file manifest\",\n \"populating-manifest-tmpl-failed\": ol`An error occurred when populating the\n file manifest template.`,\n \"manifest-file-write-failure\": \"Unable to write the file manifest.\",\n \"unable-to-make-sw-directory\": ol`Unable to make the directories to output\n the service worker path.`,\n \"sw-write-failure\": \"Unable to write the service worker file.\",\n \"sw-write-failure-directory\": ol`Unable to write the service worker file;\n 'swDest' should be a full path to the file, not a path to a directory.`,\n \"unable-to-copy-serwist-libraries\": ol`One or more of the Serwist libraries\n could not be copied over to the destination directory: `,\n \"invalid-glob-directory\": ol`The supplied globDirectory must be a path as a\n string.`,\n \"invalid-dont-cache-bust\": ol`The supplied 'dontCacheBustURLsMatching'\n parameter must be a RegExp.`,\n \"invalid-exclude-files\": \"The excluded files should be an array of strings.\",\n \"invalid-get-manifest-entries-input\": ol`The input to\n 'getFileManifestEntries()' must be an object.`,\n \"invalid-manifest-path\": ol`The supplied manifest path is not a string with\n at least one character.`,\n \"invalid-manifest-entries\": ol`The manifest entries must be an array of\n strings or JavaScript objects containing a url parameter.`,\n \"invalid-manifest-format\": ol`The value of the 'format' option passed to\n generateFileManifest() must be either 'iife' (the default) or 'es'.`,\n \"invalid-static-file-globs\": ol`The 'globPatterns' value must be an array\n of strings.`,\n \"invalid-templated-urls\": ol`The 'templatedURLs' value should be an object\n that maps URLs to either a string, or to an array of glob patterns.`,\n \"templated-url-matches-glob\": ol`One of the 'templatedURLs' URLs is already\n being tracked via 'globPatterns': `,\n \"invalid-glob-ignores\": ol`The 'globIgnores' parameter must be an array of\n glob pattern strings.`,\n \"manifest-entry-bad-url\": ol`The generated manifest contains an entry without\n a URL string. This is likely an error with @serwist/build.`,\n \"modify-url-prefix-bad-prefixes\": ol`The 'modifyURLPrefix' parameter must be\n an object with string key value pairs.`,\n \"invalid-inject-manifest-arg\": ol`The input to 'injectManifest()' must be an\n object.`,\n \"injection-point-not-found\": ol`Unable to find a place to inject the manifest.\n Please ensure that your service worker file contains the following: `,\n \"multiple-injection-points\": ol`Please ensure that your 'swSrc' file contains\n only one match for the following: `,\n \"bad-template-urls-asset\": ol`There was an issue using one of the provided\n 'templatedURLs'.`,\n \"invalid-generate-file-manifest-arg\": ol`The input to generateFileManifest()\n must be an Object.`,\n \"invalid-sw-src\": `The 'swSrc' file can't be read.`,\n \"same-src-and-dest\": ol`Unable to find a place to inject the manifest. This is\n likely because swSrc and swDest are configured to the same file.\n Please ensure that your swSrc file contains the following:`,\n \"no-module-name\": ol`You must provide a moduleName parameter when calling\n getModuleURL().`,\n \"bad-manifest-transforms-return-value\": ol`The return value from a\n manifestTransform should be an object with 'manifest' and optionally\n 'warnings' properties.`,\n \"string-entry-warning\": ol`Some items were passed to additionalPrecacheEntries\n without revisioning info. This is generally NOT safe. Learn more at\n https://bit.ly/wb-precache.`,\n \"cant-find-sourcemap\": ol`The swSrc file refers to a sourcemap that can't be\n opened:`,\n \"manifest-transforms\": ol`When using manifestTransforms, you must provide\n an array of functions.`,\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport crypto from \"node:crypto\";\n\nimport type { FileDetails } from \"../types.js\";\n\nexport const getCompositeDetails = (compositeURL: string, dependencyDetails: FileDetails[]): FileDetails => {\n let totalSize = 0;\n let compositeHash = \"\";\n\n for (const fileDetails of dependencyDetails) {\n totalSize += fileDetails.size;\n compositeHash += fileDetails.hash === null ? \"\" : fileDetails.hash;\n }\n\n const md5 = crypto.createHash(\"md5\");\n md5.update(compositeHash);\n const hashOfHashes = md5.digest(\"hex\");\n\n return {\n file: compositeURL,\n hash: hashOfHashes,\n size: totalSize,\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport crypto from \"node:crypto\";\n\nexport function getStringHash(input: crypto.BinaryLike): string {\n const md5 = crypto.createHash(\"md5\");\n md5.update(input);\n return md5.digest(\"hex\");\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport { readFileSync } from \"node:fs\";\n\nimport { errors } from \"./errors.js\";\nimport { getStringHash } from \"./get-string-hash.js\";\n\nexport const getFileHash = (file: string): string => {\n try {\n const buffer = readFileSync(file);\n return getStringHash(buffer);\n } catch (err) {\n throw new Error(`${errors[\"unable-to-get-file-hash\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n }\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport fs from \"node:fs\";\nimport { errors } from \"./errors.js\";\n\nexport const getFileSize = (file: string): number | null => {\n try {\n const stat = fs.statSync(file);\n if (!stat.isFile()) {\n return null;\n }\n return stat.size;\n } catch (err) {\n throw new Error(`${errors[\"unable-to-get-file-size\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n }\n};\n","/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport path from \"node:path\";\nimport { globSync } from \"glob\";\nimport type { FileDetails, GlobPartial } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { getFileHash } from \"./get-file-hash.js\";\nimport { getFileSize } from \"./get-file-size.js\";\n\nexport const getFileDetails = ({\n globDirectory,\n globFollow,\n globIgnores,\n globPattern,\n}: Omit<GlobPartial, \"globDirectory\" | \"globPatterns\" | \"templatedURLs\"> & {\n // This will only be called when globDirectory is not undefined.\n globDirectory: string;\n globPattern: string;\n}): {\n globbedFileDetails: FileDetails[];\n warning: string;\n} => {\n let globbedFiles: string[];\n let warning = \"\";\n\n try {\n globbedFiles = globSync(globPattern, {\n cwd: globDirectory,\n follow: globFollow,\n ignore: globIgnores,\n });\n } catch (err) {\n throw new Error(`${errors[\"unable-to-glob-files\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n }\n\n const globbedFileDetails: FileDetails[] = [];\n for (const file of globbedFiles) {\n const fullPath = path.join(globDirectory, file);\n const fileSize = getFileSize(fullPath);\n if (fileSize !== null) {\n const fileHash = getFileHash(fullPath);\n globbedFileDetails.push({\n file: path.relative(globDirectory, fullPath),\n hash: fileHash,\n size: fileSize,\n });\n }\n }\n\n return { globbedFileDetails, warning };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { FileDetails } from \"../types.js\";\nimport { getStringHash } from \"./get-string-hash.js\";\n\nexport const getStringDetails = (url: string, str: string): FileDetails => ({\n file: url,\n hash: getStringHash(str),\n size: str.length,\n});\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestEntry } from \"../types.js\";\nimport { errors } from \"./errors.js\";\n\ntype AdditionalManifestEntriesTransform = (manifest: (ManifestEntry & { size: number })[]) => {\n manifest: (ManifestEntry & { size: number })[];\n warnings: string[];\n};\n\nexport const additionalPrecacheEntriesTransform = (additionalPrecacheEntries: (ManifestEntry | string)[]): AdditionalManifestEntriesTransform => {\n return (manifest: (ManifestEntry & { size: number })[]) => {\n const warnings: string[] = [];\n const stringEntries = new Set<string>();\n\n for (const additionalEntry of additionalPrecacheEntries) {\n // Warn about either a string or an object that lacks a revision property.\n // (An object with a revision property set to null is okay.)\n if (typeof additionalEntry === \"string\") {\n stringEntries.add(additionalEntry);\n manifest.push({\n revision: null,\n size: 0,\n url: additionalEntry,\n });\n } else {\n if (additionalEntry && !additionalEntry.integrity && additionalEntry.revision === undefined) {\n stringEntries.add(additionalEntry.url);\n }\n manifest.push(Object.assign({ size: 0 }, additionalEntry));\n }\n }\n\n if (stringEntries.size > 0) {\n let urls = \"\\n\";\n for (const stringEntry of stringEntries) {\n urls += ` - ${stringEntry}\\n`;\n }\n\n warnings.push(errors[\"string-entry-warning\"] + urls);\n }\n\n return {\n manifest,\n warnings,\n };\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport prettyBytes from \"pretty-bytes\";\n\nimport type { ManifestTransform } from \"../types.js\";\n\nexport function maximumSizeTransform(maximumFileSizeToCacheInBytes: number): ManifestTransform {\n return (originalManifest) => {\n const warnings: string[] = [];\n const manifest = originalManifest.filter((entry) => {\n if (entry.size <= maximumFileSizeToCacheInBytes) {\n return true;\n }\n\n warnings.push(\n `${entry.url} is ${prettyBytes(entry.size)}, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.`,\n );\n return false;\n });\n\n return { manifest, warnings };\n };\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\nexport const escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestTransform } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { escapeRegExp } from \"./escape-regexp.js\";\n\nexport function modifyURLPrefixTransform(modifyURLPrefix: { [key: string]: string }): ManifestTransform {\n if (!modifyURLPrefix || typeof modifyURLPrefix !== \"object\" || Array.isArray(modifyURLPrefix)) {\n throw new Error(errors[\"modify-url-prefix-bad-prefixes\"]);\n }\n\n // If there are no entries in modifyURLPrefix, just return an identity\n // function as a shortcut.\n if (Object.keys(modifyURLPrefix).length === 0) {\n return (manifest) => {\n return { manifest };\n };\n }\n\n for (const key of Object.keys(modifyURLPrefix)) {\n if (typeof modifyURLPrefix[key] !== \"string\") {\n throw new Error(errors[\"modify-url-prefix-bad-prefixes\"]);\n }\n }\n\n // Escape the user input so it's safe to use in a regex.\n const safeModifyURLPrefixes = Object.keys(modifyURLPrefix).map(escapeRegExp);\n // Join all the `modifyURLPrefix` keys so a single regex can be used.\n const prefixMatchesStrings = safeModifyURLPrefixes.join(\"|\");\n // Add `^` to the front the prefix matches so it only matches the start of\n // a string.\n const modifyRegex = new RegExp(`^(${prefixMatchesStrings})`);\n\n return (originalManifest) => {\n const manifest = originalManifest.map((entry) => {\n if (typeof entry.url !== \"string\") {\n throw new Error(errors[\"manifest-entry-bad-url\"]);\n }\n\n entry.url = entry.url.replace(modifyRegex, (match) => {\n return modifyURLPrefix[match];\n });\n\n return entry;\n });\n\n return { manifest };\n };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestTransform } from \"../types.js\";\nimport { errors } from \"./errors.js\";\n\nexport function noRevisionForURLsMatchingTransform(regexp: RegExp): ManifestTransform {\n if (!(regexp instanceof RegExp)) {\n throw new Error(errors[\"invalid-dont-cache-bust\"]);\n }\n\n return (originalManifest) => {\n const manifest = originalManifest.map((entry) => {\n if (typeof entry.url !== \"string\") {\n throw new Error(errors[\"manifest-entry-bad-url\"]);\n }\n\n if (entry.url.match(regexp)) {\n entry.revision = null;\n }\n\n return entry;\n });\n\n return { manifest };\n };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { BaseResolved, FileDetails, ManifestEntry, ManifestTransform } from \"../types.js\";\nimport { additionalPrecacheEntriesTransform } from \"./additional-precache-entries-transform.js\";\nimport { errors } from \"./errors.js\";\nimport { maximumSizeTransform } from \"./maximum-size-transform.js\";\nimport { modifyURLPrefixTransform } from \"./modify-url-prefix-transform.js\";\nimport { noRevisionForURLsMatchingTransform } from \"./no-revision-for-urls-matching-transform.js\";\n\n/**\n * A `ManifestTransform` function can be used to modify the modify the `url` or\n * `revision` properties of some or all of the {@linkcode ManifestEntry} in the manifest.\n *\n * Deleting the `revision` property of an entry will cause\n * the corresponding `url` to be precached without cache-busting parameters\n * applied, which is to say, it implies that the URL itself contains\n * proper versioning info. If the `revision` property is present, it must be\n * set to a string.\n *\n * @example A transformation that prepended the origin of a CDN for any\n * URL starting with '/assets/' could be implemented as:\n *\n * const cdnTransform = async (manifestEntries) => {\n * const manifest = manifestEntries.map(entry => {\n * const cdnOrigin = 'https://example.com';\n * if (entry.url.startsWith('/assets/')) {\n * entry.url = cdnOrigin + entry.url;\n * }\n * return entry;\n * });\n * return {manifest, warnings: []};\n * };\n *\n * @example A transformation that nulls the revision field when the\n * URL contains an 8-character hash surrounded by '.', indicating that it\n * already contains revision information:\n *\n * const removeRevisionTransform = async (manifestEntries) => {\n * const manifest = manifestEntries.map(entry => {\n * const hashRegExp = /\\.\\w{8}\\./;\n * if (entry.url.match(hashRegExp)) {\n * entry.revision = null;\n * }\n * return entry;\n * });\n * return {manifest, warnings: []};\n * };\n *\n * @callback ManifestTransform\n * @param manifestEntries The full\n * array of entries, prior to the current transformation.\n * @param compilation When used in the webpack plugins, this param\n * will be set to the current `compilation`.\n * @returns The array of entries with the transformation applied,\n * and optionally, any warnings that should be reported back to the build tool.\n */\ninterface ManifestTransformResultWithWarnings {\n count: number;\n size: number;\n manifestEntries: ManifestEntry[] | undefined;\n warnings: string[];\n}\ninterface ManifestEntryWithSize extends ManifestEntry {\n size: number;\n}\ninterface TransformManifestOptions\n extends Pick<\n BaseResolved,\n | \"additionalPrecacheEntries\"\n | \"dontCacheBustURLsMatching\"\n | \"manifestTransforms\"\n | \"maximumFileSizeToCacheInBytes\"\n | \"modifyURLPrefix\"\n | \"disablePrecacheManifest\"\n > {\n fileDetails: FileDetails[];\n // When this is called by the webpack plugin, transformParam will be the\n // current webpack compilation.\n transformParam?: unknown;\n}\n\nexport async function transformManifest({\n additionalPrecacheEntries,\n dontCacheBustURLsMatching,\n fileDetails,\n manifestTransforms,\n maximumFileSizeToCacheInBytes,\n modifyURLPrefix,\n transformParam,\n disablePrecacheManifest,\n}: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings> {\n if (disablePrecacheManifest) {\n return {\n count: 0,\n size: 0,\n manifestEntries: undefined,\n warnings: [],\n };\n }\n\n const allWarnings: string[] = [];\n\n // Take the array of fileDetail objects and convert it into an array of\n // {url, revision, size} objects, with \\ replaced with /.\n const normalizedManifest: ManifestEntryWithSize[] = fileDetails.map((fileDetails) => ({\n url: fileDetails.file.replace(/\\\\/g, \"/\"),\n revision: fileDetails.hash,\n size: fileDetails.size,\n }));\n\n const transformsToApply: ManifestTransform[] = [];\n\n if (maximumFileSizeToCacheInBytes) {\n transformsToApply.push(maximumSizeTransform(maximumFileSizeToCacheInBytes));\n }\n\n if (modifyURLPrefix) {\n transformsToApply.push(modifyURLPrefixTransform(modifyURLPrefix));\n }\n\n if (dontCacheBustURLsMatching) {\n transformsToApply.push(noRevisionForURLsMatchingTransform(dontCacheBustURLsMatching));\n }\n\n // Run any manifestTransforms functions second-to-last.\n if (manifestTransforms) {\n transformsToApply.push(...manifestTransforms);\n }\n\n // Run additionalPrecacheEntriesTransform last.\n if (additionalPrecacheEntries) {\n transformsToApply.push(additionalPrecacheEntriesTransform(additionalPrecacheEntries));\n }\n\n let transformedManifest: ManifestEntryWithSize[] = normalizedManifest;\n for (const transform of transformsToApply) {\n const result = await transform(transformedManifest, transformParam);\n if (!(\"manifest\" in result)) {\n throw new Error(errors[\"bad-manifest-transforms-return-value\"]);\n }\n\n transformedManifest = result.manifest;\n allWarnings.push(...(result.warnings || []));\n }\n\n // Generate some metadata about the manifest before we clear out the size\n // properties from each entry.\n const count = transformedManifest.length;\n let size = 0;\n for (const manifestEntry of transformedManifest as (ManifestEntry & { size?: number })[]) {\n size += manifestEntry.size || 0;\n delete manifestEntry.size;\n }\n\n return {\n count,\n size,\n manifestEntries: transformedManifest as ManifestEntry[],\n warnings: allWarnings,\n };\n}\n","/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport assert from \"node:assert\";\n\nimport type { FileDetails, GetManifestOptionsComplete, GetManifestResult } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { getCompositeDetails } from \"./get-composite-details.js\";\nimport { getFileDetails } from \"./get-file-details.js\";\nimport { getStringDetails } from \"./get-string-details.js\";\nimport { transformManifest } from \"./transform-manifest.js\";\n\nexport const getFileManifestEntries = async ({\n additionalPrecacheEntries,\n dontCacheBustURLsMatching,\n globDirectory,\n globFollow,\n globIgnores,\n globPatterns = [],\n globStrict,\n manifestTransforms,\n maximumFileSizeToCacheInBytes,\n modifyURLPrefix,\n templatedURLs,\n disablePrecacheManifest,\n}: GetManifestOptionsComplete): Promise<GetManifestResult> => {\n if (disablePrecacheManifest) {\n return {\n count: 0,\n size: 0,\n manifestEntries: undefined,\n warnings: [],\n };\n }\n\n const warnings: string[] = [];\n const allFileDetails = new Map<string, FileDetails>();\n\n try {\n for (const globPattern of globPatterns) {\n const { globbedFileDetails, warning } = getFileDetails({\n globDirectory,\n globFollow,\n globIgnores,\n globPattern,\n globStrict,\n });\n\n if (warning) {\n warnings.push(warning);\n }\n\n for (const details of globbedFileDetails) {\n if (details && !allFileDetails.has(details.file)) {\n allFileDetails.set(details.file, details);\n }\n }\n }\n } catch (error) {\n // If there's an exception thrown while globbing, then report\n // it back as a warning, and don't consider it fatal.\n if (error instanceof Error && error.message) {\n warnings.push(error.message);\n }\n }\n\n if (templatedURLs) {\n for (const url of Object.keys(templatedURLs)) {\n assert(!allFileDetails.has(url), errors[\"templated-url-matches-glob\"]);\n\n const dependencies = templatedURLs[url];\n if (Array.isArray(dependencies)) {\n const details = dependencies.reduce<FileDetails[]>((previous, globPattern) => {\n try {\n const { globbedFileDetails, warning } = getFileDetails({\n globDirectory,\n globFollow,\n globIgnores,\n globPattern,\n globStrict,\n });\n\n if (warning) {\n warnings.push(warning);\n }\n\n return previous.concat(globbedFileDetails);\n } catch (error) {\n const debugObj: { [key: string]: string[] } = {};\n debugObj[url] = dependencies;\n throw new Error(\n `${errors[\"bad-template-urls-asset\"]} '${globPattern}' from '${JSON.stringify(debugObj)}':\\n${\n error instanceof Error ? error.toString() : \"\"\n }`,\n );\n }\n }, []);\n if (details.length === 0) {\n throw new Error(`${errors[\"bad-template-urls-asset\"]} The glob pattern '${dependencies.toString()}' did not match anything.`);\n }\n allFileDetails.set(url, getCompositeDetails(url, details));\n } else if (typeof dependencies === \"string\") {\n allFileDetails.set(url, getStringDetails(url, dependencies));\n }\n }\n }\n\n const transformedManifest = await transformManifest({\n additionalPrecacheEntries,\n dontCacheBustURLsMatching,\n manifestTransforms,\n maximumFileSizeToCacheInBytes,\n modifyURLPrefix,\n fileDetails: Array.from(allFileDetails.values()),\n disablePrecacheManifest,\n });\n\n transformedManifest.warnings.push(...warnings);\n\n return transformedManifest;\n};\n","import { z } from \"zod\";\n/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { SerwistConfigError, validationErrorMap } from \"../schema/error.js\";\nimport type { GetManifestOptionsComplete, InjectManifestOptionsComplete } from \"../types.js\";\n\nexport const validateGetManifestOptions = async (input: unknown): Promise<GetManifestOptionsComplete> => {\n const result = await (await import(\"../schema/get-manifest.js\")).getManifestOptions.spa(input, { error: validationErrorMap });\n if (!result.success) {\n throw new SerwistConfigError({\n moduleName: \"@serwist/build\",\n message: z.prettifyError(result.error),\n });\n }\n return result.data;\n};\n\nexport const validateInjectManifestOptions = async (input: unknown): Promise<InjectManifestOptionsComplete> => {\n const result = await (await import(\"../schema/inject-manifest.js\")).injectManifestOptions.spa(input, { error: validationErrorMap });\n if (!result.success) {\n throw new SerwistConfigError({\n moduleName: \"@serwist/build\",\n message: z.prettifyError(result.error),\n });\n }\n return result.data;\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { validateGetManifestOptions } from \"./lib/validate-options.js\";\nimport type { GetManifestOptions, GetManifestResult } from \"./types.js\";\n\n/**\n * This method returns a list of URLs to precache, referred to as a \"precache\n * manifest\", along with details about the number of entries and their size,\n * based on the options you provide.\n *\n * ```\n * // The following lists some common options; see the rest of the documentation\n * // for the full set of options and defaults.\n * const {count, manifestEntries, size, warnings} = await getManifest({\n * dontCacheBustURLsMatching: [new RegExp('...')],\n * globDirectory: '...',\n * globPatterns: ['...', '...'],\n * maximumFileSizeToCacheInBytes: ...,\n * });\n * ```\n */\nexport const getManifest = async (config: GetManifestOptions): Promise<GetManifestResult> => {\n const options = await validateGetManifestOptions(config);\n\n return await getFileManifestEntries(options);\n};\n","/*\n Copyright 2022 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\n// Adapted from https://github.com/lydell/source-map-url/blob/master/source-map-url.js\n// See https://github.com/GoogleChrome/workbox/issues/3019\nconst innerRegex = /[#@] sourceMappingURL=([^\\s'\"]*)/;\nconst regex = RegExp(`(?:/\\\\*(?:\\\\s*\\r?\\n(?://)?)?(?:${innerRegex.source})\\\\s*\\\\*/|//(?:${innerRegex.source}))\\\\s*`);\n\nexport function getSourceMapURL(srcContents: string): string | null {\n const match = srcContents.match(regex);\n return match ? match[1] || match[2] || \"\" : null;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\n\nexport function rebasePath({ baseDirectory, file }: { baseDirectory: string; file: string }): string {\n // The initial path is relative to the current directory, so make it absolute.\n const absolutePath = path.resolve(file);\n\n // Convert the absolute path so that it's relative to the baseDirectory.\n const relativePath = path.relative(baseDirectory, absolutePath);\n\n // Remove any leading ./ as it won't work in a glob pattern.\n const normalizedPath = path.normalize(relativePath);\n\n return toUnix(normalizedPath);\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { RawSourceMap } from \"source-map\";\nimport { SourceMapConsumer, SourceMapGenerator } from \"source-map\";\n\ninterface ReplaceAndUpdateSourceMapOptions {\n /**\n * The name for the file whose contents\n * correspond to originalSource.\n */\n jsFilename: string;\n /**\n * The sourcemap for originalSource,\n * prior to any replacements.\n */\n originalMap: RawSourceMap;\n /**\n * The source code, prior to any\n * replacements.\n */\n originalSource: string;\n /**\n * A string to swap in for searchString.\n */\n replaceString: string;\n /**\n * A string in originalSource to replace.\n * Only the first occurrence will be replaced.\n */\n searchString: string;\n}\n\n/**\n * Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern\n * JavaScript updates, along with additional properties copied from originalMap.\n *\n * @param options\n * @returns An object containing both\n * originalSource with the replacement applied, and the modified originalMap.\n * @private\n */\nexport async function replaceAndUpdateSourceMap({\n jsFilename,\n originalMap,\n originalSource,\n replaceString,\n searchString,\n}: ReplaceAndUpdateSourceMapOptions): Promise<{ map: string; source: string }> {\n const generator = new SourceMapGenerator({\n file: jsFilename,\n });\n\n const consumer = await new SourceMapConsumer(originalMap);\n\n let pos: number;\n let src = originalSource;\n const replacements: { line: number; column: number }[] = [];\n let lineNum = 0;\n let filePos = 0;\n\n const lines = src.split(\"\\n\");\n for (let line of lines) {\n lineNum++;\n let searchPos = 0;\n while ((pos = line.indexOf(searchString, searchPos)) !== -1) {\n src = src.substring(0, filePos + pos) + replaceString + src.substring(filePos + pos + searchString.length);\n line = line.substring(0, pos) + replaceString + line.substring(pos + searchString.length);\n replacements.push({ line: lineNum, column: pos });\n searchPos = pos + replaceString.length;\n }\n filePos += line.length + 1;\n }\n\n replacements.reverse();\n\n consumer.eachMapping((mapping) => {\n for (const replacement of replacements) {\n if (replacement.line === mapping.generatedLine && mapping.generatedColumn > replacement.column) {\n const offset = searchString.length - replaceString.length;\n mapping.generatedColumn -= offset;\n }\n }\n\n if (mapping.source) {\n const newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn,\n },\n original: {\n line: mapping.originalLine,\n column: mapping.originalColumn,\n },\n source: mapping.source,\n };\n return generator.addMapping(newMapping);\n }\n\n return mapping;\n });\n\n consumer.destroy();\n // JSON.parse returns any.\n const updatedSourceMap: RawSourceMap = Object.assign(JSON.parse(generator.toString()), {\n names: originalMap.names,\n sourceRoot: originalMap.sourceRoot,\n sources: originalMap.sources,\n sourcesContent: originalMap.sourcesContent,\n });\n\n return {\n map: JSON.stringify(updatedSourceMap),\n source: src,\n };\n}\n","/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\nimport { errors } from \"./errors.js\";\n\nexport function translateURLToSourcemapPaths(\n url: string | null,\n swSrc: string,\n swDest: string,\n): {\n destPath: string | undefined;\n srcPath: string | undefined;\n warning: string | undefined;\n} {\n let destPath: string | undefined;\n let srcPath: string | undefined;\n let warning: string | undefined;\n\n if (url && !url.startsWith(\"data:\")) {\n const possibleSrcPath = path.resolve(path.dirname(swSrc), url);\n if (fs.existsSync(possibleSrcPath)) {\n srcPath = toUnix(possibleSrcPath);\n destPath = toUnix(path.resolve(path.dirname(swDest), url));\n } else {\n warning = `${errors[\"cant-find-sourcemap\"]} ${possibleSrcPath}`;\n }\n }\n\n return { destPath, srcPath, warning };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport assert from \"node:assert\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\nimport type { RawSourceMap } from \"source-map\";\nimport { errors } from \"./lib/errors.js\";\nimport { escapeRegExp } from \"./lib/escape-regexp.js\";\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { getSourceMapURL } from \"./lib/get-source-map-url.js\";\nimport { rebasePath } from \"./lib/rebase-path.js\";\nimport { replaceAndUpdateSourceMap } from \"./lib/replace-and-update-source-map.js\";\nimport { translateURLToSourcemapPaths } from \"./lib/translate-url-to-sourcemap-paths.js\";\nimport { validateInjectManifestOptions } from \"./lib/validate-options.js\";\nimport type { BuildResult, InjectManifestOptions } from \"./types.js\";\n\n/**\n * This method creates a list of URLs to precache, referred to as a \"precache\n * manifest\", based on the options you provide.\n *\n * The manifest is injected into the `swSrc` file, and the placeholder string\n * `injectionPoint` determines where in the file the manifest should go.\n *\n * The final service worker file, with the manifest injected, is written to\n * disk at `swDest`.\n *\n * This method will not compile or bundle your `swSrc` file; it just handles\n * injecting the manifest.\n *\n * ```\n * // The following lists some common options; see the rest of the documentation\n * // for the full set of options and defaults.\n * const {count, size, warnings} = await injectManifest({\n * dontCacheBustURLsMatching: [new RegExp('...')],\n * globDirectory: '...',\n * globPatterns: ['...', '...'],\n * maximumFileSizeToCacheInBytes: ...,\n * swDest: '...',\n * swSrc: '...',\n * });\n * ```\n */\nexport const injectManifest = async (config: InjectManifestOptions): Promise<BuildResult> => {\n const options = await validateInjectManifestOptions(config);\n\n // Make sure we leave swSrc and swDest out of the precache manifest.\n for (const file of [options.swSrc, options.swDest]) {\n options.globIgnores!.push(\n rebasePath({\n file,\n baseDirectory: options.globDirectory,\n }),\n );\n }\n\n const globalRegexp = new RegExp(escapeRegExp(options.injectionPoint!), \"g\");\n\n const { count, size, manifestEntries, warnings } = await getFileManifestEntries(options);\n let swFileContents: string;\n try {\n swFileContents = await fsp.readFile(options.swSrc, \"utf8\");\n } catch (error) {\n throw new Error(`${errors[\"invalid-sw-src\"]} ${error instanceof Error && error.message ? error.message : \"\"}`);\n }\n\n const injectionResults = swFileContents.match(globalRegexp);\n // See https://github.com/GoogleChrome/workbox/issues/2230\n const injectionPoint = options.injectionPoint ? options.injectionPoint : \"\";\n if (!injectionResults) {\n if (path.resolve(options.swSrc) === path.resolve(options.swDest)) {\n throw new Error(`${errors[\"same-src-and-dest\"]} ${injectionPoint}`);\n }\n throw new Error(`${errors[\"injection-point-not-found\"]} ${injectionPoint}`);\n }\n\n assert(injectionResults.length === 1, `${errors[\"multiple-injection-points\"]} ${injectionPoint}`);\n\n const manifestString = manifestEntries === undefined ? \"undefined\" : JSON.stringify(manifestEntries);\n\n const filesToWrite: { [key: string]: string } = {};\n\n const url = getSourceMapURL(swFileContents);\n // See https://github.com/GoogleChrome/workbox/issues/2957\n const { destPath, srcPath, warning } = translateURLToSourcemapPaths(url, options.swSrc, options.swDest);\n if (warning) {\n warnings.push(warning);\n }\n\n // If our swSrc file contains a sourcemap, we would invalidate that\n // mapping if we just replaced injectionPoint with the stringified manifest.\n // Instead, we need to update the swDest contents as well as the sourcemap\n // (assuming it's a real file, not a data: URL) at the same time.\n // See https://github.com/GoogleChrome/workbox/issues/2235\n // and https://github.com/GoogleChrome/workbox/issues/2648\n if (srcPath && destPath) {\n const originalMap = JSON.parse(await fsp.readFile(srcPath, \"utf-8\")) as RawSourceMap;\n\n const { map, source } = await replaceAndUpdateSourceMap({\n originalMap,\n jsFilename: toUnix(path.basename(options.swDest)),\n originalSource: swFileContents,\n replaceString: manifestString,\n searchString: options.injectionPoint!,\n });\n\n filesToWrite[options.swDest] = source;\n filesToWrite[destPath] = map;\n } else {\n // If there's no sourcemap associated with swSrc, a simple string\n // replacement will suffice.\n filesToWrite[options.swDest] = swFileContents.replace(globalRegexp, manifestString);\n }\n\n for (const [file, contents] of Object.entries(filesToWrite)) {\n try {\n await fsp.mkdir(path.dirname(file), { recursive: true });\n } catch (error: unknown) {\n throw new Error(`${errors[\"unable-to-make-sw-directory\"]} '${error instanceof Error && error.message ? error.message : \"\"}'`);\n }\n\n await fsp.writeFile(file, contents);\n }\n\n return {\n count,\n size,\n warnings,\n // Use path.resolve() to make all the paths absolute.\n filePaths: Object.keys(filesToWrite).map((f) => toUnix(path.resolve(f))),\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { getManifest } from \"./get-manifest.js\";\nimport { injectManifest } from \"./inject-manifest.js\";\nimport { DEFAULT_GLOB_PATTERNS } from \"./lib/constants.js\";\nimport { errors } from \"./lib/errors.js\";\nimport { escapeRegExp } from \"./lib/escape-regexp.js\";\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { getSourceMapURL } from \"./lib/get-source-map-url.js\";\nimport { rebasePath } from \"./lib/rebase-path.js\";\nimport { replaceAndUpdateSourceMap } from \"./lib/replace-and-update-source-map.js\";\nimport { transformManifest } from \"./lib/transform-manifest.js\";\nimport { translateURLToSourcemapPaths } from \"./lib/translate-url-to-sourcemap-paths.js\";\nimport { validateGetManifestOptions, validateInjectManifestOptions } from \"./lib/validate-options.js\";\n\n// TODO: remove in v10.\n/**\n * Use `JSON.stringify` instead.\n *\n * @deprecated\n */\nconst stringify = JSON.stringify;\n\nexport {\n errors,\n DEFAULT_GLOB_PATTERNS,\n escapeRegExp,\n getFileManifestEntries,\n getManifest,\n getSourceMapURL,\n injectManifest,\n rebasePath,\n replaceAndUpdateSourceMap,\n stringify,\n transformManifest,\n translateURLToSourcemapPaths,\n validateGetManifestOptions,\n validateInjectManifestOptions,\n};\n\nexport type * from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;AAUA,MAAa,SAAS;CACpB,yBAAyB;CACzB,gBAAgB,OAAE;;CAElB,8BAA8B,OAAE;;CAEhC,oCAAoC;CACpC,mBAAmB;CACnB,yBAAyB;CACzB,6BAA6B,OAAE;;CAE/B,2BAA2B,OAAE;;CAE7B,2BAA2B,OAAE;;CAE7B,wBAAwB;CACxB,qCAAqC,OAAE;;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ACjD,gBAAgB;GAChB,eAAe;GACf,cAAc,QAAQ;GACvB,CAAC;AAEF,eAAa,QAAQ,UAAU;AAC/B,eAAa,YAAY;OAIzB,cAAa,QAAQ,UAAU,eAAe,QAAQ,cAAc,eAAe;AAGrF,MAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,aAAa,EAAE;AAC3D,MAAI;AACF,SAAM,IAAI,MAAM,KAAK,QAAQ,KAAK,EAAE,EAAE,WAAW,MAAM,CAAC;WACjD,OAAgB;AACvB,SAAM,IAAI,MAAM,GAAG,OAAO,+BAA+B,IAAI,iBAAiB,SAAS,MAAM,UAAU,MAAM,UAAU,GAAG,GAAG;;AAG/H,QAAM,IAAI,UAAU,MAAM,SAAS;;AAGrC,QAAO;EACL;EACA;EACA;EAEA,WAAW,OAAO,KAAK,aAAa,CAAC,KAAK,MAAM,OAAO,KAAK,QAAQ,EAAE,CAAC,CAAC;EACzE;;;;;;;;;AC7GH,MAAM,YAAY,KAAK"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/errors.ts","../src/lib/get-composite-details.ts","../src/lib/get-string-hash.ts","../src/lib/get-file-hash.ts","../src/lib/get-file-size.ts","../src/lib/get-file-details.ts","../src/lib/get-string-details.ts","../src/lib/additional-precache-entries-transform.ts","../src/lib/maximum-size-transform.ts","../src/lib/escape-regexp.ts","../src/lib/modify-url-prefix-transform.ts","../src/lib/no-revision-for-urls-matching-transform.ts","../src/lib/transform-manifest.ts","../src/lib/get-file-manifest-entries.ts","../src/lib/validate-options.ts","../src/get-manifest.ts","../src/lib/get-source-map-url.ts","../src/lib/rebase-path.ts","../src/lib/replace-and-update-source-map.ts","../src/lib/translate-url-to-sourcemap-paths.ts","../src/inject-manifest.ts","../src/index.ts"],"sourcesContent":["/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport { oneLine as ol } from \"common-tags\";\n\nexport const errors = {\n \"unable-to-get-rootdir\": \"Unable to get the root directory of your web app.\",\n \"no-extension\": ol`Unable to detect a usable extension for a file in your web\n app directory.`,\n \"invalid-file-manifest-name\": ol`The File Manifest Name must have at least one\n character.`,\n \"unable-to-get-file-manifest-name\": \"Unable to get a file manifest name.\",\n \"invalid-sw-dest\": `The 'swDest' value must be a valid path.`,\n \"unable-to-get-sw-name\": \"Unable to get a service worker file name.\",\n \"unable-to-get-save-config\": ol`An error occurred when asking to save details\n in a config file.`,\n \"unable-to-get-file-hash\": ol`An error occurred when attempting to create a\n file hash.`,\n \"unable-to-get-file-size\": ol`An error occurred when attempting to get a file\n size.`,\n \"unable-to-glob-files\": \"An error occurred when globbing for files.\",\n \"unable-to-make-manifest-directory\": ol`Unable to make output directory for\n file manifest.`,\n \"read-manifest-template-failure\": \"Unable to read template for file manifest\",\n \"populating-manifest-tmpl-failed\": ol`An error occurred when populating the\n file manifest template.`,\n \"manifest-file-write-failure\": \"Unable to write the file manifest.\",\n \"unable-to-make-sw-directory\": ol`Unable to make the directories to output\n the service worker path.`,\n \"sw-write-failure\": \"Unable to write the service worker file.\",\n \"sw-write-failure-directory\": ol`Unable to write the service worker file;\n 'swDest' should be a full path to the file, not a path to a directory.`,\n \"unable-to-copy-serwist-libraries\": ol`One or more of the Serwist libraries\n could not be copied over to the destination directory: `,\n \"invalid-glob-directory\": ol`The supplied globDirectory must be a path as a\n string.`,\n \"invalid-dont-cache-bust\": ol`The supplied 'dontCacheBustURLsMatching'\n parameter must be a RegExp.`,\n \"invalid-exclude-files\": \"The excluded files should be an array of strings.\",\n \"invalid-get-manifest-entries-input\": ol`The input to\n 'getFileManifestEntries()' must be an object.`,\n \"invalid-manifest-path\": ol`The supplied manifest path is not a string with\n at least one character.`,\n \"invalid-manifest-entries\": ol`The manifest entries must be an array of\n strings or JavaScript objects containing a url parameter.`,\n \"invalid-manifest-format\": ol`The value of the 'format' option passed to\n generateFileManifest() must be either 'iife' (the default) or 'es'.`,\n \"invalid-static-file-globs\": ol`The 'globPatterns' value must be an array\n of strings.`,\n \"invalid-templated-urls\": ol`The 'templatedURLs' value should be an object\n that maps URLs to either a string, or to an array of glob patterns.`,\n \"templated-url-matches-glob\": ol`One of the 'templatedURLs' URLs is already\n being tracked via 'globPatterns': `,\n \"invalid-glob-ignores\": ol`The 'globIgnores' parameter must be an array of\n glob pattern strings.`,\n \"manifest-entry-bad-url\": ol`The generated manifest contains an entry without\n a URL string. This is likely an error with @serwist/build.`,\n \"modify-url-prefix-bad-prefixes\": ol`The 'modifyURLPrefix' parameter must be\n an object with string key value pairs.`,\n \"invalid-inject-manifest-arg\": ol`The input to 'injectManifest()' must be an\n object.`,\n \"injection-point-not-found\": ol`Unable to find a place to inject the manifest.\n Please ensure that your service worker file contains the following: `,\n \"multiple-injection-points\": ol`Please ensure that your 'swSrc' file contains\n only one match for the following: `,\n \"bad-template-urls-asset\": ol`There was an issue using one of the provided\n 'templatedURLs'.`,\n \"invalid-generate-file-manifest-arg\": ol`The input to generateFileManifest()\n must be an Object.`,\n \"invalid-sw-src\": `The 'swSrc' file can't be read.`,\n \"same-src-and-dest\": ol`Unable to find a place to inject the manifest. This is\n likely because swSrc and swDest are configured to the same file.\n Please ensure that your swSrc file contains the following:`,\n \"no-module-name\": ol`You must provide a moduleName parameter when calling\n getModuleURL().`,\n \"bad-manifest-transforms-return-value\": ol`The return value from a\n manifestTransform should be an object with 'manifest' and optionally\n 'warnings' properties.`,\n \"string-entry-warning\": ol`Some items were passed to additionalPrecacheEntries\n without revisioning info. This is generally NOT safe. Learn more at\n https://bit.ly/wb-precache.`,\n \"cant-find-sourcemap\": ol`The swSrc file refers to a sourcemap that can't be\n opened:`,\n \"manifest-transforms\": ol`When using manifestTransforms, you must provide\n an array of functions.`,\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport crypto from \"node:crypto\";\n\nimport type { FileDetails } from \"../types.js\";\n\nexport const getCompositeDetails = (compositeURL: string, dependencyDetails: FileDetails[]): FileDetails => {\n let totalSize = 0;\n let compositeHash = \"\";\n\n for (const fileDetails of dependencyDetails) {\n totalSize += fileDetails.size;\n compositeHash += fileDetails.hash === null ? \"\" : fileDetails.hash;\n }\n\n const md5 = crypto.createHash(\"md5\");\n md5.update(compositeHash);\n const hashOfHashes = md5.digest(\"hex\");\n\n return {\n file: compositeURL,\n hash: hashOfHashes,\n size: totalSize,\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport crypto from \"node:crypto\";\n\nexport function getStringHash(input: string | NodeJS.ArrayBufferView): string {\n const md5 = crypto.createHash(\"md5\");\n md5.update(input);\n return md5.digest(\"hex\");\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport { readFileSync } from \"node:fs\";\n\nimport { errors } from \"./errors.js\";\nimport { getStringHash } from \"./get-string-hash.js\";\n\nexport const getFileHash = (file: string): string => {\n try {\n const buffer = readFileSync(file);\n return getStringHash(buffer);\n } catch (err) {\n throw new Error(`${errors[\"unable-to-get-file-hash\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n }\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport fs from \"node:fs\";\nimport { errors } from \"./errors.js\";\n\nexport const getFileSize = (file: string): number | null => {\n try {\n const stat = fs.statSync(file);\n if (!stat.isFile()) {\n return null;\n }\n return stat.size;\n } catch (err) {\n throw new Error(`${errors[\"unable-to-get-file-size\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n }\n};\n","/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport path from \"node:path\";\nimport { globSync } from \"glob\";\nimport type { FileDetails, GlobPartial } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { getFileHash } from \"./get-file-hash.js\";\nimport { getFileSize } from \"./get-file-size.js\";\n\nexport const getFileDetails = ({\n globDirectory,\n globFollow,\n globIgnores,\n globPattern,\n}: Omit<GlobPartial, \"globDirectory\" | \"globPatterns\" | \"templatedURLs\"> & {\n // This will only be called when globDirectory is not undefined.\n globDirectory: string;\n globPattern: string;\n}): {\n globbedFileDetails: FileDetails[];\n warning: string;\n} => {\n let globbedFiles: string[];\n let warning = \"\";\n\n try {\n globbedFiles = globSync(globPattern, {\n cwd: globDirectory,\n follow: globFollow,\n ignore: globIgnores,\n });\n } catch (err) {\n throw new Error(`${errors[\"unable-to-glob-files\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n }\n\n const globbedFileDetails: FileDetails[] = [];\n for (const file of globbedFiles) {\n const fullPath = path.join(globDirectory, file);\n const fileSize = getFileSize(fullPath);\n if (fileSize !== null) {\n const fileHash = getFileHash(fullPath);\n globbedFileDetails.push({\n file: path.relative(globDirectory, fullPath),\n hash: fileHash,\n size: fileSize,\n });\n }\n }\n\n return { globbedFileDetails, warning };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { FileDetails } from \"../types.js\";\nimport { getStringHash } from \"./get-string-hash.js\";\n\nexport const getStringDetails = (url: string, str: string): FileDetails => ({\n file: url,\n hash: getStringHash(str),\n size: str.length,\n});\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestEntry } from \"../types.js\";\nimport { errors } from \"./errors.js\";\n\ntype AdditionalManifestEntriesTransform = (manifest: (ManifestEntry & { size: number })[]) => {\n manifest: (ManifestEntry & { size: number })[];\n warnings: string[];\n};\n\nexport const additionalPrecacheEntriesTransform = (additionalPrecacheEntries: (ManifestEntry | string)[]): AdditionalManifestEntriesTransform => {\n return (manifest: (ManifestEntry & { size: number })[]) => {\n const warnings: string[] = [];\n const stringEntries = new Set<string>();\n\n for (const additionalEntry of additionalPrecacheEntries) {\n // Warn about either a string or an object that lacks a revision property.\n // (An object with a revision property set to null is okay.)\n if (typeof additionalEntry === \"string\") {\n stringEntries.add(additionalEntry);\n manifest.push({\n revision: null,\n size: 0,\n url: additionalEntry,\n });\n } else {\n if (additionalEntry && !additionalEntry.integrity && additionalEntry.revision === undefined) {\n stringEntries.add(additionalEntry.url);\n }\n manifest.push(Object.assign({ size: 0 }, additionalEntry));\n }\n }\n\n if (stringEntries.size > 0) {\n let urls = \"\\n\";\n for (const stringEntry of stringEntries) {\n urls += ` - ${stringEntry}\\n`;\n }\n\n warnings.push(errors[\"string-entry-warning\"] + urls);\n }\n\n return {\n manifest,\n warnings,\n };\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport prettyBytes from \"pretty-bytes\";\n\nimport type { ManifestTransform } from \"../types.js\";\n\nexport function maximumSizeTransform(maximumFileSizeToCacheInBytes: number): ManifestTransform {\n return (originalManifest) => {\n const warnings: string[] = [];\n const manifest = originalManifest.filter((entry) => {\n if (entry.size <= maximumFileSizeToCacheInBytes) {\n return true;\n }\n\n warnings.push(\n `${entry.url} is ${prettyBytes(entry.size)}, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.`,\n );\n return false;\n });\n\n return { manifest, warnings };\n };\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\nexport const escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestTransform } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { escapeRegExp } from \"./escape-regexp.js\";\n\nexport function modifyURLPrefixTransform(modifyURLPrefix: { [key: string]: string }): ManifestTransform {\n if (!modifyURLPrefix || typeof modifyURLPrefix !== \"object\" || Array.isArray(modifyURLPrefix)) {\n throw new Error(errors[\"modify-url-prefix-bad-prefixes\"]);\n }\n\n // If there are no entries in modifyURLPrefix, just return an identity\n // function as a shortcut.\n if (Object.keys(modifyURLPrefix).length === 0) {\n return (manifest) => {\n return { manifest };\n };\n }\n\n for (const key of Object.keys(modifyURLPrefix)) {\n if (typeof modifyURLPrefix[key] !== \"string\") {\n throw new Error(errors[\"modify-url-prefix-bad-prefixes\"]);\n }\n }\n\n // Escape the user input so it's safe to use in a regex.\n const safeModifyURLPrefixes = Object.keys(modifyURLPrefix).map(escapeRegExp);\n // Join all the `modifyURLPrefix` keys so a single regex can be used.\n const prefixMatchesStrings = safeModifyURLPrefixes.join(\"|\");\n // Add `^` to the front the prefix matches so it only matches the start of\n // a string.\n const modifyRegex = new RegExp(`^(${prefixMatchesStrings})`);\n\n return (originalManifest) => {\n const manifest = originalManifest.map((entry) => {\n if (typeof entry.url !== \"string\") {\n throw new Error(errors[\"manifest-entry-bad-url\"]);\n }\n\n entry.url = entry.url.replace(modifyRegex, (match) => {\n return modifyURLPrefix[match];\n });\n\n return entry;\n });\n\n return { manifest };\n };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestTransform } from \"../types.js\";\nimport { errors } from \"./errors.js\";\n\nexport function noRevisionForURLsMatchingTransform(regexp: RegExp): ManifestTransform {\n if (!(regexp instanceof RegExp)) {\n throw new Error(errors[\"invalid-dont-cache-bust\"]);\n }\n\n return (originalManifest) => {\n const manifest = originalManifest.map((entry) => {\n if (typeof entry.url !== \"string\") {\n throw new Error(errors[\"manifest-entry-bad-url\"]);\n }\n\n if (entry.url.match(regexp)) {\n entry.revision = null;\n }\n\n return entry;\n });\n\n return { manifest };\n };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { BaseResolved, FileDetails, ManifestEntry, ManifestTransform } from \"../types.js\";\nimport { additionalPrecacheEntriesTransform } from \"./additional-precache-entries-transform.js\";\nimport { errors } from \"./errors.js\";\nimport { maximumSizeTransform } from \"./maximum-size-transform.js\";\nimport { modifyURLPrefixTransform } from \"./modify-url-prefix-transform.js\";\nimport { noRevisionForURLsMatchingTransform } from \"./no-revision-for-urls-matching-transform.js\";\n\n/**\n * A `ManifestTransform` function can be used to modify the modify the `url` or\n * `revision` properties of some or all of the {@linkcode ManifestEntry} in the manifest.\n *\n * Deleting the `revision` property of an entry will cause\n * the corresponding `url` to be precached without cache-busting parameters\n * applied, which is to say, it implies that the URL itself contains\n * proper versioning info. If the `revision` property is present, it must be\n * set to a string.\n *\n * @example A transformation that prepended the origin of a CDN for any\n * URL starting with '/assets/' could be implemented as:\n *\n * const cdnTransform = async (manifestEntries) => {\n * const manifest = manifestEntries.map(entry => {\n * const cdnOrigin = 'https://example.com';\n * if (entry.url.startsWith('/assets/')) {\n * entry.url = cdnOrigin + entry.url;\n * }\n * return entry;\n * });\n * return {manifest, warnings: []};\n * };\n *\n * @example A transformation that nulls the revision field when the\n * URL contains an 8-character hash surrounded by '.', indicating that it\n * already contains revision information:\n *\n * const removeRevisionTransform = async (manifestEntries) => {\n * const manifest = manifestEntries.map(entry => {\n * const hashRegExp = /\\.\\w{8}\\./;\n * if (entry.url.match(hashRegExp)) {\n * entry.revision = null;\n * }\n * return entry;\n * });\n * return {manifest, warnings: []};\n * };\n *\n * @callback ManifestTransform\n * @param manifestEntries The full\n * array of entries, prior to the current transformation.\n * @param compilation When used in the webpack plugins, this param\n * will be set to the current `compilation`.\n * @returns The array of entries with the transformation applied,\n * and optionally, any warnings that should be reported back to the build tool.\n */\ninterface ManifestTransformResultWithWarnings {\n count: number;\n size: number;\n manifestEntries: ManifestEntry[] | undefined;\n warnings: string[];\n}\ninterface ManifestEntryWithSize extends ManifestEntry {\n size: number;\n}\ninterface TransformManifestOptions\n extends Pick<\n BaseResolved,\n | \"additionalPrecacheEntries\"\n | \"dontCacheBustURLsMatching\"\n | \"manifestTransforms\"\n | \"maximumFileSizeToCacheInBytes\"\n | \"modifyURLPrefix\"\n | \"disablePrecacheManifest\"\n > {\n fileDetails: FileDetails[];\n // When this is called by the webpack plugin, transformParam will be the\n // current webpack compilation.\n transformParam?: unknown;\n}\n\nexport async function transformManifest({\n additionalPrecacheEntries,\n dontCacheBustURLsMatching,\n fileDetails,\n manifestTransforms,\n maximumFileSizeToCacheInBytes,\n modifyURLPrefix,\n transformParam,\n disablePrecacheManifest,\n}: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings> {\n if (disablePrecacheManifest) {\n return {\n count: 0,\n size: 0,\n manifestEntries: undefined,\n warnings: [],\n };\n }\n\n const allWarnings: string[] = [];\n\n // Take the array of fileDetail objects and convert it into an array of\n // {url, revision, size} objects, with \\ replaced with /.\n const normalizedManifest: ManifestEntryWithSize[] = fileDetails.map((fileDetails) => ({\n url: fileDetails.file.replace(/\\\\/g, \"/\"),\n revision: fileDetails.hash,\n size: fileDetails.size,\n }));\n\n const transformsToApply: ManifestTransform[] = [];\n\n if (maximumFileSizeToCacheInBytes) {\n transformsToApply.push(maximumSizeTransform(maximumFileSizeToCacheInBytes));\n }\n\n if (modifyURLPrefix) {\n transformsToApply.push(modifyURLPrefixTransform(modifyURLPrefix));\n }\n\n if (dontCacheBustURLsMatching) {\n transformsToApply.push(noRevisionForURLsMatchingTransform(dontCacheBustURLsMatching));\n }\n\n // Run any manifestTransforms functions second-to-last.\n if (manifestTransforms) {\n transformsToApply.push(...manifestTransforms);\n }\n\n // Run additionalPrecacheEntriesTransform last.\n if (additionalPrecacheEntries) {\n transformsToApply.push(additionalPrecacheEntriesTransform(additionalPrecacheEntries));\n }\n\n let transformedManifest: ManifestEntryWithSize[] = normalizedManifest;\n for (const transform of transformsToApply) {\n const result = await transform(transformedManifest, transformParam);\n if (!(\"manifest\" in result)) {\n throw new Error(errors[\"bad-manifest-transforms-return-value\"]);\n }\n\n transformedManifest = result.manifest;\n allWarnings.push(...(result.warnings || []));\n }\n\n // Generate some metadata about the manifest before we clear out the size\n // properties from each entry.\n const count = transformedManifest.length;\n let size = 0;\n for (const manifestEntry of transformedManifest as (ManifestEntry & { size?: number })[]) {\n size += manifestEntry.size || 0;\n delete manifestEntry.size;\n }\n\n return {\n count,\n size,\n manifestEntries: transformedManifest as ManifestEntry[],\n warnings: allWarnings,\n };\n}\n","/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport assert from \"node:assert\";\n\nimport type { FileDetails, GetManifestOptionsComplete, GetManifestResult } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { getCompositeDetails } from \"./get-composite-details.js\";\nimport { getFileDetails } from \"./get-file-details.js\";\nimport { getStringDetails } from \"./get-string-details.js\";\nimport { transformManifest } from \"./transform-manifest.js\";\n\nexport const getFileManifestEntries = async ({\n additionalPrecacheEntries,\n dontCacheBustURLsMatching,\n globDirectory,\n globFollow,\n globIgnores,\n globPatterns = [],\n globStrict,\n manifestTransforms,\n maximumFileSizeToCacheInBytes,\n modifyURLPrefix,\n templatedURLs,\n disablePrecacheManifest,\n}: GetManifestOptionsComplete): Promise<GetManifestResult> => {\n if (disablePrecacheManifest) {\n return {\n count: 0,\n size: 0,\n manifestEntries: undefined,\n warnings: [],\n };\n }\n\n const warnings: string[] = [];\n const allFileDetails = new Map<string, FileDetails>();\n\n try {\n for (const globPattern of globPatterns) {\n const { globbedFileDetails, warning } = getFileDetails({\n globDirectory,\n globFollow,\n globIgnores,\n globPattern,\n globStrict,\n });\n\n if (warning) {\n warnings.push(warning);\n }\n\n for (const details of globbedFileDetails) {\n if (details && !allFileDetails.has(details.file)) {\n allFileDetails.set(details.file, details);\n }\n }\n }\n } catch (error) {\n // If there's an exception thrown while globbing, then report\n // it back as a warning, and don't consider it fatal.\n if (error instanceof Error && error.message) {\n warnings.push(error.message);\n }\n }\n\n if (templatedURLs) {\n for (const url of Object.keys(templatedURLs)) {\n assert(!allFileDetails.has(url), errors[\"templated-url-matches-glob\"]);\n\n const dependencies = templatedURLs[url];\n if (Array.isArray(dependencies)) {\n const details = dependencies.reduce<FileDetails[]>((previous, globPattern) => {\n try {\n const { globbedFileDetails, warning } = getFileDetails({\n globDirectory,\n globFollow,\n globIgnores,\n globPattern,\n globStrict,\n });\n\n if (warning) {\n warnings.push(warning);\n }\n\n return previous.concat(globbedFileDetails);\n } catch (error) {\n const debugObj: { [key: string]: string[] } = {};\n debugObj[url] = dependencies;\n throw new Error(\n `${errors[\"bad-template-urls-asset\"]} '${globPattern}' from '${JSON.stringify(debugObj)}':\\n${\n error instanceof Error ? error.toString() : \"\"\n }`,\n );\n }\n }, []);\n if (details.length === 0) {\n throw new Error(`${errors[\"bad-template-urls-asset\"]} The glob pattern '${dependencies.toString()}' did not match anything.`);\n }\n allFileDetails.set(url, getCompositeDetails(url, details));\n } else if (typeof dependencies === \"string\") {\n allFileDetails.set(url, getStringDetails(url, dependencies));\n }\n }\n }\n\n const transformedManifest = await transformManifest({\n additionalPrecacheEntries,\n dontCacheBustURLsMatching,\n manifestTransforms,\n maximumFileSizeToCacheInBytes,\n modifyURLPrefix,\n fileDetails: Array.from(allFileDetails.values()),\n disablePrecacheManifest,\n });\n\n transformedManifest.warnings.push(...warnings);\n\n return transformedManifest;\n};\n","import { z } from \"zod\";\n/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { SerwistConfigError, validationErrorMap } from \"../schema/error.js\";\nimport type { GetManifestOptionsComplete, InjectManifestOptionsComplete } from \"../types.js\";\n\nexport const validateGetManifestOptions = async (input: unknown): Promise<GetManifestOptionsComplete> => {\n const result = await (await import(\"../schema/get-manifest.js\")).getManifestOptions.spa(input, { error: validationErrorMap });\n if (!result.success) {\n throw new SerwistConfigError({\n moduleName: \"@serwist/build\",\n message: z.prettifyError(result.error),\n });\n }\n return result.data;\n};\n\nexport const validateInjectManifestOptions = async (input: unknown): Promise<InjectManifestOptionsComplete> => {\n const result = await (await import(\"../schema/inject-manifest.js\")).injectManifestOptions.spa(input, { error: validationErrorMap });\n if (!result.success) {\n throw new SerwistConfigError({\n moduleName: \"@serwist/build\",\n message: z.prettifyError(result.error),\n });\n }\n return result.data;\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { validateGetManifestOptions } from \"./lib/validate-options.js\";\nimport type { GetManifestOptions, GetManifestResult } from \"./types.js\";\n\n/**\n * This method returns a list of URLs to precache, referred to as a \"precache\n * manifest\", along with details about the number of entries and their size,\n * based on the options you provide.\n *\n * ```\n * // The following lists some common options; see the rest of the documentation\n * // for the full set of options and defaults.\n * const {count, manifestEntries, size, warnings} = await getManifest({\n * dontCacheBustURLsMatching: [new RegExp('...')],\n * globDirectory: '...',\n * globPatterns: ['...', '...'],\n * maximumFileSizeToCacheInBytes: ...,\n * });\n * ```\n */\nexport const getManifest = async (config: GetManifestOptions): Promise<GetManifestResult> => {\n const options = await validateGetManifestOptions(config);\n\n return await getFileManifestEntries(options);\n};\n","/*\n Copyright 2022 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\n// Adapted from https://github.com/lydell/source-map-url/blob/master/source-map-url.js\n// See https://github.com/GoogleChrome/workbox/issues/3019\nconst innerRegex = /[#@] sourceMappingURL=([^\\s'\"]*)/;\nconst regex = RegExp(`(?:/\\\\*(?:\\\\s*\\r?\\n(?://)?)?(?:${innerRegex.source})\\\\s*\\\\*/|//(?:${innerRegex.source}))\\\\s*`);\n\nexport function getSourceMapURL(srcContents: string): string | null {\n const match = srcContents.match(regex);\n return match ? match[1] || match[2] || \"\" : null;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\n\nexport function rebasePath({ baseDirectory, file }: { baseDirectory: string; file: string }): string {\n // The initial path is relative to the current directory, so make it absolute.\n const absolutePath = path.resolve(file);\n\n // Convert the absolute path so that it's relative to the baseDirectory.\n const relativePath = path.relative(baseDirectory, absolutePath);\n\n // Remove any leading ./ as it won't work in a glob pattern.\n const normalizedPath = path.normalize(relativePath);\n\n return toUnix(normalizedPath);\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { RawSourceMap } from \"source-map\";\nimport { SourceMapConsumer, SourceMapGenerator } from \"source-map\";\n\ninterface ReplaceAndUpdateSourceMapOptions {\n /**\n * The name for the file whose contents\n * correspond to originalSource.\n */\n jsFilename: string;\n /**\n * The sourcemap for originalSource,\n * prior to any replacements.\n */\n originalMap: RawSourceMap;\n /**\n * The source code, prior to any\n * replacements.\n */\n originalSource: string;\n /**\n * A string to swap in for searchString.\n */\n replaceString: string;\n /**\n * A string in originalSource to replace.\n * Only the first occurrence will be replaced.\n */\n searchString: string;\n}\n\n/**\n * Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern\n * JavaScript updates, along with additional properties copied from originalMap.\n *\n * @param options\n * @returns An object containing both\n * originalSource with the replacement applied, and the modified originalMap.\n * @private\n */\nexport async function replaceAndUpdateSourceMap({\n jsFilename,\n originalMap,\n originalSource,\n replaceString,\n searchString,\n}: ReplaceAndUpdateSourceMapOptions): Promise<{ map: string; source: string }> {\n const generator = new SourceMapGenerator({\n file: jsFilename,\n });\n\n const consumer = await new SourceMapConsumer(originalMap);\n\n let pos: number;\n let src = originalSource;\n const replacements: { line: number; column: number }[] = [];\n let lineNum = 0;\n let filePos = 0;\n\n const lines = src.split(\"\\n\");\n for (let line of lines) {\n lineNum++;\n let searchPos = 0;\n while ((pos = line.indexOf(searchString, searchPos)) !== -1) {\n src = src.substring(0, filePos + pos) + replaceString + src.substring(filePos + pos + searchString.length);\n line = line.substring(0, pos) + replaceString + line.substring(pos + searchString.length);\n replacements.push({ line: lineNum, column: pos });\n searchPos = pos + replaceString.length;\n }\n filePos += line.length + 1;\n }\n\n replacements.reverse();\n\n consumer.eachMapping((mapping) => {\n for (const replacement of replacements) {\n if (replacement.line === mapping.generatedLine && mapping.generatedColumn > replacement.column) {\n const offset = searchString.length - replaceString.length;\n mapping.generatedColumn -= offset;\n }\n }\n\n if (mapping.source) {\n const newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn,\n },\n original: {\n line: mapping.originalLine,\n column: mapping.originalColumn,\n },\n source: mapping.source,\n };\n return generator.addMapping(newMapping);\n }\n\n return mapping;\n });\n\n consumer.destroy();\n // JSON.parse returns any.\n const updatedSourceMap: RawSourceMap = Object.assign(JSON.parse(generator.toString()), {\n names: originalMap.names,\n sourceRoot: originalMap.sourceRoot,\n sources: originalMap.sources,\n sourcesContent: originalMap.sourcesContent,\n });\n\n return {\n map: JSON.stringify(updatedSourceMap),\n source: src,\n };\n}\n","/*\n Copyright 2021 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\nimport { errors } from \"./errors.js\";\n\nexport function translateURLToSourcemapPaths(\n url: string | null,\n swSrc: string,\n swDest: string,\n): {\n destPath: string | undefined;\n srcPath: string | undefined;\n warning: string | undefined;\n} {\n let destPath: string | undefined;\n let srcPath: string | undefined;\n let warning: string | undefined;\n\n if (url && !url.startsWith(\"data:\")) {\n const possibleSrcPath = path.resolve(path.dirname(swSrc), url);\n if (fs.existsSync(possibleSrcPath)) {\n srcPath = toUnix(possibleSrcPath);\n destPath = toUnix(path.resolve(path.dirname(swDest), url));\n } else {\n warning = `${errors[\"cant-find-sourcemap\"]} ${possibleSrcPath}`;\n }\n }\n\n return { destPath, srcPath, warning };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport assert from \"node:assert\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\nimport type { RawSourceMap } from \"source-map\";\nimport { errors } from \"./lib/errors.js\";\nimport { escapeRegExp } from \"./lib/escape-regexp.js\";\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { getSourceMapURL } from \"./lib/get-source-map-url.js\";\nimport { rebasePath } from \"./lib/rebase-path.js\";\nimport { replaceAndUpdateSourceMap } from \"./lib/replace-and-update-source-map.js\";\nimport { translateURLToSourcemapPaths } from \"./lib/translate-url-to-sourcemap-paths.js\";\nimport { validateInjectManifestOptions } from \"./lib/validate-options.js\";\nimport type { BuildResult, InjectManifestOptions } from \"./types.js\";\n\n/**\n * This method creates a list of URLs to precache, referred to as a \"precache\n * manifest\", based on the options you provide.\n *\n * The manifest is injected into the `swSrc` file, and the placeholder string\n * `injectionPoint` determines where in the file the manifest should go.\n *\n * The final service worker file, with the manifest injected, is written to\n * disk at `swDest`.\n *\n * This method will not compile or bundle your `swSrc` file; it just handles\n * injecting the manifest.\n *\n * ```\n * // The following lists some common options; see the rest of the documentation\n * // for the full set of options and defaults.\n * const {count, size, warnings} = await injectManifest({\n * dontCacheBustURLsMatching: [new RegExp('...')],\n * globDirectory: '...',\n * globPatterns: ['...', '...'],\n * maximumFileSizeToCacheInBytes: ...,\n * swDest: '...',\n * swSrc: '...',\n * });\n * ```\n */\nexport const injectManifest = async (config: InjectManifestOptions): Promise<BuildResult> => {\n const options = await validateInjectManifestOptions(config);\n\n // Make sure we leave swSrc and swDest out of the precache manifest.\n for (const file of [options.swSrc, options.swDest]) {\n options.globIgnores!.push(\n rebasePath({\n file,\n baseDirectory: options.globDirectory,\n }),\n );\n }\n\n const globalRegexp = new RegExp(escapeRegExp(options.injectionPoint!), \"g\");\n\n const { count, size, manifestEntries, warnings } = await getFileManifestEntries(options);\n let swFileContents: string;\n try {\n swFileContents = await fsp.readFile(options.swSrc, \"utf8\");\n } catch (error) {\n throw new Error(`${errors[\"invalid-sw-src\"]} ${error instanceof Error && error.message ? error.message : \"\"}`);\n }\n\n const injectionResults = swFileContents.match(globalRegexp);\n // See https://github.com/GoogleChrome/workbox/issues/2230\n const injectionPoint = options.injectionPoint ? options.injectionPoint : \"\";\n if (!injectionResults) {\n if (path.resolve(options.swSrc) === path.resolve(options.swDest)) {\n throw new Error(`${errors[\"same-src-and-dest\"]} ${injectionPoint}`);\n }\n throw new Error(`${errors[\"injection-point-not-found\"]} ${injectionPoint}`);\n }\n\n assert(injectionResults.length === 1, `${errors[\"multiple-injection-points\"]} ${injectionPoint}`);\n\n const manifestString = manifestEntries === undefined ? \"undefined\" : JSON.stringify(manifestEntries);\n\n const filesToWrite: { [key: string]: string } = {};\n\n const url = getSourceMapURL(swFileContents);\n // See https://github.com/GoogleChrome/workbox/issues/2957\n const { destPath, srcPath, warning } = translateURLToSourcemapPaths(url, options.swSrc, options.swDest);\n if (warning) {\n warnings.push(warning);\n }\n\n // If our swSrc file contains a sourcemap, we would invalidate that\n // mapping if we just replaced injectionPoint with the stringified manifest.\n // Instead, we need to update the swDest contents as well as the sourcemap\n // (assuming it's a real file, not a data: URL) at the same time.\n // See https://github.com/GoogleChrome/workbox/issues/2235\n // and https://github.com/GoogleChrome/workbox/issues/2648\n if (srcPath && destPath) {\n const originalMap = JSON.parse(await fsp.readFile(srcPath, \"utf-8\")) as RawSourceMap;\n\n const { map, source } = await replaceAndUpdateSourceMap({\n originalMap,\n jsFilename: toUnix(path.basename(options.swDest)),\n originalSource: swFileContents,\n replaceString: manifestString,\n searchString: options.injectionPoint!,\n });\n\n filesToWrite[options.swDest] = source;\n filesToWrite[destPath] = map;\n } else {\n // If there's no sourcemap associated with swSrc, a simple string\n // replacement will suffice.\n filesToWrite[options.swDest] = swFileContents.replace(globalRegexp, manifestString);\n }\n\n for (const [file, contents] of Object.entries(filesToWrite)) {\n try {\n await fsp.mkdir(path.dirname(file), { recursive: true });\n } catch (error: unknown) {\n throw new Error(`${errors[\"unable-to-make-sw-directory\"]} '${error instanceof Error && error.message ? error.message : \"\"}'`);\n }\n\n await fsp.writeFile(file, contents);\n }\n\n return {\n count,\n size,\n warnings,\n // Use path.resolve() to make all the paths absolute.\n filePaths: Object.keys(filesToWrite).map((f) => toUnix(path.resolve(f))),\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { getManifest } from \"./get-manifest.js\";\nimport { injectManifest } from \"./inject-manifest.js\";\nimport { DEFAULT_GLOB_PATTERNS } from \"./lib/constants.js\";\nimport { errors } from \"./lib/errors.js\";\nimport { escapeRegExp } from \"./lib/escape-regexp.js\";\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { getSourceMapURL } from \"./lib/get-source-map-url.js\";\nimport { rebasePath } from \"./lib/rebase-path.js\";\nimport { replaceAndUpdateSourceMap } from \"./lib/replace-and-update-source-map.js\";\nimport { transformManifest } from \"./lib/transform-manifest.js\";\nimport { translateURLToSourcemapPaths } from \"./lib/translate-url-to-sourcemap-paths.js\";\nimport { validateGetManifestOptions, validateInjectManifestOptions } from \"./lib/validate-options.js\";\n\n// TODO: remove in v10.\n/**\n * Use `JSON.stringify` instead.\n *\n * @deprecated\n */\nconst stringify = JSON.stringify;\n\nexport {\n errors,\n DEFAULT_GLOB_PATTERNS,\n escapeRegExp,\n getFileManifestEntries,\n getManifest,\n getSourceMapURL,\n injectManifest,\n rebasePath,\n replaceAndUpdateSourceMap,\n stringify,\n transformManifest,\n translateURLToSourcemapPaths,\n validateGetManifestOptions,\n validateInjectManifestOptions,\n};\n\nexport type * from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;AAUA,MAAa,SAAS;CACpB,yBAAyB;CACzB,gBAAgB,OAAE;;CAElB,8BAA8B,OAAE;;CAEhC,oCAAoC;CACpC,mBAAmB;CACnB,yBAAyB;CACzB,6BAA6B,OAAE;;CAE/B,2BAA2B,OAAE;;CAE7B,2BAA2B,OAAE;;CAE7B,wBAAwB;CACxB,qCAAqC,OAAE;;CAEvC,kCAAkC;CAClC,mCAAmC,OAAE;;CAErC,+BAA+B;CAC/B,+BAA+B,OAAE;;CAEjC,oBAAoB;CACpB,8BAA8B,OAAE;;CAEhC,oCAAoC,OAAE;;CAEtC,0BAA0B,OAAE;;CAE5B,2BAA2B,OAAE;;CAE7B,yBAAyB;CACzB,sCAAsC,OAAE;;CAExC,yBAAyB,OAAE;;CAE3B,4BAA4B,OAAE;;CAE9B,2BAA2B,OAAE;;CAE7B,6BAA6B,OAAE;;CAE/B,0BAA0B,OAAE;;CAE5B,8BAA8B,OAAE;;CAEhC,wBAAwB,OAAE;;CAE1B,0BAA0B,OAAE;;CAE5B,kCAAkC,OAAE;;CAEpC,+BAA+B,OAAE;;CAEjC,6BAA6B,OAAE;;CAE/B,6BAA6B,OAAE;;CAE/B,2BAA2B,OAAE;;CAE7B,sCAAsC,OAAE;;CAExC,kBAAkB;CAClB,qBAAqB,OAAE;;;CAGvB,kBAAkB,OA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GACvB,MAAM,IAAI,MAAM,GAAG,OAAO,+BAA+B,IAAI,iBAAiB,SAAS,MAAM,UAAU,MAAM,UAAU,GAAG,EAAE;EAC9H;EAEA,MAAM,IAAI,UAAU,MAAM,QAAQ;CACpC;CAEA,OAAO;EACL;EACA;EACA;EAEA,WAAW,OAAO,KAAK,YAAY,CAAC,CAAC,KAAK,MAAM,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC;CACzE;AACF;;;;;;;;AC9GA,MAAM,YAAY,KAAK"}
|
package/dist/index.schema.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as manifestTransformResult, r as manifestEntry, t as manifestTransform } from "./chunks/manifest-transform-
|
|
1
|
+
import { n as manifestTransformResult, r as manifestEntry, t as manifestTransform } from "./chunks/manifest-transform-B-PM_veR.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
4
3
|
//#region src/schema/assert-type.d.ts
|
|
5
4
|
type Equals<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
|
|
6
5
|
type Assignable<T, U> = [U] extends [T] ? true : false;
|
|
@@ -16,55 +15,55 @@ declare const basePartial: z.ZodObject<{
|
|
|
16
15
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
17
16
|
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
18
17
|
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
19
|
-
size: z.ZodNumber;
|
|
20
18
|
integrity: z.ZodOptional<z.ZodString>;
|
|
21
19
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
20
|
url: z.ZodString;
|
|
21
|
+
size: z.ZodNumber;
|
|
23
22
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
24
23
|
manifest: z.ZodArray<z.ZodObject<{
|
|
25
|
-
size: z.ZodNumber;
|
|
26
24
|
integrity: z.ZodOptional<z.ZodString>;
|
|
27
25
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
26
|
url: z.ZodString;
|
|
27
|
+
size: z.ZodNumber;
|
|
29
28
|
}, z.core.$strip>>;
|
|
30
29
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
31
30
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
32
|
-
size: z.ZodNumber;
|
|
33
31
|
integrity: z.ZodOptional<z.ZodString>;
|
|
34
32
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
33
|
url: z.ZodString;
|
|
34
|
+
size: z.ZodNumber;
|
|
36
35
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
37
36
|
manifest: z.ZodArray<z.ZodObject<{
|
|
38
|
-
size: z.ZodNumber;
|
|
39
37
|
integrity: z.ZodOptional<z.ZodString>;
|
|
40
38
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
39
|
url: z.ZodString;
|
|
40
|
+
size: z.ZodNumber;
|
|
42
41
|
}, z.core.$strip>>;
|
|
43
42
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
43
|
}, z.core.$strict>>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
45
|
-
size: z.ZodNumber;
|
|
46
44
|
integrity: z.ZodOptional<z.ZodString>;
|
|
47
45
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
46
|
url: z.ZodString;
|
|
47
|
+
size: z.ZodNumber;
|
|
49
48
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
50
49
|
manifest: z.ZodArray<z.ZodObject<{
|
|
51
|
-
size: z.ZodNumber;
|
|
52
50
|
integrity: z.ZodOptional<z.ZodString>;
|
|
53
51
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
52
|
url: z.ZodString;
|
|
53
|
+
size: z.ZodNumber;
|
|
55
54
|
}, z.core.$strip>>;
|
|
56
55
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
56
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
58
|
-
size: z.ZodNumber;
|
|
59
57
|
integrity: z.ZodOptional<z.ZodString>;
|
|
60
58
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
59
|
url: z.ZodString;
|
|
60
|
+
size: z.ZodNumber;
|
|
62
61
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
63
62
|
manifest: z.ZodArray<z.ZodObject<{
|
|
64
|
-
size: z.ZodNumber;
|
|
65
63
|
integrity: z.ZodOptional<z.ZodString>;
|
|
66
64
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
65
|
url: z.ZodString;
|
|
66
|
+
size: z.ZodNumber;
|
|
68
67
|
}, z.core.$strip>>;
|
|
69
68
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
69
|
}, z.core.$strict>>>>>>;
|
|
@@ -74,10 +73,7 @@ declare const basePartial: z.ZodObject<{
|
|
|
74
73
|
//#endregion
|
|
75
74
|
//#region src/schema/error.d.ts
|
|
76
75
|
declare class SerwistConfigError extends Error {
|
|
77
|
-
constructor({
|
|
78
|
-
moduleName,
|
|
79
|
-
message
|
|
80
|
-
}: {
|
|
76
|
+
constructor({ moduleName, message }: {
|
|
81
77
|
moduleName?: string;
|
|
82
78
|
message?: string;
|
|
83
79
|
});
|
|
@@ -86,12 +82,6 @@ declare const validationErrorMap: z.core.$ZodErrorMap;
|
|
|
86
82
|
//#endregion
|
|
87
83
|
//#region src/schema/get-manifest.d.ts
|
|
88
84
|
declare const getManifestOptions: z.ZodObject<{
|
|
89
|
-
globDirectory: z.ZodString;
|
|
90
|
-
globFollow: z.ZodDefault<z.ZodBoolean>;
|
|
91
|
-
globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
92
|
-
globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
93
|
-
globStrict: z.ZodDefault<z.ZodBoolean>;
|
|
94
|
-
templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
95
85
|
additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
96
86
|
integrity: z.ZodOptional<z.ZodString>;
|
|
97
87
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -100,60 +90,66 @@ declare const getManifestOptions: z.ZodObject<{
|
|
|
100
90
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
101
91
|
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
102
92
|
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
103
|
-
size: z.ZodNumber;
|
|
104
93
|
integrity: z.ZodOptional<z.ZodString>;
|
|
105
94
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
95
|
url: z.ZodString;
|
|
96
|
+
size: z.ZodNumber;
|
|
107
97
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
108
98
|
manifest: z.ZodArray<z.ZodObject<{
|
|
109
|
-
size: z.ZodNumber;
|
|
110
99
|
integrity: z.ZodOptional<z.ZodString>;
|
|
111
100
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
101
|
url: z.ZodString;
|
|
102
|
+
size: z.ZodNumber;
|
|
113
103
|
}, z.core.$strip>>;
|
|
114
104
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
105
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
116
|
-
size: z.ZodNumber;
|
|
117
106
|
integrity: z.ZodOptional<z.ZodString>;
|
|
118
107
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
119
108
|
url: z.ZodString;
|
|
109
|
+
size: z.ZodNumber;
|
|
120
110
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
121
111
|
manifest: z.ZodArray<z.ZodObject<{
|
|
122
|
-
size: z.ZodNumber;
|
|
123
112
|
integrity: z.ZodOptional<z.ZodString>;
|
|
124
113
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
114
|
url: z.ZodString;
|
|
115
|
+
size: z.ZodNumber;
|
|
126
116
|
}, z.core.$strip>>;
|
|
127
117
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
118
|
}, z.core.$strict>>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
129
|
-
size: z.ZodNumber;
|
|
130
119
|
integrity: z.ZodOptional<z.ZodString>;
|
|
131
120
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
121
|
url: z.ZodString;
|
|
122
|
+
size: z.ZodNumber;
|
|
133
123
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
134
124
|
manifest: z.ZodArray<z.ZodObject<{
|
|
135
|
-
size: z.ZodNumber;
|
|
136
125
|
integrity: z.ZodOptional<z.ZodString>;
|
|
137
126
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
138
127
|
url: z.ZodString;
|
|
128
|
+
size: z.ZodNumber;
|
|
139
129
|
}, z.core.$strip>>;
|
|
140
130
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
131
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
142
|
-
size: z.ZodNumber;
|
|
143
132
|
integrity: z.ZodOptional<z.ZodString>;
|
|
144
133
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
134
|
url: z.ZodString;
|
|
135
|
+
size: z.ZodNumber;
|
|
146
136
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
147
137
|
manifest: z.ZodArray<z.ZodObject<{
|
|
148
|
-
size: z.ZodNumber;
|
|
149
138
|
integrity: z.ZodOptional<z.ZodString>;
|
|
150
139
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
151
140
|
url: z.ZodString;
|
|
141
|
+
size: z.ZodNumber;
|
|
152
142
|
}, z.core.$strip>>;
|
|
153
143
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
154
144
|
}, z.core.$strict>>>>>>;
|
|
155
145
|
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
156
146
|
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
147
|
+
globFollow: z.ZodDefault<z.ZodBoolean>;
|
|
148
|
+
globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
149
|
+
globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
150
|
+
globStrict: z.ZodDefault<z.ZodBoolean>;
|
|
151
|
+
templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
152
|
+
globDirectory: z.ZodString;
|
|
157
153
|
}, z.core.$strict>;
|
|
158
154
|
//#endregion
|
|
159
155
|
//#region src/schema/glob.d.ts
|
|
@@ -177,15 +173,6 @@ declare const baseInjectPartial: z.ZodObject<{
|
|
|
177
173
|
swSrc: z.ZodString;
|
|
178
174
|
}, z.core.$strict>;
|
|
179
175
|
declare const injectManifestOptions: z.ZodObject<{
|
|
180
|
-
globDirectory: z.ZodString;
|
|
181
|
-
swDest: z.ZodString;
|
|
182
|
-
injectionPoint: z.ZodDefault<z.ZodString>;
|
|
183
|
-
swSrc: z.ZodString;
|
|
184
|
-
globFollow: z.ZodDefault<z.ZodBoolean>;
|
|
185
|
-
globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
186
|
-
globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
187
|
-
globStrict: z.ZodDefault<z.ZodBoolean>;
|
|
188
|
-
templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
189
176
|
additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
190
177
|
integrity: z.ZodOptional<z.ZodString>;
|
|
191
178
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -194,60 +181,69 @@ declare const injectManifestOptions: z.ZodObject<{
|
|
|
194
181
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
195
182
|
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
196
183
|
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
197
|
-
size: z.ZodNumber;
|
|
198
184
|
integrity: z.ZodOptional<z.ZodString>;
|
|
199
185
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
186
|
url: z.ZodString;
|
|
187
|
+
size: z.ZodNumber;
|
|
201
188
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
202
189
|
manifest: z.ZodArray<z.ZodObject<{
|
|
203
|
-
size: z.ZodNumber;
|
|
204
190
|
integrity: z.ZodOptional<z.ZodString>;
|
|
205
191
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
206
192
|
url: z.ZodString;
|
|
193
|
+
size: z.ZodNumber;
|
|
207
194
|
}, z.core.$strip>>;
|
|
208
195
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
196
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
210
|
-
size: z.ZodNumber;
|
|
211
197
|
integrity: z.ZodOptional<z.ZodString>;
|
|
212
198
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
213
199
|
url: z.ZodString;
|
|
200
|
+
size: z.ZodNumber;
|
|
214
201
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
215
202
|
manifest: z.ZodArray<z.ZodObject<{
|
|
216
|
-
size: z.ZodNumber;
|
|
217
203
|
integrity: z.ZodOptional<z.ZodString>;
|
|
218
204
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
219
205
|
url: z.ZodString;
|
|
206
|
+
size: z.ZodNumber;
|
|
220
207
|
}, z.core.$strip>>;
|
|
221
208
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
222
209
|
}, z.core.$strict>>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
223
|
-
size: z.ZodNumber;
|
|
224
210
|
integrity: z.ZodOptional<z.ZodString>;
|
|
225
211
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
226
212
|
url: z.ZodString;
|
|
213
|
+
size: z.ZodNumber;
|
|
227
214
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
228
215
|
manifest: z.ZodArray<z.ZodObject<{
|
|
229
|
-
size: z.ZodNumber;
|
|
230
216
|
integrity: z.ZodOptional<z.ZodString>;
|
|
231
217
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
232
218
|
url: z.ZodString;
|
|
219
|
+
size: z.ZodNumber;
|
|
233
220
|
}, z.core.$strip>>;
|
|
234
221
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
235
222
|
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
236
|
-
size: z.ZodNumber;
|
|
237
223
|
integrity: z.ZodOptional<z.ZodString>;
|
|
238
224
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
225
|
url: z.ZodString;
|
|
226
|
+
size: z.ZodNumber;
|
|
240
227
|
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
241
228
|
manifest: z.ZodArray<z.ZodObject<{
|
|
242
|
-
size: z.ZodNumber;
|
|
243
229
|
integrity: z.ZodOptional<z.ZodString>;
|
|
244
230
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
245
231
|
url: z.ZodString;
|
|
232
|
+
size: z.ZodNumber;
|
|
246
233
|
}, z.core.$strip>>;
|
|
247
234
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
248
235
|
}, z.core.$strict>>>>>>;
|
|
249
236
|
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
250
237
|
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
238
|
+
globFollow: z.ZodDefault<z.ZodBoolean>;
|
|
239
|
+
globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
240
|
+
globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
241
|
+
globStrict: z.ZodDefault<z.ZodBoolean>;
|
|
242
|
+
templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
243
|
+
globDirectory: z.ZodString;
|
|
244
|
+
swDest: z.ZodString;
|
|
245
|
+
injectionPoint: z.ZodDefault<z.ZodString>;
|
|
246
|
+
swSrc: z.ZodString;
|
|
251
247
|
}, z.core.$strict>;
|
|
252
248
|
//#endregion
|
|
253
249
|
//#region src/schema/sw-dest.d.ts
|
|
@@ -259,20 +255,14 @@ declare const requiredSwDestPartial: z.ZodObject<{
|
|
|
259
255
|
}, z.core.$strict>;
|
|
260
256
|
//#endregion
|
|
261
257
|
//#region src/schema/utils.d.ts
|
|
262
|
-
declare const fn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({
|
|
263
|
-
input,
|
|
264
|
-
output
|
|
265
|
-
}: {
|
|
258
|
+
declare const fn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output }: {
|
|
266
259
|
input: TInput;
|
|
267
260
|
output: TOutput;
|
|
268
|
-
}) => z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>, z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>>, z.ZodTransform<(...args: TInput extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [... /*elided*/any, (z.
|
|
269
|
-
declare const asyncFn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({
|
|
270
|
-
input,
|
|
271
|
-
output
|
|
272
|
-
}: {
|
|
261
|
+
}) => z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>, z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>>, z.ZodTransform<(...args: TInput extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [... /*elided*/ any, (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.input<Prefix[k]>; } : [], (z.input<Tail> | undefined)?] : { [k in keyof TInput]: z.input<TInput[k]>; } : []) => z.input<TOutput> extends z.TypeOf<TOutput> ? z.TypeOf<TOutput> & z.input<TOutput> : z.TypeOf<TOutput>, z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>>>;
|
|
262
|
+
declare const asyncFn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output }: {
|
|
273
263
|
input: TInput;
|
|
274
264
|
output: TOutput;
|
|
275
|
-
}) => z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>, z.ZodTransform<Awaited<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> extends infer T ? T extends z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> ? T extends z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> ? T : z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> : never : never>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>>;
|
|
265
|
+
}) => z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>, z.ZodTransform<Awaited<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> extends (infer T) ? T extends z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> ? T extends z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> ? T : z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> : never : never>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>>;
|
|
276
266
|
//#endregion
|
|
277
267
|
export { type Assignable, type Equals, SerwistConfigError, assertType, asyncFn, basePartial, fn, getManifestOptions, globPartial, injectManifestOptions, baseInjectPartial as injectPartial, manifestEntry, manifestTransform, manifestTransformResult, optionalGlobDirectoryPartial, optionalSwDestPartial, requiredGlobDirectoryPartial, requiredSwDestPartial, validationErrorMap };
|
|
278
268
|
//# sourceMappingURL=index.schema.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.schema.d.mts","names":[],"sources":["../src/schema/assert-type.ts","../src/schema/base.ts","../src/schema/error.ts","../src/schema/get-manifest.ts","../src/schema/glob.ts","../src/schema/inject-manifest.ts","../src/schema/sw-dest.ts","../src/schema/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.schema.d.mts","names":[],"sources":["../src/schema/assert-type.ts","../src/schema/base.ts","../src/schema/error.ts","../src/schema/get-manifest.ts","../src/schema/glob.ts","../src/schema/inject-manifest.ts","../src/schema/sw-dest.ts","../src/schema/utils.ts"],"mappings":";;;KAAY,OAAO,GAAG,MAAM,YAAY,OAAO,YAAY;KAE/C,WAAW,GAAG,MAAM,YAAY;iBAE5B,WAAW;;;cCGd,aAAW,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOtB,EAAA,KAAA;;;cCZW,2BAA2B;EACtC,cAAc,YAAY;IAAa;IAAqB;;;cA6BjD,oBAAoB,EAAE,KAAK;;;cC1B3B,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAI7B,EAAA,KAAA;;;cCEW,aAAW,EAAA;;;;;;GAMtB,EAAA,KAAA;cAEW,8BAA4B,EAAA;;GAEvC,EAAA,KAAA;cAIW,8BAA4B,EAAA;;GAEvC,EAAA,KAAA;;;cCrBW,mBAAiB,EAAA;;;GAG5B,EAAA,KAAA;cAEW,uBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMhC,EAAA,KAAA;;;cCdW,uBAAqB,EAAA;;GAEhC,EAAA,KAAA;cAEW,uBAAqB,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AA,cAAA,EAAA,MAAA,0BAAA,WAAA,SAAA,EAAA,MAAA,OAAA,cAAA,EAAA,MAAA,0BAAA,WAAA,SAAA,EAAA,MAAA,OAAA,cAAA,EAAA,MAAA,0BAAA,WAAA,SAAA,EAAA,MAAA,OAAA,cAAA,EAAA,MAAA,0BAAA,WAAA,SAAA,EAAA,MAAA,OAAA,cAAA,EAAA,MAAA,0BAAA,WAAA,SAAA,EAAA,MAAA,OAAA,cAAA,EAAA,MAAA,0BAAA,WAAA,SAAA,EAAA,MAAA,OAAA,gBAAA,EAAA,MAAA,iBAAA,EAAA,OAAA,WAAA,EAAA,OAAA,WAAA,EAAA,MAAA,WAAA,EAAA,OAAA,UAAA,EAAA,KAAA,wBAAA,EAAA,SAAA,eAAA;cAUlI,UAAW,gBAAgB,EAAE,YAAY,EAAE,YAAY,gBAAgB,EAAE,WAAO,OAAA;EAI3F,OAAO;EACP,QAAQ;MACT,EAAA,QAAA,EAAA,UAAA,EAAA,KAAA,6BAAA,EAAA,SAAA,eAAA,UAAA,EAAA,KAAA,6BAAA,EAAA,SAAA,eAAA,WAAA,EAAA,aAAA,QAAA,EAAA,KAAA,6BAAA,EAAA,SAAA,eAAA,wBAAA,KAAA,UAAA,EAAA,KAAA,6BAAA,EAAA,SAAA,eAAA,WAAA,UAAA,EAAA,KAAA,6BAAA,EAAA,SAAA,eAAA,WAAA,IAAA,EAAA,KAAA,6BAAA,EAAA,SAAA,eAAA,2BAAA,EAAA,KAAA,6BAAA,EAAA,SAAA,eAAA"}
|
package/dist/index.schema.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { n as validationErrorMap, t as SerwistConfigError } from "./chunks/error-
|
|
2
|
-
import { a as manifestTransform, c as fn, i as basePartial, l as manifestEntry, n as optionalGlobDirectoryPartial, o as manifestTransformResult, r as requiredGlobDirectoryPartial, s as asyncFn, t as globPartial
|
|
3
|
-
import { t as getManifestOptions } from "./chunks/get-manifest-
|
|
4
|
-
import { a as requiredSwDestPartial, i as optionalSwDestPartial, n as injectManifestOptions, t as baseInjectPartial } from "./chunks/inject-manifest-
|
|
1
|
+
import { n as validationErrorMap, t as SerwistConfigError } from "./chunks/error-B_o2bTQE.js";
|
|
2
|
+
import { a as manifestTransform, c as fn, i as basePartial, l as manifestEntry, n as optionalGlobDirectoryPartial, o as manifestTransformResult, r as requiredGlobDirectoryPartial, s as asyncFn, t as globPartial } from "./chunks/glob-CZkjMdJs.js";
|
|
3
|
+
import { t as getManifestOptions } from "./chunks/get-manifest-C45pHnFK.js";
|
|
4
|
+
import { a as requiredSwDestPartial, i as optionalSwDestPartial, n as injectManifestOptions, t as baseInjectPartial } from "./chunks/inject-manifest-8Ec3euyW.js";
|
|
5
|
+
//#region src/schema/assert-type.ts
|
|
6
|
+
function assertType() {}
|
|
7
|
+
//#endregion
|
|
5
8
|
export { SerwistConfigError, assertType, asyncFn, basePartial, fn, getManifestOptions, globPartial, injectManifestOptions, baseInjectPartial as injectPartial, manifestEntry, manifestTransform, manifestTransformResult, optionalGlobDirectoryPartial, optionalSwDestPartial, requiredGlobDirectoryPartial, requiredSwDestPartial, validationErrorMap };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=index.schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.schema.mjs","names":[],"sources":["../src/schema/assert-type.ts"],"sourcesContent":["export type Equals<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;\n\nexport type Assignable<T, U> = [U] extends [T] ? true : false;\n\nexport function assertType<_T extends true>() {\n // Do nothing\n}\n"],"mappings":";;;;;AAIA,SAAgB,aAA8B,CAE9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/build",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.12",
|
|
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": [
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
"Serwist <ducanh2912.rusty@gmail.com> (https://serwist.pages.dev/)"
|
|
25
25
|
],
|
|
26
26
|
"license": "MIT",
|
|
27
|
-
"repository":
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/serwist/serwist"
|
|
30
|
+
},
|
|
28
31
|
"bugs": "https://github.com/serwist/serwist/issues",
|
|
29
32
|
"homepage": "https://serwist.pages.dev",
|
|
30
33
|
"main": "./dist/index.mjs",
|
|
@@ -51,16 +54,16 @@
|
|
|
51
54
|
"common-tags": "1.8.2",
|
|
52
55
|
"glob": "13.0.6",
|
|
53
56
|
"pretty-bytes": "6.1.1",
|
|
54
|
-
"source-map": "0.8.0
|
|
55
|
-
"type-fest": "5.
|
|
56
|
-
"zod": "4.4.
|
|
57
|
-
"@serwist/utils": "9.5.
|
|
57
|
+
"source-map": "0.8.0",
|
|
58
|
+
"type-fest": "5.8.0",
|
|
59
|
+
"zod": "4.4.3",
|
|
60
|
+
"@serwist/utils": "9.5.12"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
60
63
|
"@types/common-tags": "1.8.4",
|
|
61
|
-
"@types/node": "
|
|
62
|
-
"tsdown": "0.
|
|
63
|
-
"typescript": "
|
|
64
|
+
"@types/node": "26.1.1",
|
|
65
|
+
"tsdown": "0.22.12",
|
|
66
|
+
"typescript": "7.0.2"
|
|
64
67
|
},
|
|
65
68
|
"peerDependencies": {
|
|
66
69
|
"typescript": ">=5.0.0"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import crypto from "node:crypto";
|
|
10
10
|
|
|
11
|
-
export function getStringHash(input:
|
|
11
|
+
export function getStringHash(input: string | NodeJS.ArrayBufferView): string {
|
|
12
12
|
const md5 = crypto.createHash("md5");
|
|
13
13
|
md5.update(input);
|
|
14
14
|
return md5.digest("hex");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob-B4_meZ_o.js","names":[],"sources":["../../src/schema/assert-type.ts","../../src/schema/manifest-entry.ts","../../src/schema/utils.ts","../../src/schema/manifest-transform.ts","../../src/schema/base.ts","../../src/schema/glob.ts"],"sourcesContent":["export type Equals<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;\n\nexport type Assignable<T, U> = [U] extends [T] ? true : false;\n\nexport function assertType<_T extends true>() {\n // Do nothing\n}\n","import { z } from \"zod\";\n\nexport const manifestEntry = z.strictObject({\n integrity: z.string().optional(),\n revision: z.string().nullable().optional(),\n url: z.string(),\n});\n","import { z } from \"zod\";\n\nexport const fn = <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output }: { input: TInput; output: TOutput }) => {\n const schema = z.function({\n input: z.tuple(input),\n output,\n });\n return z\n .custom<z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>>((arg) => typeof arg === \"function\")\n .transform((arg) => schema.implement(arg));\n};\n\nexport const asyncFn = <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({\n input,\n output,\n}: {\n input: TInput;\n output: TOutput;\n}) => {\n const schema = z.function({\n input: z.tuple(input),\n output,\n });\n return z\n .custom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>((arg) => typeof arg === \"function\")\n .transform((arg) => schema.implementAsync(arg));\n};\n","import { z } from \"zod\";\nimport { manifestEntry } from \"./manifest-entry.js\";\nimport { asyncFn } from \"./utils.js\";\n\nconst sizeObject = z.object({ size: z.number() });\n\nconst manifestEntryWithSize = z.object({ ...manifestEntry.shape, ...sizeObject.shape });\n\nexport const manifestTransformResult = z.strictObject({\n manifest: z.array(manifestEntryWithSize),\n warnings: z.array(z.string()).optional(),\n});\n\nexport const manifestTransform = asyncFn({\n input: [z.array(manifestEntryWithSize), z.unknown().optional()],\n output: manifestTransformResult,\n});\n","import { z } from \"zod\";\n\nimport type { BasePartial, BaseResolved } from \"../types.js\";\nimport { assertType, type Equals } from \"./assert-type.js\";\nimport { manifestEntry } from \"./manifest-entry.js\";\nimport { manifestTransform } from \"./manifest-transform.js\";\n\nexport const basePartial = z.strictObject({\n additionalPrecacheEntries: z.array(z.union([z.string(), manifestEntry])).optional(),\n disablePrecacheManifest: z.boolean().default(false),\n dontCacheBustURLsMatching: z.instanceof(RegExp).optional(),\n manifestTransforms: z.array(manifestTransform).optional(),\n maximumFileSizeToCacheInBytes: z.number().default(2097152),\n modifyURLPrefix: z.record(z.string(), z.string()).optional(),\n});\n\nassertType<Equals<BasePartial, z.input<typeof basePartial>>>();\nassertType<Equals<BaseResolved, z.output<typeof basePartial>>>();\n","import { z } from \"zod\";\nimport { DEFAULT_GLOB_PATTERNS } from \"../lib/constants.js\";\nimport type {\n GlobPartial,\n GlobResolved,\n OptionalGlobDirectoryPartial,\n OptionalGlobDirectoryResolved,\n RequiredGlobDirectoryPartial,\n RequiredGlobDirectoryResolved,\n} from \"../types.js\";\nimport { assertType, type Equals } from \"./assert-type.js\";\n\nexport const globPartial = z.strictObject({\n globFollow: z.boolean().default(true),\n globIgnores: z.array(z.string()).default([\"**/node_modules/**/*\"]),\n globPatterns: z.array(z.string()).default(DEFAULT_GLOB_PATTERNS),\n globStrict: z.boolean().default(true),\n templatedURLs: z.record(z.string(), z.union([z.string(), z.array(z.string())])).optional(),\n});\n\nexport const optionalGlobDirectoryPartial = z.strictObject({\n globDirectory: z.string().optional(),\n});\n\n// This needs to be set when using GetManifest or InjectManifest. This is\n// enforced via runtime validation, and needs to be documented.\nexport const requiredGlobDirectoryPartial = z.strictObject({\n globDirectory: z.string(),\n});\n\nassertType<Equals<GlobPartial, z.input<typeof globPartial>>>();\nassertType<Equals<GlobResolved, z.output<typeof globPartial>>>();\nassertType<Equals<OptionalGlobDirectoryPartial, z.input<typeof optionalGlobDirectoryPartial>>>();\nassertType<Equals<OptionalGlobDirectoryResolved, z.output<typeof optionalGlobDirectoryPartial>>>();\nassertType<Equals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