mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat(name-all-modules-plugin): new type definition (#44217)
Minimal defintion file for small but useful webpack plugin. https://www.npmjs.com/package/name-all-modules-plugin https://github.com/timse/name-all-modules-plugin Thanks!
This commit is contained in:
parent
ca14596212
commit
b3bf6a93a3
17
types/name-all-modules-plugin/index.d.ts
vendored
Normal file
17
types/name-all-modules-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for name-all-modules-plugin 1.0
|
||||
// Project: https://github.com/timse/name-all-modules-plugin#readme
|
||||
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
/**
|
||||
* Names all remaining modules that do not get named via NamedModulesPlugin
|
||||
*/
|
||||
declare class NameAllModulesPlugin extends Plugin {}
|
||||
|
||||
/**
|
||||
* Names all remaining modules that do not get named via NamedModulesPlugin
|
||||
* {@link https://github.com/timse/name-all-modules-plugin}
|
||||
*/
|
||||
export = NameAllModulesPlugin;
|
||||
@ -0,0 +1,36 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import path = require('path');
|
||||
import { NamedModulesPlugin, NamedChunksPlugin } from 'webpack';
|
||||
import NameAllModulesPlugin = require('name-all-modules-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
main: './src/foo',
|
||||
other: './src/foo-two',
|
||||
vendor: ['preact'],
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'dist'),
|
||||
filename: '[name].[chunkhash].js',
|
||||
},
|
||||
externals: {
|
||||
jquery: 'jQuery',
|
||||
},
|
||||
plugins: [
|
||||
new NamedModulesPlugin(),
|
||||
new NamedChunksPlugin(chunk => {
|
||||
if (chunk.name) {
|
||||
return chunk.name;
|
||||
}
|
||||
return chunk.modules.map((m: any) => path.relative(m.context, m.request)).join('_');
|
||||
}),
|
||||
// some other declaration
|
||||
// ....
|
||||
// and then
|
||||
new NameAllModulesPlugin(),
|
||||
],
|
||||
};
|
||||
|
||||
NameAllModulesPlugin; // $ExpectType typeof NameAllModulesPlugin
|
||||
new NameAllModulesPlugin(); // $ExpectType NameAllModulesPlugin
|
||||
23
types/name-all-modules-plugin/tsconfig.json
Normal file
23
types/name-all-modules-plugin/tsconfig.json
Normal 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",
|
||||
"name-all-modules-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/name-all-modules-plugin/tslint.json
Normal file
1
types/name-all-modules-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user