webpack-dev-middleware
- Version 7.4.5
- Published
- 143 kB
- 6 dependencies
- MIT license
Install
npm i webpack-dev-middleware
yarn add webpack-dev-middleware
pnpm add webpack-dev-middleware
Overview
A development middleware for webpack
Index
Functions
Type Aliases
- AdditionalMethods
- API
- Callback
- Close
- Compiler
- Configuration
- Context
- ExtendedServerResponse
- Extra
- FilledContext
- GetFilenameFromUrl
- HapiOptions
- HapiPlugin
- HapiPluginBase
- Headers
- IncomingMessage
- Invalidate
- Logger
- Middleware
- ModifyResponseData
- MultiCompiler
- MultiStats
- MultiWatching
- NextFunction
- NormalizedHeaders
- Options
- OutputFileSystem
- ReadStream
- ResponseData
- Schema
- ServerResponse
- Stats
- WaitUntilValid
- Watching
- WatchOptions
- WithOptional
- WithoutUndefined
Functions
function hapiWrapper
hapiWrapper: < HapiServer, HapiOptionsInternal extends HapiOptions>() => HapiPlugin<HapiServer, HapiOptionsInternal>;
HapiServer {HapiOptions} HapiOptionsInternal
Returns
{HapiPlugin<HapiServer, HapiOptionsInternal>} hapi wrapper
function honoWrapper
honoWrapper: < RequestInternal extends any = any, ResponseInternal extends unknown = any>( compiler: Compiler | MultiCompiler, options?: Options<RequestInternal, ResponseInternal> | undefined) => (ctx: any, next: Function) => Promise<void> | void;
{IncomingMessage} [RequestInternal=IncomingMessage] {ServerResponse} [ResponseInternal=ServerResponse]
Parameter compiler
compiler
Parameter options
options
Returns
{(ctx: any, next: Function) => Promise | void} hono wrapper
function koaWrapper
koaWrapper: < RequestInternal extends any = any, ResponseInternal extends unknown = any>( compiler: Compiler | MultiCompiler, options?: Options<RequestInternal, ResponseInternal> | undefined) => (ctx: any, next: Function) => Promise<void> | void;
{IncomingMessage} [RequestInternal=IncomingMessage] {ServerResponse} [ResponseInternal=ServerResponse]
Parameter compiler
compiler
Parameter options
options
Returns
{(ctx: any, next: Function) => Promise | void} kow wrapper
function wdm
wdm: typeof wdm;
{IncomingMessage} [RequestInternal=IncomingMessage] {ServerResponse} [ResponseInternal=ServerResponse]
Parameter compiler
compiler
Parameter options
options
Returns
{API<RequestInternal, ResponseInternal>} webpack dev middleware
Type Aliases
type AdditionalMethods
type AdditionalMethods< RequestInternal extends IncomingMessage, ResponseInternal extends ServerResponse> = { /** * get filename from url */ getFilenameFromUrl: GetFilenameFromUrl; /** * wait until valid */ waitUntilValid: WaitUntilValid; /** * invalidate */ invalidate: Invalidate; /** * close */ close: Close; /** * context */ context: Context<RequestInternal, ResponseInternal>;};
type API
type API< RequestInternal extends IncomingMessage = import('http').IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = Middleware<RequestInternal, ResponseInternal> & AdditionalMethods<RequestInternal, ResponseInternal>;
type Callback
type Callback = (stats?: (Stats | MultiStats) | undefined) => any;
type Close
type Close = (callback: (err: Error | null | undefined) => void) => any;
type Compiler
type Compiler = import('webpack').Compiler;
type Configuration
type Configuration = import('webpack').Configuration;
type Context
type Context< RequestInternal extends IncomingMessage = import('http').IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = { /** * state */ state: boolean; /** * stats */ stats: Stats | MultiStats | undefined; /** * callbacks */ callbacks: Callback[]; /** * options */ options: Options<RequestInternal, ResponseInternal>; /** * compiler */ compiler: Compiler | MultiCompiler; /** * watching */ watching: Watching | MultiWatching | undefined; /** * logger */ logger: Logger; /** * output file system */ outputFileSystem: OutputFileSystem;};
type ExtendedServerResponse
type ExtendedServerResponse = { /** * locals */ locals?: | { webpack?: { devMiddleware?: Context<IncomingMessage, ServerResponse>; }; } | undefined;};
type Extra
type Extra = import('./utils/getFilenameFromUrl').Extra;
type FilledContext
type FilledContext< RequestInternal extends IncomingMessage = import('http').IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = WithoutUndefined<Context<RequestInternal, ResponseInternal>, 'watching'>;
type GetFilenameFromUrl
type GetFilenameFromUrl = ( url: string, extra?: Extra | undefined) => string | undefined;
type HapiOptions
type HapiOptions = Options & { compiler: Compiler | MultiCompiler;};
type HapiPlugin
type HapiPlugin<S, O> = HapiPluginBase<S, O> & { pkg: { name: string; }; multiple: boolean;};
type HapiPluginBase
type HapiPluginBase<S, O> = { /** * register */ register: (server: S, options: O) => void | Promise<void>;};
type Headers
type Headers< RequestInternal extends IncomingMessage = import('http').IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = | NormalizedHeaders | (( req: RequestInternal, res: ResponseInternal, context: Context<RequestInternal, ResponseInternal> ) => void | undefined | NormalizedHeaders) | undefined;
type IncomingMessage
type IncomingMessage = import('http').IncomingMessage;
type Invalidate
type Invalidate = (callback: Callback) => any;
type Logger
type Logger = ReturnType<Compiler['getInfrastructureLogger']>;
type Middleware
type Middleware< RequestInternal extends IncomingMessage = import('http').IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = ( req: RequestInternal, res: ResponseInternal, next: NextFunction) => Promise<void>;
type ModifyResponseData
type ModifyResponseData< RequestInternal extends IncomingMessage = import('http').IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = ( req: RequestInternal, res: ResponseInternal, data: Buffer | ReadStream, byteLength: number) => ResponseData;
type MultiCompiler
type MultiCompiler = import('webpack').MultiCompiler;
type MultiStats
type MultiStats = import('webpack').MultiStats;
type MultiWatching
type MultiWatching = ReturnType<MultiCompiler['watch']>;
type NextFunction
type NextFunction = (err?: any | undefined) => void;
type NormalizedHeaders
type NormalizedHeaders = | Record<string, string | number> | Array<{ key: string; value: number | string; }>;
type Options
type Options< RequestInternal extends IncomingMessage = import('http').IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = { /** * mime types */ mimeTypes?: | { [key: string]: string; } | undefined; /** * mime type default */ mimeTypeDefault?: (string | undefined) | undefined; /** * write to disk */ writeToDisk?: (boolean | ((targetPath: string) => boolean)) | undefined; /** * methods */ methods?: string[] | undefined; /** * headers */ headers?: Headers<RequestInternal, ResponseInternal> | undefined; /** * public path */ publicPath?: NonNullable<Configuration['output']>['publicPath'] | undefined; /** * stats */ stats?: Configuration['stats'] | undefined; /** * is server side render */ serverSideRender?: boolean | undefined; /** * output file system */ outputFileSystem?: OutputFileSystem | undefined; /** * index */ index?: (boolean | string) | undefined; /** * modify response data */ modifyResponseData?: | ModifyResponseData<RequestInternal, ResponseInternal> | undefined; /** * options to generate etag header */ etag?: ('weak' | 'strong') | undefined; /** * options to generate last modified header */ lastModified?: boolean | undefined; /** * options to generate cache headers */ cacheControl?: | ( | boolean | number | string | { maxAge?: number; immutable?: boolean; } ) | undefined; /** * is cache immutable */ cacheImmutable?: boolean | undefined;};
type OutputFileSystem
type OutputFileSystem = import('webpack').OutputFileSystem & { createReadStream?: typeof import('fs').createReadStream; statSync: import('fs').StatSyncFn; readFileSync: typeof import('fs').readFileSync;};
type ReadStream
type ReadStream = import('fs').ReadStream;
type ResponseData
type ResponseData = { /** * data */ data: Buffer | ReadStream; /** * byte length */ byteLength: number;};
type Schema
type Schema = import('schema-utils/declarations/validate').Schema;
type ServerResponse
type ServerResponse = import('http').ServerResponse & ExtendedServerResponse;
type Stats
type Stats = import('webpack').Stats;
type WaitUntilValid
type WaitUntilValid = (callback: Callback) => any;
type Watching
type Watching = Compiler['watching'];
type WatchOptions
type WatchOptions = NonNullable<Configuration['watchOptions']>;
type WithOptional
type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
type WithoutUndefined
type WithoutUndefined<T, K extends keyof T> = T & { [P in K]: NonNullable<T[P]>;};
Package Files (1)
Dependencies (6)
Dev Dependencies (50)
- @babel/cli
- @babel/core
- @babel/preset-env
- @commitlint/cli
- @commitlint/config-conventional
- @eslint/js
- @eslint/markdown
- @fastify/express
- @hapi/hapi
- @hono/node-server
- @stylistic/eslint-plugin
- @types/connect
- @types/express
- @types/mime-types
- @types/node
- @types/on-finished
- babel-jest
- connect
- cross-env
- cspell
- deepmerge
- del-cli
- eslint
- eslint-config-prettier
- eslint-config-webpack
- eslint-plugin-import
- eslint-plugin-jest
- eslint-plugin-jsdoc
- eslint-plugin-n
- eslint-plugin-prettier
- eslint-plugin-unicorn
- execa
- express
- express-4
- fastify
- file-loader
- finalhandler
- globals
- hono
- husky
- jest
- koa
- lint-staged
- npm-run-all
- prettier
- router
- standard-version
- supertest
- typescript
- webpack
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/webpack-dev-middleware
.
- Markdown[](https://www.jsdocs.io/package/webpack-dev-middleware)
- HTML<a href="https://www.jsdocs.io/package/webpack-dev-middleware"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4634 ms. - Missing or incorrect documentation? Open an issue for this package.