From a294b4765e5a01429de186d488fe4860d5c974eb Mon Sep 17 00:00:00 2001 From: Stephan Troyer Date: Sun, 16 Dec 2018 12:37:58 +0100 Subject: [PATCH] Update webpack-manifest-plugin ...to match https://github.com/danethurber/webpack-manifest-plugin --- types/webpack-manifest-plugin/index.d.ts | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/types/webpack-manifest-plugin/index.d.ts b/types/webpack-manifest-plugin/index.d.ts index 22cf2e6eba..c0d9067a1c 100644 --- a/types/webpack-manifest-plugin/index.d.ts +++ b/types/webpack-manifest-plugin/index.d.ts @@ -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 // 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; } }