@serwist/build 9.0.0-preview.9 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/glob.js +3 -3
- package/dist/chunks/injectManifest.js +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -50
- package/dist/index.schema.d.ts +13 -0
- package/dist/index.schema.d.ts.map +1 -0
- package/dist/index.schema.js +9 -0
- package/dist/lib/additional-precache-entries-transform.d.ts +6 -8
- package/dist/lib/additional-precache-entries-transform.d.ts.map +1 -1
- package/dist/lib/get-file-details.d.ts +3 -9
- package/dist/lib/get-file-details.d.ts.map +1 -1
- package/dist/lib/get-file-hash.d.ts +1 -1
- package/dist/lib/get-file-hash.d.ts.map +1 -1
- package/dist/lib/get-file-manifest-entries.d.ts +2 -2
- package/dist/lib/get-file-manifest-entries.d.ts.map +1 -1
- package/dist/lib/get-string-details.d.ts +1 -1
- package/dist/lib/get-string-details.d.ts.map +1 -1
- package/dist/lib/get-string-hash.d.ts +1 -1
- package/dist/lib/get-string-hash.d.ts.map +1 -1
- package/dist/lib/transform-manifest.d.ts +4 -3
- package/dist/lib/transform-manifest.d.ts.map +1 -1
- package/dist/lib/validate-options.d.ts +1 -3
- package/dist/lib/validate-options.d.ts.map +1 -1
- package/dist/schema/assertType.d.ts +1 -0
- package/dist/schema/assertType.d.ts.map +1 -1
- package/dist/schema/base.d.ts +24 -24
- package/dist/schema/getManifest.d.ts +24 -24
- package/dist/schema/injectManifest.d.ts +27 -27
- package/dist/schema/injectManifest.d.ts.map +1 -1
- package/dist/schema/manifestEntry.d.ts +3 -3
- package/dist/schema/manifestTransform.d.ts +18 -18
- package/dist/{lib/serwist-config-error.d.ts → schema/serwistConfigError.d.ts} +1 -1
- package/dist/schema/serwistConfigError.d.ts.map +1 -0
- package/dist/types.d.ts +9 -152
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -24
- package/src/index.schema.ts +29 -0
- package/src/index.ts +2 -3
- package/src/inject-manifest.ts +1 -1
- package/src/lib/additional-precache-entries-transform.ts +4 -8
- package/src/lib/get-composite-details.ts +2 -2
- package/src/lib/get-file-details.ts +9 -17
- package/src/lib/get-file-hash.ts +4 -4
- package/src/lib/get-file-manifest-entries.ts +5 -5
- package/src/lib/get-string-details.ts +5 -7
- package/src/lib/get-string-hash.ts +1 -1
- package/src/lib/transform-manifest.ts +28 -16
- package/src/lib/validate-options.ts +2 -23
- package/src/schema/assertType.ts +2 -0
- package/src/schema/injectManifest.ts +4 -4
- package/src/schema/manifestEntry.ts +1 -1
- package/src/types.ts +9 -184
- package/dist/chunks/vite.js +0 -7
- package/dist/chunks/webpack.js +0 -33
- package/dist/index.next.d.ts +0 -3
- package/dist/index.next.d.ts.map +0 -1
- package/dist/index.next.js +0 -38
- package/dist/lib/serwist-config-error.d.ts.map +0 -1
- package/dist/lib/validate-next-options.d.ts +0 -3
- package/dist/lib/validate-next-options.d.ts.map +0 -1
- package/dist/schema/next.d.ts +0 -240
- package/dist/schema/next.d.ts.map +0 -1
- package/dist/schema/vite.d.ts +0 -196
- package/dist/schema/vite.d.ts.map +0 -1
- package/dist/schema/webpack.d.ts +0 -225
- package/dist/schema/webpack.d.ts.map +0 -1
- package/src/index.next.ts +0 -3
- package/src/lib/validate-next-options.ts +0 -14
- package/src/schema/next.ts +0 -33
- package/src/schema/vite.ts +0 -18
- package/src/schema/webpack.ts +0 -46
- package/dist/chunks/{serwist-config-error.js → validationErrorMap.js} +7 -7
- /package/src/{lib/serwist-config-error.ts → schema/serwistConfigError.ts} +0 -0
package/src/schema/next.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type {
|
|
3
|
-
NextInjectManifestOptions,
|
|
4
|
-
NextInjectManifestOptionsComplete,
|
|
5
|
-
NextInjectManifestPartial,
|
|
6
|
-
NextInjectManifestResolved,
|
|
7
|
-
} from "../types.js";
|
|
8
|
-
import { type Equals, assertType } from "./assertType.js";
|
|
9
|
-
import { requiredSwDestPartial } from "./swDest.js";
|
|
10
|
-
import { webpackInjectManifestOptions } from "./webpack.js";
|
|
11
|
-
|
|
12
|
-
export const nextInjectManifestPartial = z
|
|
13
|
-
.object({
|
|
14
|
-
cacheOnNavigation: z.boolean().default(false),
|
|
15
|
-
disable: z.boolean().default(false),
|
|
16
|
-
register: z.boolean().default(true),
|
|
17
|
-
reloadOnOnline: z.boolean().default(true),
|
|
18
|
-
scope: z.string().optional(),
|
|
19
|
-
swUrl: z.string().default("/sw.js"),
|
|
20
|
-
globPublicPatterns: z.union([z.string(), z.array(z.string())]).default(["**/*"]),
|
|
21
|
-
})
|
|
22
|
-
.strict("Do not pass invalid properties to NextInjectManifestPartial!");
|
|
23
|
-
|
|
24
|
-
export const nextInjectManifestOptions = webpackInjectManifestOptions
|
|
25
|
-
.merge(requiredSwDestPartial)
|
|
26
|
-
.merge(nextInjectManifestPartial)
|
|
27
|
-
.omit({ disablePrecacheManifest: true })
|
|
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>>>();
|
package/src/schema/vite.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { z } from "zod";
|
|
2
|
-
import type { ViteInjectManifestOptions, ViteInjectManifestOptionsComplete } from "../types.js";
|
|
3
|
-
import { type Equals, assertType } from "./assertType.js";
|
|
4
|
-
import { basePartial } from "./base.js";
|
|
5
|
-
import { globPartial } from "./glob.js";
|
|
6
|
-
import { requiredGlobDirectoryPartial } from "./glob.js";
|
|
7
|
-
import { injectPartial } from "./injectManifest.js";
|
|
8
|
-
import { requiredSwDestPartial } from "./swDest.js";
|
|
9
|
-
|
|
10
|
-
export const viteInjectManifestOptions = basePartial
|
|
11
|
-
.merge(globPartial)
|
|
12
|
-
.merge(injectPartial)
|
|
13
|
-
.merge(requiredSwDestPartial)
|
|
14
|
-
.merge(requiredGlobDirectoryPartial)
|
|
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>>>();
|
package/src/schema/webpack.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type {
|
|
3
|
-
WebpackInjectManifestOptions,
|
|
4
|
-
WebpackInjectManifestOptionsComplete,
|
|
5
|
-
WebpackInjectManifestPartial,
|
|
6
|
-
WebpackInjectManifestResolved,
|
|
7
|
-
WebpackPartial,
|
|
8
|
-
WebpackResolved,
|
|
9
|
-
} from "../types.js";
|
|
10
|
-
import { type Equals, assertType } from "./assertType.js";
|
|
11
|
-
import { basePartial } from "./base.js";
|
|
12
|
-
import { injectPartial } from "./injectManifest.js";
|
|
13
|
-
import { optionalSwDestPartial } from "./swDest.js";
|
|
14
|
-
|
|
15
|
-
export const webpackPartial = z
|
|
16
|
-
.object({
|
|
17
|
-
chunks: z.array(z.string()).optional(),
|
|
18
|
-
exclude: z
|
|
19
|
-
.array(z.union([z.string(), z.instanceof(RegExp), z.function(z.tuple([z.any()]), z.boolean())]))
|
|
20
|
-
.default([/\.map$/, /^manifest.*\.js$/]),
|
|
21
|
-
excludeChunks: z.array(z.string()).optional(),
|
|
22
|
-
include: z.array(z.union([z.string(), z.instanceof(RegExp), z.function(z.tuple([z.any()]), z.boolean())])).optional(),
|
|
23
|
-
})
|
|
24
|
-
.strict("Do not pass invalid properties to WebpackPartial!");
|
|
25
|
-
|
|
26
|
-
export const webpackInjectManifestPartial = z
|
|
27
|
-
.object({
|
|
28
|
-
compileSrc: z.boolean().default(true),
|
|
29
|
-
swDest: z.string().optional(),
|
|
30
|
-
webpackCompilationPlugins: z.array(z.any()).optional(),
|
|
31
|
-
})
|
|
32
|
-
.strict("Do not pass invalid properties to WebpackInjectManifestPartial!");
|
|
33
|
-
|
|
34
|
-
export const webpackInjectManifestOptions = basePartial
|
|
35
|
-
.merge(webpackPartial)
|
|
36
|
-
.merge(injectPartial)
|
|
37
|
-
.merge(optionalSwDestPartial)
|
|
38
|
-
.merge(webpackInjectManifestPartial)
|
|
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>>>();
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
class SerwistConfigError extends Error {
|
|
4
|
+
constructor({ moduleName, message }){
|
|
5
|
+
super(`Received an invalid ${moduleName ?? "Serwist"} configuration: ${message}`);
|
|
6
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
3
10
|
const validationErrorMap = (error, ctx)=>{
|
|
4
11
|
switch(error.code){
|
|
5
12
|
case z.ZodIssueCode.invalid_type:
|
|
@@ -44,11 +51,4 @@ const validationErrorMap = (error, ctx)=>{
|
|
|
44
51
|
};
|
|
45
52
|
};
|
|
46
53
|
|
|
47
|
-
class SerwistConfigError extends Error {
|
|
48
|
-
constructor({ moduleName, message }){
|
|
49
|
-
super(`Received an invalid ${moduleName ?? "Serwist"} configuration: ${message}`);
|
|
50
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
54
|
export { SerwistConfigError as S, validationErrorMap as v };
|
|
File without changes
|