Update webpack-manifest-plugin

...to match https://github.com/danethurber/webpack-manifest-plugin
This commit is contained in:
Stephan Troyer
2018-12-16 12:37:58 +01:00
committed by GitHub
parent 5f83493944
commit a294b4765e
+28 -15
View File
@@ -1,4 +1,4 @@
// Type definitions for webpack-manifest-plugin 1.3
// Type definitions for webpack-manifest-plugin 2.0
// Project: https://github.com/danethurber/webpack-manifest-plugin
// Definitions by: Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -19,13 +19,16 @@ declare namespace WebpackManifestPlugin {
[propName: string]: any;
}
interface HooksOptions {
interface FileDescriptor {
path: string;
chunk: Chunk;
name: string | null;
isChunk: boolean;
/** Is required to run you app. Cannot be true if isChunk is false. */
isInitial: boolean;
isChunk: boolean;
/** Only available is isChunk is true. */
chunk?: Chunk;
isAsset: boolean;
/** Is required by a module. Cannot be true if isAsset is false. */
isModuleAsset: boolean;
}
@@ -37,15 +40,16 @@ declare namespace WebpackManifestPlugin {
fileName?: string;
/**
* A path prefix for all file references. Useful for including your output path in the manifest.
*/
basePath?: string;
/**
* A path prefix used only on output files, similar to Webpack's output.publicPath. Ignored if basePath was also provided.
* A path prefix that will be added to values of the manifest.
* Default: output.publicPath
*/
publicPath?: string;
/**
* A path prefix for all keys. Useful for including your output path in the manifest.
*/
basePath?: string;
/**
* If set to true will emit to build folder and memory in combination with webpack-dev-server
* Default: false
@@ -63,17 +67,26 @@ declare namespace WebpackManifestPlugin {
/**
* Filter out files.
*/
filter?: (options: HooksOptions) => void;
filter?: (file: FileDescriptor) => boolean;
/**
* Modify files details before the manifest is created.
*/
map?: (options: HooksOptions) => void;
map?: (file: FileDescriptor) => FileDescriptor;
/**
* Create the manifest. It can return anything as long as it's serialisable by JSON.stringify. Use the seed options to populate manifest.
* Default: (manifest, {name, path}) => ({...manifest, [name]: path})
* Sort files before they are passed to generate.
*/
reduce?: (manifest: any, options: HooksOptions) => void;
sort?: (file: FileDescriptor) => number;
/**
* Create the manifest. It can return anything as long as it's serialisable by JSON.stringify.
*/
generate?: (seed: object, files: FileDescriptor[]) => object;
/**
* Output manifest file in different format then json (i.e. yaml).
*/
serialize?: (manifest: object) => string;
}
}