Add types for start-server-webpack-plugin (#43689)

* Added declarations for start-server-webpack-plugin

* Applied standard linting

* Update start-server-webpack-plugin - accept string litterals for 'signal' option

Co-Authored-By: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>

* Update start-server-webpack-plugin - create parameterless constructor suppport

Co-Authored-By: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>

* Update start-server-webpack-plugin - remove redundant typing of 'apply' method

Co-Authored-By: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>

* Update start-server-webpack-plugin - remove typescript version as not needed

Co-Authored-By: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>

* Update start-server-webpack-plugin - combined constructors

Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>
This commit is contained in:
Anthony Genson 2020-04-08 17:56:05 +01:00 committed by GitHub
parent 7ad13bfd69
commit bb3bc696c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,42 @@
// Type definitions for start-server-webpack-plugin 2.2
// Project: https://github.com/ericclemmons/start-server-webpack-plugin
// Definitions by: AGenson <https://github.com/AGenson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Plugin, Compiler } from 'webpack';
export = StartServerWebpackPlugin;
declare class StartServerWebpackPlugin extends Plugin {
constructor(options?: string | StartServerWebpackPlugin.Options);
}
declare namespace StartServerWebpackPlugin {
interface Options {
/**
* Name of the server to start (built asset from webpack).
* If not provided, the plugin will tell you the available names.
*/
name?: string;
/**
* Arguments for node.
* Default: `[]`.
*/
nodeArgs?: string[];
/**
* Arguments for the script.
* Default: `[]`.
*/
args?: string[];
/**
* Signal to send for HMR.
* Default: 'false'.
*/
signal?: false | true | 'SIGUSR2';
/**
* Allow typing 'rs' to restart the server.
* Default: 'true' if in 'development' mode, 'false' otherwise.
*/
keyboard?: boolean;
}
}

View File

@ -0,0 +1,20 @@
import { Configuration } from 'webpack';
import StartServerWebpackPlugin = require('start-server-webpack-plugin');
const c1: Configuration = {
plugins: [
new StartServerWebpackPlugin('main.js')
]
};
const c2: Configuration = {
plugins: [
new StartServerWebpackPlugin({
name: 'main.js',
nodeArgs: [],
args: [],
signal: false,
keyboard: false
})
]
};

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",
"start-server-webpack-plugin-tests.ts"
]
}

View File

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