|
| 1 | +import { Compiler } from 'webpack'; |
| 2 | + |
| 3 | +export = HtmlWebpackTagsPlugin; |
| 4 | + |
| 5 | +declare class HtmlWebpackTagsPlugin { |
| 6 | + constructor(options?: HtmlWebpackTagsPlugin.Options); |
| 7 | + |
| 8 | + apply(compiler: Compiler): void; |
| 9 | +} |
| 10 | + |
| 11 | +declare namespace HtmlWebpackTagsPlugin { |
| 12 | + type AddHashFunction = (assetPath: string, hash: string) => string; |
| 13 | + type AddPublicPathFunction = (assetPath: string, publicPath: string) => string; |
| 14 | + type TypeString = 'css' | 'js'; |
| 15 | + type AttributesObject = { [attributeName: string]: string | boolean | number }; |
| 16 | + |
| 17 | + interface CommonOptions { |
| 18 | + append?: boolean; |
| 19 | + useHash?: boolean; |
| 20 | + addHash?: AddHashFunction |
| 21 | + hash?: boolean | string | AddHashFunction; |
| 22 | + usePublicPath?: boolean; |
| 23 | + addPublicPath?: AddPublicPathFunction |
| 24 | + publicPath?: boolean | string | AddPublicPathFunction; |
| 25 | + } |
| 26 | + |
| 27 | + interface Options extends CommonOptions { |
| 28 | + append?: boolean; |
| 29 | + prependExternals?: boolean; |
| 30 | + jsExtensions?: string | string[]; |
| 31 | + cssExtensions?: string | string[]; |
| 32 | + files?: string[]; |
| 33 | + tags?: string | MaybeLinkTagOptions | MaybeScriptTagOptions | Array<string | MaybeLinkTagOptions | MaybeScriptTagOptions>; |
| 34 | + links?: string | LinkTagOptions | Array<string | LinkTagOptions>; |
| 35 | + scripts?: string | ScriptTagOptions | Array<string | ScriptTagOptions>; |
| 36 | + metas?: string | MetaTagOptions | Array<string | MetaTagOptions>; |
| 37 | + } |
| 38 | + |
| 39 | + interface ExternalObject { |
| 40 | + packageName: string; |
| 41 | + variableName: string; |
| 42 | + } |
| 43 | + |
| 44 | + interface BaseTagOptions extends CommonOptions { |
| 45 | + glob?: string; |
| 46 | + globPath?: string; |
| 47 | + globFlatten?: boolean; |
| 48 | + sourcePath?: string; |
| 49 | + } |
| 50 | + |
| 51 | + interface LinkTagOptions extends BaseTagOptions { |
| 52 | + path: string; |
| 53 | + attributes?: AttributesObject; |
| 54 | + } |
| 55 | + |
| 56 | + interface ScriptTagOptions extends BaseTagOptions { |
| 57 | + path: string; |
| 58 | + attributes?: AttributesObject; |
| 59 | + external?: ExternalObject |
| 60 | + } |
| 61 | + |
| 62 | + interface MaybeLinkTagOptions extends LinkTagOptions { |
| 63 | + type?: TypeString; |
| 64 | + } |
| 65 | + |
| 66 | + interface MaybeScriptTagOptions extends ScriptTagOptions { |
| 67 | + type?: TypeString; |
| 68 | + } |
| 69 | + |
| 70 | + interface MetaTagOptions extends BaseTagOptions { |
| 71 | + path?: string; |
| 72 | + attributes: AttributesObject; |
| 73 | + } |
| 74 | +} |
0 commit comments