UNPKG

@serwist/webpack-plugin

Version:

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

72 lines 2.1 kB
import type { Compiler } from "webpack"; import type { InjectManifestOptions, InjectManifestOptionsComplete } from "./lib/types.js"; /** * This class supports compiling a service worker file provided via `swSrc`, * and injecting into that service worker a list of URLs and revision * information for precaching based on the webpack asset pipeline. * * Use an instance of `InjectManifest` in the * [`plugins` array](https://webpack.js.org/concepts/plugins/#usage) of a * webpack config. * * In addition to injecting the manifest, this plugin will perform a compilation * of the `swSrc` file, using the options from the main webpack configuration. * * ``` * // The following lists some common options; see the rest of the documentation * // for the full set of options and defaults. * new InjectManifest({ * exclude: [/.../, '...'], * maximumFileSizeToCacheInBytes: ..., * swSrc: '...', * }); * ``` */ export declare class InjectManifest { protected config: InjectManifestOptionsComplete; private alreadyCalled; private webpack; /** * Creates an instance of InjectManifest. */ constructor(config: InjectManifestOptions); /** * @param compiler default compiler object passed from webpack * * @private */ private propagateWebpackConfig; /** * `getManifestEntriesFromCompilation` with a few additional checks. * * @private */ private getManifestEntries; /** * @param compiler default compiler object passed from webpack * * @private */ apply(compiler: Compiler): void; /** * @param compiler The webpack parent compiler. * @param compilation The webpack compilation. * * @private */ private addSrcToAssets; /** * @param compiler The webpack parent compiler. * @param compilation The webpack compilation. * * @private */ private handleMake; /** * @param compilation The webpack compilation. * * @private */ private addAssets; } //# sourceMappingURL=inject-manifest.d.ts.map