UNPKG

@serwist/webpack-plugin

Version:

A plugin for your webpack build process, helping you generate a manifest of local files that should be precached.

38 lines (35 loc) 1.09 kB
import { fn, optionalSwDestPartial, injectPartial as injectPartial$1, basePartial } from '@serwist/build/schema'; import { z } from 'zod'; const webpackConditionCallback = fn({ input: [ z.any() ], output: z.boolean() }); const webpackCondition = z.union([ z.string(), z.instanceof(RegExp), webpackConditionCallback ]); const webpackPartial = z.strictObject({ chunks: z.array(z.string()).optional(), exclude: z.array(webpackCondition).default([ /\.map$/, /^manifest.*\.js$/ ]), excludeChunks: z.array(z.string()).optional(), include: z.array(webpackCondition).optional() }); const injectPartial = z.strictObject({ compileSrc: z.boolean().default(true), swDest: z.string().optional(), webpackCompilationPlugins: z.array(z.any()).optional() }); const injectManifestOptions = z.strictObject({ ...basePartial.shape, ...webpackPartial.shape, ...injectPartial$1.shape, ...optionalSwDestPartial.shape, ...injectPartial.shape }); export { injectManifestOptions, injectPartial, webpackPartial };