@serwist/build 9.0.0-preview.0 → 9.0.0-preview.10

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.
@@ -4,19 +4,16 @@ export declare const webpackPartial: z.ZodObject<{
4
4
  exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
5
5
  excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
6
  include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
7
- mode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
7
  }, "strict", z.ZodTypeAny, {
9
8
  exclude: (string | RegExp | ((args_0: any) => boolean))[];
10
9
  chunks?: string[] | undefined;
11
10
  excludeChunks?: string[] | undefined;
12
11
  include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
13
- mode?: string | null | undefined;
14
12
  }, {
15
13
  chunks?: string[] | undefined;
16
14
  exclude?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
17
15
  excludeChunks?: string[] | undefined;
18
16
  include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
19
- mode?: string | null | undefined;
20
17
  }>;
21
18
  export declare const webpackInjectManifestPartial: z.ZodObject<{
22
19
  compileSrc: z.ZodDefault<z.ZodBoolean>;
@@ -139,7 +136,6 @@ export declare const webpackInjectManifestOptions: z.ZodObject<{
139
136
  chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
140
137
  excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
141
138
  include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
142
- mode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
139
  compileSrc: z.ZodDefault<z.ZodBoolean>;
144
140
  swDest: z.ZodOptional<z.ZodString>;
145
141
  webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
@@ -182,7 +178,6 @@ export declare const webpackInjectManifestOptions: z.ZodObject<{
182
178
  chunks?: string[] | undefined;
183
179
  excludeChunks?: string[] | undefined;
184
180
  include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
185
- mode?: string | null | undefined;
186
181
  swDest?: string | undefined;
187
182
  webpackCompilationPlugins?: any[] | undefined;
188
183
  }, {
@@ -223,7 +218,6 @@ export declare const webpackInjectManifestOptions: z.ZodObject<{
223
218
  chunks?: string[] | undefined;
224
219
  excludeChunks?: string[] | undefined;
225
220
  include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
226
- mode?: string | null | undefined;
227
221
  compileSrc?: boolean | undefined;
228
222
  swDest?: string | undefined;
229
223
  webpackCompilationPlugins?: any[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/schema/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAUwG,CAAC;AAEpI,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EAUxC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAC"}
1
+ {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/schema/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EASmC,CAAC;AAE/D,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EAMmC,CAAC;AAE7E,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKmC,CAAC"}
package/dist/types.d.ts CHANGED
@@ -85,14 +85,14 @@ export interface GlobPartial {
85
85
  /**
86
86
  * Determines whether or not symlinks are followed when generating the
87
87
  * precache manifest. For more information, see the definition of `follow` in
88
- * [`glob`'s documentation](https://github.com/isaacs/node-glob#options).
88
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
89
89
  * @default true
90
90
  */
91
91
  globFollow?: boolean;
92
92
  /**
93
93
  * A set of patterns matching files to always exclude when generating the
94
94
  * precache manifest. For more information, see the definition of `ignore` in
95
- * [`glob`'s documentation](https://github.com/isaacs/node-glob#options).
95
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
96
96
  * @default
97
97
  * ```
98
98
  * ["**\/node_modules\/**\/*"]
@@ -102,7 +102,7 @@ export interface GlobPartial {
102
102
  /**
103
103
  * Files matching any of these patterns will be included in the precache
104
104
  * manifest. For more information, see
105
- * [`glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
105
+ * [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
106
106
  * @default
107
107
  * ```
108
108
  * ["**\/*.{js,css,html}"]
@@ -113,7 +113,7 @@ export interface GlobPartial {
113
113
  * If true, an error reading a directory when generating a precache manifest
114
114
  * will cause the build to fail. If false, the problematic directory will be
115
115
  * skipped. For more information, see the definition of `strict` in
116
- * [`glob`'s documentation](https://github.com/isaacs/node-glob#options).
116
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
117
117
  * @default true
118
118
  */
119
119
  globStrict?: boolean;
@@ -121,7 +121,7 @@ export interface GlobPartial {
121
121
  * If a URL is rendered based on some server-side logic, its contents may
122
122
  * depend on multiple files or on some other unique string value. The keys in
123
123
  * this object are server-rendered URLs. If the values are an array of
124
- * strings, they will be interpreted as `glob` patterns, and the contents of
124
+ * strings, they will be interpreted as glob patterns, and the contents of
125
125
  * any files matching the patterns will be used to uniquely version the URL.
126
126
  * If used with a single string, it will be interpreted as unique versioning
127
127
  * information that you've generated for a given URL.
@@ -174,13 +174,6 @@ export interface WebpackPartial {
174
174
  * as `webpack`'s standard `include` option.
175
175
  */
176
176
  include?: (string | RegExp | ((arg0: any) => boolean))[];
177
- /**
178
- * If set to 'production', then an optimized service worker bundle that
179
- * excludes debugging info will be produced. If not explicitly configured
180
- * here, the `mode` value configured in the current `webpack` compilation
181
- * will be used.
182
- */
183
- mode?: string | null;
184
177
  }
185
178
  export type WebpackResolved = Require<WebpackPartial, "exclude">;
186
179
  export interface RequiredSwDestPartial {
@@ -218,12 +211,12 @@ export interface WebpackInjectManifestPartial {
218
211
  export type WebpackInjectManifestResolved = Require<WebpackInjectManifestPartial, "compileSrc">;
219
212
  export interface NextInjectManifestPartial {
220
213
  /**
221
- * Enable additional route caching when users navigate through pages with
214
+ * Enables additional route caching when users navigate through pages with
222
215
  * `next/link`. This improves the user experience in some cases but it
223
216
  * also adds a bit of overhead due to additional network calls.
224
217
  * @default false
225
218
  */
226
- cacheOnFrontEndNav?: boolean;
219
+ cacheOnNavigation?: boolean;
227
220
  /**
228
221
  * Whether Serwist should be disabled.
229
222
  * @default false
@@ -296,7 +289,7 @@ export interface NextInjectManifestPartial {
296
289
  /**
297
290
  * Files in the public directory matching any of these patterns
298
291
  * will be included in the precache manifest. For more information,
299
- * see [`fast-glob`'s documentation](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#pattern-syntax).
292
+ * see [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
300
293
  * @default
301
294
  * ```
302
295
  * ["**\/*"]
@@ -304,7 +297,7 @@ export interface NextInjectManifestPartial {
304
297
  */
305
298
  globPublicPatterns?: GlobPattern | GlobPattern[];
306
299
  }
307
- export type NextInjectManifestResolved = Require<NextInjectManifestPartial, "cacheOnFrontEndNav" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">;
300
+ export type NextInjectManifestResolved = Require<NextInjectManifestPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">;
308
301
  export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
309
302
  export type GetManifestOptionsComplete = BaseResolved & GlobResolved & RequiredGlobDirectoryResolved;
310
303
  export type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSwDestPartial & RequiredGlobDirectoryPartial;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAEhG,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,MAAM,MA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AC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/build",
3
- "version": "9.0.0-preview.0",
3
+ "version": "9.0.0-preview.10",
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": [
@@ -50,29 +50,29 @@
50
50
  "fast-json-stable-stringify": "2.1.0",
51
51
  "fs-extra": "11.2.0",
52
52
  "glob": "10.3.10",
53
+ "pretty-bytes": "6.1.1",
53
54
  "rollup": "4.9.6",
54
55
  "source-map": "0.8.0-beta.0",
55
56
  "upath": "2.0.1",
56
57
  "zod": "3.22.4",
57
- "@serwist/background-sync": "9.0.0-preview.0",
58
- "@serwist/broadcast-update": "9.0.0-preview.0",
59
- "@serwist/cacheable-response": "9.0.0-preview.0",
60
- "@serwist/core": "9.0.0-preview.0",
61
- "@serwist/expiration": "9.0.0-preview.0",
62
- "@serwist/google-analytics": "9.0.0-preview.0",
63
- "@serwist/precaching": "9.0.0-preview.0",
64
- "@serwist/routing": "9.0.0-preview.0"
58
+ "@serwist/background-sync": "9.0.0-preview.10",
59
+ "@serwist/broadcast-update": "9.0.0-preview.10",
60
+ "@serwist/cacheable-response": "9.0.0-preview.10",
61
+ "@serwist/core": "9.0.0-preview.10",
62
+ "@serwist/expiration": "9.0.0-preview.10",
63
+ "@serwist/google-analytics": "9.0.0-preview.10",
64
+ "@serwist/precaching": "9.0.0-preview.10",
65
+ "@serwist/routing": "9.0.0-preview.10"
65
66
  },
66
67
  "devDependencies": {
67
68
  "@types/common-tags": "1.8.4",
68
69
  "@types/fs-extra": "11.0.4",
69
70
  "@types/node": "20.11.16",
70
71
  "@types/stringify-object": "4.0.5",
71
- "pretty-bytes": "6.1.1",
72
72
  "type-fest": "4.10.2",
73
- "typescript": "5.4.0-dev.20240203",
74
- "@serwist/constants": "9.0.0-preview.0",
75
- "@serwist/utils": "9.0.0-preview.0"
73
+ "typescript": "5.4.0-dev.20240206",
74
+ "@serwist/constants": "9.0.0-preview.10",
75
+ "@serwist/utils": "9.0.0-preview.10"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "typescript": ">=5.0.0"
package/src/lib/errors.ts CHANGED
@@ -72,12 +72,6 @@ export const errors = {
72
72
  Please remove or fix the following: `,
73
73
  "bad-template-urls-asset": ol`There was an issue using one of the provided
74
74
  'templatedURLs'.`,
75
- "invalid-runtime-caching": ol`The 'runtimeCaching' parameter must an an
76
- array of objects with at least a 'urlPattern' and 'handler'.`,
77
- "urlPattern-is-required": ol`The 'urlPattern' option is required when using
78
- 'runtimeCaching'.`,
79
- "handler-is-required": ol`The 'handler' option is required when using
80
- runtimeCaching.`,
81
75
  "invalid-generate-file-manifest-arg": ol`The input to generateFileManifest()
82
76
  must be an Object.`,
83
77
  "invalid-sw-src": `The 'swSrc' file can't be read.`,
@@ -6,7 +6,7 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { glob } from "glob";
9
+ import { globSync } from "glob";
10
10
  import upath from "upath";
11
11
 
12
12
  import type { GlobPartial } from "../types.js";
@@ -20,7 +20,7 @@ interface FileDetails {
20
20
  size: number;
21
21
  }
22
22
 
23
- export function getFileDetails({
23
+ export const getFileDetails = ({
24
24
  globDirectory,
25
25
  globFollow,
26
26
  globIgnores,
@@ -32,12 +32,12 @@ export function getFileDetails({
32
32
  }): {
33
33
  globbedFileDetails: FileDetails[];
34
34
  warning: string;
35
- } {
35
+ } => {
36
36
  let globbedFiles: string[];
37
37
  let warning = "";
38
38
 
39
39
  try {
40
- globbedFiles = glob.sync(globPattern, {
40
+ globbedFiles = globSync(globPattern, {
41
41
  cwd: globDirectory,
42
42
  follow: globFollow,
43
43
  ignore: globIgnores,
@@ -65,4 +65,4 @@ export function getFileDetails({
65
65
  }
66
66
 
67
67
  return { globbedFileDetails, warning };
68
- }
68
+ };
@@ -94,14 +94,14 @@ export async function getFileManifestEntries({
94
94
  const debugObj: { [key: string]: string[] } = {};
95
95
  debugObj[url] = dependencies;
96
96
  throw new Error(
97
- `${errors["bad-template-urls-asset"]} ` +
98
- `'${globPattern}' from '${JSON.stringify(debugObj)}':\n` +
99
- `${error instanceof Error ? error.toString() : ""}`,
97
+ `${errors["bad-template-urls-asset"]} '${globPattern}' from '${JSON.stringify(debugObj)}':\n${
98
+ error instanceof Error ? error.toString() : ""
99
+ }`,
100
100
  );
101
101
  }
102
102
  }, []);
103
103
  if (details.length === 0) {
104
- throw new Error(`${errors["bad-template-urls-asset"]} The glob ` + `pattern '${dependencies.toString()}' did not match anything.`);
104
+ throw new Error(`${errors["bad-template-urls-asset"]} The glob pattern '${dependencies.toString()}' did not match anything.`);
105
105
  }
106
106
  allFileDetails.set(url, getCompositeDetails(url, details));
107
107
  } else if (typeof dependencies === "string") {
@@ -0,0 +1,5 @@
1
+ export type Equals<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
2
+
3
+ export function assertType<_T extends true>() {
4
+ // Do nothing
5
+ }
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  import type { BasePartial, BaseResolved } from "../types.js";
4
+ import { type Equals, assertType } from "./assertType.js";
4
5
  import { manifestEntry } from "./manifestEntry.js";
5
6
  import { manifestTransform } from "./manifestTransform.js";
6
7
 
@@ -13,4 +14,7 @@ export const basePartial = z
13
14
  maximumFileSizeToCacheInBytes: z.number().default(2097152),
14
15
  modifyURLPrefix: z.record(z.string(), z.string()).optional(),
15
16
  })
16
- .strict("Do not pass invalid properties to BasePartial!") satisfies z.ZodType<BaseResolved, z.ZodObjectDef, BasePartial>;
17
+ .strict("Do not pass invalid properties to BasePartial!");
18
+
19
+ assertType<Equals<BasePartial, z.input<typeof basePartial>>>();
20
+ assertType<Equals<BaseResolved, z.output<typeof basePartial>>>();
@@ -1,14 +1,13 @@
1
1
  import type { z } from "zod";
2
-
3
2
  import type { GetManifestOptions, GetManifestOptionsComplete } from "../types.js";
3
+ import { type Equals, assertType } from "./assertType.js";
4
4
  import { basePartial } from "./base.js";
5
5
  import { globPartial, requiredGlobDirectoryPartial } from "./glob.js";
6
6
 
7
7
  export const getManifestOptions = basePartial
8
8
  .merge(globPartial)
9
9
  .merge(requiredGlobDirectoryPartial)
10
- .strict("Do not pass invalid properties to GetManifestOptions!") satisfies z.ZodType<
11
- GetManifestOptionsComplete,
12
- z.ZodObjectDef,
13
- GetManifestOptions
14
- >;
10
+ .strict("Do not pass invalid properties to GetManifestOptions!");
11
+
12
+ assertType<Equals<GetManifestOptions, z.input<typeof getManifestOptions>>>();
13
+ assertType<Equals<GetManifestOptionsComplete, z.output<typeof getManifestOptions>>>();
@@ -7,6 +7,7 @@ import type {
7
7
  RequiredGlobDirectoryPartial,
8
8
  RequiredGlobDirectoryResolved,
9
9
  } from "../types.js";
10
+ import { type Equals, assertType } from "./assertType.js";
10
11
 
11
12
  export const globPartial = z
12
13
  .object({
@@ -16,17 +17,13 @@ export const globPartial = z
16
17
  globStrict: z.boolean().default(true),
17
18
  templatedURLs: z.record(z.string(), z.union([z.string(), z.array(z.string())])).optional(),
18
19
  })
19
- .strict("Do not pass invalid properties to GlobPartial!") satisfies z.ZodType<GlobResolved, z.ZodObjectDef, GlobPartial>;
20
+ .strict("Do not pass invalid properties to GlobPartial!");
20
21
 
21
22
  export const optionalGlobDirectoryPartial = z
22
23
  .object({
23
24
  globDirectory: z.string().optional(),
24
25
  })
25
- .strict("Do not pass invalid properties to OptionalGlobDirectoryPartial!") satisfies z.ZodType<
26
- OptionalGlobDirectoryResolved,
27
- z.ZodObjectDef,
28
- OptionalGlobDirectoryPartial
29
- >;
26
+ .strict("Do not pass invalid properties to OptionalGlobDirectoryPartial!");
30
27
 
31
28
  // This needs to be set when using GetManifest or InjectManifest. This is
32
29
  // enforced via runtime validation, and needs to be documented.
@@ -34,8 +31,11 @@ export const requiredGlobDirectoryPartial = z
34
31
  .object({
35
32
  globDirectory: z.string(),
36
33
  })
37
- .strict("Do not pass invalid properties to RequiredGlobDirectoryPartial!") satisfies z.ZodType<
38
- RequiredGlobDirectoryResolved,
39
- z.ZodObjectDef,
40
- RequiredGlobDirectoryPartial
41
- >;
34
+ .strict("Do not pass invalid properties to RequiredGlobDirectoryPartial!");
35
+
36
+ assertType<Equals<GlobPartial, z.input<typeof globPartial>>>();
37
+ assertType<Equals<GlobResolved, z.output<typeof globPartial>>>();
38
+ assertType<Equals<OptionalGlobDirectoryPartial, z.input<typeof optionalGlobDirectoryPartial>>>();
39
+ assertType<Equals<OptionalGlobDirectoryResolved, z.output<typeof optionalGlobDirectoryPartial>>>();
40
+ assertType<Equals<RequiredGlobDirectoryPartial, z.input<typeof requiredGlobDirectoryPartial>>>();
41
+ assertType<Equals<RequiredGlobDirectoryResolved, z.output<typeof requiredGlobDirectoryPartial>>>();
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import type { InjectManifestOptions, InjectManifestOptionsComplete, InjectPartial, InjectResolved } from "../types.js";
3
+ import { type Equals, assertType } from "./assertType.js";
3
4
  import { basePartial } from "./base.js";
4
5
  import { globPartial, requiredGlobDirectoryPartial } from "./glob.js";
5
6
  import { requiredSwDestPartial } from "./swDest.js";
@@ -9,15 +10,16 @@ export const injectPartial = z
9
10
  injectionPoint: z.string().default("self.__SW_MANIFEST"),
10
11
  swSrc: z.string(),
11
12
  })
12
- .strict("Do not pass invalid properties to InjectPartial!") satisfies z.ZodType<InjectResolved, z.ZodObjectDef, InjectPartial>;
13
+ .strict("Do not pass invalid properties to InjectPartial!");
13
14
 
14
15
  export const injectManifestOptions = basePartial
15
16
  .merge(globPartial)
16
17
  .merge(injectPartial)
17
18
  .merge(requiredSwDestPartial)
18
19
  .merge(requiredGlobDirectoryPartial)
19
- .strict("Do not pass invalid properties to InjectManifestOptions!") satisfies z.ZodType<
20
- InjectManifestOptionsComplete,
21
- z.ZodObjectDef,
22
- InjectManifestOptions
23
- >;
20
+ .strict("Do not pass invalid properties to InjectManifestOptions!");
21
+
22
+ assertType<Equals<InjectPartial, z.input<typeof injectPartial>>>();
23
+ assertType<Equals<InjectResolved, z.output<typeof injectPartial>>>();
24
+ assertType<Equals<InjectManifestOptions, z.input<typeof injectManifestOptions>>>();
25
+ assertType<Equals<InjectManifestOptionsComplete, z.output<typeof injectManifestOptions>>>();
@@ -5,31 +5,29 @@ import type {
5
5
  NextInjectManifestPartial,
6
6
  NextInjectManifestResolved,
7
7
  } from "../types.js";
8
+ import { type Equals, assertType } from "./assertType.js";
8
9
  import { requiredSwDestPartial } from "./swDest.js";
9
10
  import { webpackInjectManifestOptions } from "./webpack.js";
10
11
 
11
12
  export const nextInjectManifestPartial = z
12
13
  .object({
13
- cacheOnFrontEndNav: z.boolean().default(false),
14
+ cacheOnNavigation: z.boolean().default(false),
14
15
  disable: z.boolean().default(false),
15
16
  register: z.boolean().default(true),
16
17
  reloadOnOnline: z.boolean().default(true),
17
18
  scope: z.string().optional(),
18
19
  swUrl: z.string().default("/sw.js"),
19
- globPublicPatterns: z.array(z.string()).default(["**/*"]),
20
+ globPublicPatterns: z.union([z.string(), z.array(z.string())]).default(["**/*"]),
20
21
  })
21
- .strict("Do not pass invalid properties to NextInjectManifestPartial!") satisfies z.ZodType<
22
- NextInjectManifestResolved,
23
- z.ZodObjectDef,
24
- NextInjectManifestPartial
25
- >;
22
+ .strict("Do not pass invalid properties to NextInjectManifestPartial!");
26
23
 
27
24
  export const nextInjectManifestOptions = webpackInjectManifestOptions
28
25
  .merge(requiredSwDestPartial)
29
26
  .merge(nextInjectManifestPartial)
30
27
  .omit({ disablePrecacheManifest: true })
31
- .strict("Do not pass invalid properties to NextInjectManifestOptions!") satisfies z.ZodType<
32
- NextInjectManifestOptionsComplete,
33
- z.ZodObjectDef,
34
- NextInjectManifestOptions
35
- >;
28
+ .strict("Do not pass invalid properties to NextInjectManifestOptions!");
29
+
30
+ assertType<Equals<NextInjectManifestPartial, z.input<typeof nextInjectManifestPartial>>>();
31
+ assertType<Equals<NextInjectManifestResolved, z.output<typeof nextInjectManifestPartial>>>();
32
+ assertType<Equals<NextInjectManifestOptions, z.input<typeof nextInjectManifestOptions>>>();
33
+ assertType<Equals<NextInjectManifestOptionsComplete, z.output<typeof nextInjectManifestOptions>>>();
@@ -1,14 +1,20 @@
1
1
  import { z } from "zod";
2
2
  import type { OptionalSwDestPartial, OptionalSwDestResolved, RequiredSwDestPartial, RequiredSwDestResolved } from "../types.js";
3
+ import { type Equals, assertType } from "./assertType.js";
3
4
 
4
5
  export const optionalSwDestPartial = z
5
6
  .object({
6
7
  swDest: z.string().optional(),
7
8
  })
8
- .strict("Do not pass invalid properties to OptionalSwDest!") satisfies z.ZodType<OptionalSwDestResolved, z.ZodObjectDef, OptionalSwDestPartial>;
9
+ .strict("Do not pass invalid properties to OptionalSwDest!");
9
10
 
10
11
  export const requiredSwDestPartial = z
11
12
  .object({
12
13
  swDest: z.string(),
13
14
  })
14
- .strict("Do not pass invalid properties to RequiredSwDest!") satisfies z.ZodType<RequiredSwDestResolved, z.ZodObjectDef, RequiredSwDestPartial>;
15
+ .strict("Do not pass invalid properties to RequiredSwDest!");
16
+
17
+ assertType<Equals<OptionalSwDestPartial, z.input<typeof optionalSwDestPartial>>>();
18
+ assertType<Equals<OptionalSwDestResolved, z.output<typeof optionalSwDestPartial>>>();
19
+ assertType<Equals<RequiredSwDestPartial, z.input<typeof requiredSwDestPartial>>>();
20
+ assertType<Equals<RequiredSwDestResolved, z.output<typeof requiredSwDestPartial>>>();
@@ -1,5 +1,6 @@
1
1
  import type { z } from "zod";
2
2
  import type { ViteInjectManifestOptions, ViteInjectManifestOptionsComplete } from "../types.js";
3
+ import { type Equals, assertType } from "./assertType.js";
3
4
  import { basePartial } from "./base.js";
4
5
  import { globPartial } from "./glob.js";
5
6
  import { requiredGlobDirectoryPartial } from "./glob.js";
@@ -11,8 +12,7 @@ export const viteInjectManifestOptions = basePartial
11
12
  .merge(injectPartial)
12
13
  .merge(requiredSwDestPartial)
13
14
  .merge(requiredGlobDirectoryPartial)
14
- .strict("Do not pass invalid properties to ViteInjectManifestPartial!") satisfies z.ZodType<
15
- ViteInjectManifestOptionsComplete,
16
- z.ZodObjectDef,
17
- ViteInjectManifestOptions
18
- >;
15
+ .strict("Do not pass invalid properties to ViteInjectManifestPartial!");
16
+
17
+ assertType<Equals<ViteInjectManifestOptions, z.input<typeof viteInjectManifestOptions>>>();
18
+ assertType<Equals<ViteInjectManifestOptionsComplete, z.output<typeof viteInjectManifestOptions>>>();
@@ -7,6 +7,7 @@ import type {
7
7
  WebpackPartial,
8
8
  WebpackResolved,
9
9
  } from "../types.js";
10
+ import { type Equals, assertType } from "./assertType.js";
10
11
  import { basePartial } from "./base.js";
11
12
  import { injectPartial } from "./injectManifest.js";
12
13
  import { optionalSwDestPartial } from "./swDest.js";
@@ -19,9 +20,8 @@ export const webpackPartial = z
19
20
  .default([/\.map$/, /^manifest.*\.js$/]),
20
21
  excludeChunks: z.array(z.string()).optional(),
21
22
  include: z.array(z.union([z.string(), z.instanceof(RegExp), z.function(z.tuple([z.any()]), z.boolean())])).optional(),
22
- mode: z.string().nullable().optional(),
23
23
  })
24
- .strict("Do not pass invalid properties to WebpackPartial!") satisfies z.ZodType<WebpackResolved, z.ZodObjectDef, WebpackPartial>;
24
+ .strict("Do not pass invalid properties to WebpackPartial!");
25
25
 
26
26
  export const webpackInjectManifestPartial = z
27
27
  .object({
@@ -29,19 +29,18 @@ export const webpackInjectManifestPartial = z
29
29
  swDest: z.string().optional(),
30
30
  webpackCompilationPlugins: z.array(z.any()).optional(),
31
31
  })
32
- .strict("Do not pass invalid properties to WebpackInjectManifestPartial!") satisfies z.ZodType<
33
- WebpackInjectManifestResolved,
34
- z.ZodObjectDef,
35
- WebpackInjectManifestPartial
36
- >;
32
+ .strict("Do not pass invalid properties to WebpackInjectManifestPartial!");
37
33
 
38
34
  export const webpackInjectManifestOptions = basePartial
39
35
  .merge(webpackPartial)
40
36
  .merge(injectPartial)
41
37
  .merge(optionalSwDestPartial)
42
38
  .merge(webpackInjectManifestPartial)
43
- .strict("Do not pass invalid properties to WebpackInjectManifestOptions!") satisfies z.ZodType<
44
- WebpackInjectManifestOptionsComplete,
45
- z.ZodObjectDef,
46
- WebpackInjectManifestOptions
47
- >;
39
+ .strict("Do not pass invalid properties to WebpackInjectManifestOptions!");
40
+
41
+ assertType<Equals<z.input<typeof webpackPartial>, WebpackPartial>>();
42
+ assertType<Equals<WebpackResolved, z.output<typeof webpackPartial>>>();
43
+ assertType<Equals<WebpackInjectManifestPartial, z.input<typeof webpackInjectManifestPartial>>>();
44
+ assertType<Equals<WebpackInjectManifestResolved, z.output<typeof webpackInjectManifestPartial>>>();
45
+ assertType<Equals<WebpackInjectManifestOptions, z.input<typeof webpackInjectManifestOptions>>>();
46
+ assertType<Equals<WebpackInjectManifestOptionsComplete, z.output<typeof webpackInjectManifestOptions>>>();
package/src/types.ts CHANGED
@@ -97,14 +97,14 @@ export interface GlobPartial {
97
97
  /**
98
98
  * Determines whether or not symlinks are followed when generating the
99
99
  * precache manifest. For more information, see the definition of `follow` in
100
- * [`glob`'s documentation](https://github.com/isaacs/node-glob#options).
100
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
101
101
  * @default true
102
102
  */
103
103
  globFollow?: boolean;
104
104
  /**
105
105
  * A set of patterns matching files to always exclude when generating the
106
106
  * precache manifest. For more information, see the definition of `ignore` in
107
- * [`glob`'s documentation](https://github.com/isaacs/node-glob#options).
107
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
108
108
  * @default
109
109
  * ```
110
110
  * ["**\/node_modules\/**\/*"]
@@ -114,7 +114,7 @@ export interface GlobPartial {
114
114
  /**
115
115
  * Files matching any of these patterns will be included in the precache
116
116
  * manifest. For more information, see
117
- * [`glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
117
+ * [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
118
118
  * @default
119
119
  * ```
120
120
  * ["**\/*.{js,css,html}"]
@@ -125,7 +125,7 @@ export interface GlobPartial {
125
125
  * If true, an error reading a directory when generating a precache manifest
126
126
  * will cause the build to fail. If false, the problematic directory will be
127
127
  * skipped. For more information, see the definition of `strict` in
128
- * [`glob`'s documentation](https://github.com/isaacs/node-glob#options).
128
+ * [`node-glob`'s documentation](https://github.com/isaacs/node-glob#options).
129
129
  * @default true
130
130
  */
131
131
  globStrict?: boolean;
@@ -133,7 +133,7 @@ export interface GlobPartial {
133
133
  * If a URL is rendered based on some server-side logic, its contents may
134
134
  * depend on multiple files or on some other unique string value. The keys in
135
135
  * this object are server-rendered URLs. If the values are an array of
136
- * strings, they will be interpreted as `glob` patterns, and the contents of
136
+ * strings, they will be interpreted as glob patterns, and the contents of
137
137
  * any files matching the patterns will be used to uniquely version the URL.
138
138
  * If used with a single string, it will be interpreted as unique versioning
139
139
  * information that you've generated for a given URL.
@@ -194,13 +194,6 @@ export interface WebpackPartial {
194
194
  * as `webpack`'s standard `include` option.
195
195
  */
196
196
  include?: (string | RegExp | ((arg0: any) => boolean))[];
197
- /**
198
- * If set to 'production', then an optimized service worker bundle that
199
- * excludes debugging info will be produced. If not explicitly configured
200
- * here, the `mode` value configured in the current `webpack` compilation
201
- * will be used.
202
- */
203
- mode?: string | null;
204
197
  }
205
198
 
206
199
  export type WebpackResolved = Require<WebpackPartial, "exclude">;
@@ -249,12 +242,12 @@ export type WebpackInjectManifestResolved = Require<WebpackInjectManifestPartial
249
242
 
250
243
  export interface NextInjectManifestPartial {
251
244
  /**
252
- * Enable additional route caching when users navigate through pages with
245
+ * Enables additional route caching when users navigate through pages with
253
246
  * `next/link`. This improves the user experience in some cases but it
254
247
  * also adds a bit of overhead due to additional network calls.
255
248
  * @default false
256
249
  */
257
- cacheOnFrontEndNav?: boolean;
250
+ cacheOnNavigation?: boolean;
258
251
  /**
259
252
  * Whether Serwist should be disabled.
260
253
  * @default false
@@ -327,7 +320,7 @@ export interface NextInjectManifestPartial {
327
320
  /**
328
321
  * Files in the public directory matching any of these patterns
329
322
  * will be included in the precache manifest. For more information,
330
- * see [`fast-glob`'s documentation](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#pattern-syntax).
323
+ * see [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
331
324
  * @default
332
325
  * ```
333
326
  * ["**\/*"]
@@ -338,7 +331,7 @@ export interface NextInjectManifestPartial {
338
331
 
339
332
  export type NextInjectManifestResolved = Require<
340
333
  NextInjectManifestPartial,
341
- "cacheOnFrontEndNav" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns"
334
+ "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns"
342
335
  >;
343
336
 
344
337
  export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;