mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[react-dev-utils] Add new arguments to createCompiler arguments (#35215)
* [react-dev-utils] Add new arguments to createCompiler arguments * lint * nits
This commit is contained in:
parent
d6b1fd3373
commit
f9aa66f353
61
types/react-dev-utils/WebpackDevServerUtils.d.ts
vendored
61
types/react-dev-utils/WebpackDevServerUtils.d.ts
vendored
@ -16,25 +16,66 @@ export interface Urls {
|
||||
*/
|
||||
export function choosePort(host: string, defaultPort: number): Promise<number | null>;
|
||||
|
||||
export interface CreateCompilerOptions {
|
||||
/**
|
||||
* The name that will be printed to the terminal.
|
||||
*/
|
||||
appName: string;
|
||||
/**
|
||||
* The webpack configuration options to be provided to the webpack constructor.
|
||||
*/
|
||||
config: webpack.Configuration;
|
||||
/**
|
||||
* To provide the `urls` argument, use `prepareUrls()` described below.
|
||||
*/
|
||||
urls: Urls;
|
||||
/**
|
||||
* If `true`; yarn instructions will be emitted in the terminal instead of npm.
|
||||
*/
|
||||
useYarn?: boolean;
|
||||
/**
|
||||
* Takes the `require('webpack')` entry point.
|
||||
*/
|
||||
webpack: typeof webpack;
|
||||
}
|
||||
export interface CreateCompilerOptionsTypescript extends CreateCompilerOptions {
|
||||
/**
|
||||
* Required if useTypeScript is `true`.
|
||||
* This is useful when running fork-ts-checker-webpack-plugin with `async: true` to
|
||||
* report errors that are emitted after the webpack build is complete.
|
||||
*/
|
||||
devSocket: {
|
||||
/**
|
||||
* Called when there are build errors.
|
||||
*/
|
||||
errors: (errors: string[]) => void;
|
||||
/**
|
||||
* Called when there are build warnings.
|
||||
*/
|
||||
warnings: (warnings: string[]) => void;
|
||||
};
|
||||
/**
|
||||
* If `true`, TypeScript type checking will be enabled.
|
||||
* Be sure to provide the `devSocket` argument above if this is set to `true`.
|
||||
*/
|
||||
useTypeScript: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Webpack compiler instance for WebpackDevServer with built-in
|
||||
* helpful messages. Takes the `require('webpack')` entry point.
|
||||
* To provide the `urls` argument, use `prepareUrls()` described below.
|
||||
* helpful messages.
|
||||
*/
|
||||
export function createCompiler(opts: {
|
||||
webpack: typeof webpack,
|
||||
config: webpack.Configuration,
|
||||
appName: string,
|
||||
urls: Urls,
|
||||
useYarn: boolean,
|
||||
}): webpack.Compiler;
|
||||
export function createCompiler(opts: CreateCompilerOptions): webpack.Compiler;
|
||||
// if the signatures are merged, TS will not enforce that both useTypeScript and devSocket are provided
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
export function createCompiler(opts: CreateCompilerOptionsTypescript): webpack.Compiler;
|
||||
|
||||
/**
|
||||
* Creates a WebpackDevServer `proxy` configuration object from the `proxy`
|
||||
* setting in `package.json`.
|
||||
*/
|
||||
export function prepareProxy(
|
||||
proxySetting: any,
|
||||
proxySetting: string | undefined,
|
||||
appPublicFolder: string,
|
||||
): WebpackDevServer.ProxyConfigArray;
|
||||
|
||||
|
||||
@ -4,9 +4,7 @@ import { Stats } from 'webpack';
|
||||
* Extracts and prettifies warning and error messages from webpack
|
||||
* [stats](https://github.com/webpack/docs/wiki/node.js-api#stats) object.
|
||||
*/
|
||||
declare function formatWebpackMessages(
|
||||
json: Stats.ToJsonOutput,
|
||||
): {
|
||||
declare function formatWebpackMessages(json: Stats.ToJsonOutput): {
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
};
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
"printHostingInstructions.d.ts",
|
||||
"WatchMissingNodeModulesPlugin.d.ts",
|
||||
"WebpackDevServerUtils.d.ts",
|
||||
"webpackHotDevClient.d.ts",
|
||||
"test/eslintFormatter.ts",
|
||||
"test/noopServiceWorkerMiddleware.ts",
|
||||
"test/utils.ts",
|
||||
|
||||
4
types/react-dev-utils/webpackHotDevClient.d.ts
vendored
Normal file
4
types/react-dev-utils/webpackHotDevClient.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/** This is an alternative client for WebpackDevServer that shows a syntax error overlay. */
|
||||
export {};
|
||||
|
||||
// Note - this file doesn't actually export anything
|
||||
Loading…
Reference in New Issue
Block a user