feat(webpack-entry-manifest-plugin): new definition (#47816)

- definition file
- tests

https://github.com/nuintun/webpack-entry-manifest-plugin

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-09-21 22:13:59 +02:00 committed by GitHub
parent b8e62f2a8b
commit fc8039e9b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,44 @@
// Type definitions for webpack-entry-manifest-plugin 2.0
// Project: https://github.com/nuintun/webpack-entry-manifest-plugin#readme
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Plugin } from 'webpack';
/**
* Webpack plugin for generating an asset manifest with grouped entry chunks
*/
declare class WebpackEntryManifestPlugin extends Plugin {
name: 'WebpackEntryManifestPlugin';
constructor(options?: WebpackEntryManifestPlugin.Options);
}
declare namespace WebpackEntryManifestPlugin {
interface Options {
/**
* Assets manifest filename
* @default 'manifest.json'
*/
filename?: string;
/**
* Assets path map function
* @default path => path
*/
map?: (path: string, chunk: string) => string;
/**
* Assets path filter function
* @default () => true
*/
filter?: (path: string, chunk: string) => boolean;
/**
* Assets manifest serialize function
* @default manifest => JSON.stringify(manifest)
*/
serialize?: (manifest: any) => string;
}
}
export = WebpackEntryManifestPlugin;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"webpack-entry-manifest-plugin-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,13 @@
import webpack = require('webpack');
import WebpackEntryManifestPlugin = require('webpack-entry-manifest-plugin');
const config: webpack.Configuration = {
plugins: [
new WebpackEntryManifestPlugin({
filename: 'manifest.json',
map: (path, chunk) => path,
filter: (path, chunk) => true,
serialize: manifest => JSON.stringify(manifest),
}),
],
};