Socket
Socket
Sign inDemoInstall

webpack-dev-middleware

Package Overview
Dependencies
88
Maintainers
4
Versions
113
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.1.1 to 7.0.0

7

dist/index.js

@@ -275,2 +275,6 @@ "use strict";

ready(context, callback);
/**
* @type {NonNullable<Context<RequestInternal, ResponseInternal>["watching"]>}
*/
context.watching.invalidate();

@@ -281,2 +285,5 @@ };

instance.close = (callback = noop) => {
/**
* @type {NonNullable<Context<RequestInternal, ResponseInternal>["watching"]>}
*/
context.watching.close(callback);

@@ -283,0 +290,0 @@ };

18

dist/utils/compatibleAPI.js

@@ -41,5 +41,4 @@ "use strict";

// Express API
if (typeof /** @type {Request & ExpectedRequest} */req.get === "function") {
return (/** @type {Request & ExpectedRequest} */req.get(name)
);
if (typeof ( /** @type {Request & ExpectedRequest} */req.get) === "function") {
return /** @type {Request & ExpectedRequest} */req.get(name);
}

@@ -60,5 +59,4 @@

// Express API
if (typeof /** @type {Response & ExpectedResponse} */res.get === "function") {
return (/** @type {Response & ExpectedResponse} */res.get(name)
);
if (typeof ( /** @type {Response & ExpectedResponse} */res.get) === "function") {
return /** @type {Response & ExpectedResponse} */res.get(name);
}

@@ -79,3 +77,3 @@

// Express API
if (typeof /** @type {Response & ExpectedResponse} */res.set === "function") {
if (typeof ( /** @type {Response & ExpectedResponse} */res.set) === "function") {
/** @type {Response & ExpectedResponse} */

@@ -96,3 +94,3 @@ res.set(name, typeof value === "number" ? String(value) : value);

function setStatusCode(res, code) {
if (typeof /** @type {Response & ExpectedResponse} */res.status === "function") {
if (typeof ( /** @type {Response & ExpectedResponse} */res.status) === "function") {
/** @type {Response & ExpectedResponse} */

@@ -116,3 +114,3 @@ res.status(code);

function send(req, res, bufferOtStream, byteLength) {
if (typeof /** @type {import("fs").ReadStream} */bufferOtStream.pipe === "function") {
if (typeof ( /** @type {import("fs").ReadStream} */bufferOtStream.pipe) === "function") {
setHeaderForResponse(res, "Content-Length", byteLength);

@@ -128,3 +126,3 @@ if (req.method === "HEAD") {

}
if (typeof /** @type {Response & ExpectedResponse} */res.send === "function") {
if (typeof ( /** @type {Response & ExpectedResponse} */res.send) === "function") {
/** @type {Response & ExpectedResponse} */

@@ -131,0 +129,0 @@ res.send(bufferOtStream);

@@ -21,3 +21,3 @@ "use strict";

const childStats = /** @type {MultiStats} */
stats.stats ? /** @type {MultiStats} */stats.stats : [/** @type {Stats} */stats];
stats.stats ? /** @type {MultiStats} */stats.stats : [( /** @type {Stats} */stats)];
const publicPaths = [];

@@ -24,0 +24,0 @@ for (const {

{
"name": "webpack-dev-middleware",
"version": "6.1.1",
"version": "7.0.0",
"description": "A development middleware for webpack",

@@ -17,3 +17,3 @@ "license": "MIT",

"engines": {
"node": ">= 14.15.0"
"node": ">= 18.12.0"
},

@@ -57,3 +57,3 @@ "scripts": {

"colorette": "^2.0.10",
"memfs": "^3.4.12",
"memfs": "^4.6.0",
"mime-types": "^2.1.31",

@@ -67,8 +67,8 @@ "range-parser": "^1.2.1",

"@babel/preset-env": "^7.16.7",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@types/connect": "^3.4.35",
"@types/express": "^4.17.13",
"@types/mime-types": "^2.1.1",
"@types/node": "^18.11.9",
"@types/node": "^20.10.5",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",

@@ -83,3 +83,3 @@ "babel-jest": "^29.3.1",

"eslint": "^8.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.25.4",

@@ -90,10 +90,10 @@ "execa": "^5.1.1",

"husky": "^8.0.2",
"lint-staged": "^13.0.3",
"lint-staged": "^15.2.0",
"jest": "^29.3.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.0",
"prettier": "^3.1.1",
"standard-version": "^9.3.0",
"strip-ansi": "^6.0.0",
"supertest": "^6.1.3",
"typescript": "^4.9.3",
"typescript": "^5.3.3",
"webpack": "^5.68.0"

@@ -100,0 +100,0 @@ },

@@ -53,3 +53,3 @@ <div align="center">

// webpack-dev-middleware options
})
}),
);

@@ -436,3 +436,3 @@

// webpack-dev-middleware options
})
}),
);

@@ -439,0 +439,0 @@

@@ -138,6 +138,6 @@ /// <reference types="node" />

RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
ResponseInternal extends ServerResponse,
>(
compiler: Compiler | MultiCompiler,
options?: Options<RequestInternal, ResponseInternal> | undefined
options?: Options<RequestInternal, ResponseInternal> | undefined,
): API<RequestInternal, ResponseInternal>;

@@ -177,30 +177,7 @@ declare namespace wdm {

}
type ServerResponse = import("http").ServerResponse & ExtendedServerResponse;
type Compiler = import("webpack").Compiler;
type MultiCompiler = import("webpack").MultiCompiler;
type Options<
RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
> = {
mimeTypes?:
| {
[key: string]: string;
}
| undefined;
mimeTypeDefault?: string | undefined;
writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined;
methods?: string[] | undefined;
headers?: Headers<RequestInternal, ResponseInternal>;
publicPath?: NonNullable<Configuration["output"]>["publicPath"];
stats?: Configuration["stats"];
serverSideRender?: boolean | undefined;
outputFileSystem?: OutputFileSystem | undefined;
index?: string | boolean | undefined;
modifyResponseData?:
| ModifyResponseData<RequestInternal, ResponseInternal>
| undefined;
};
type API<
RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
ResponseInternal extends ServerResponse,
> = Middleware<RequestInternal, ResponseInternal> &

@@ -227,2 +204,3 @@ AdditionalMethods<RequestInternal, ResponseInternal>;

type IncomingMessage = import("http").IncomingMessage;
type ServerResponse = import("http").ServerResponse & ExtendedServerResponse;
type NextFunction = (err?: any) => void;

@@ -240,3 +218,3 @@ type WatchOptions = NonNullable<Configuration["watchOptions"]>;

type Callback = (
stats?: import("webpack").Stats | import("webpack").MultiStats | undefined
stats?: import("webpack").Stats | import("webpack").MultiStats | undefined,
) => any;

@@ -249,3 +227,3 @@ type ResponseData = {

RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
ResponseInternal extends ServerResponse,
> = (

@@ -255,7 +233,7 @@ req: RequestInternal,

data: string | Buffer | ReadStream,
byteLength: number
byteLength: number,
) => ResponseData;
type Context<
RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
ResponseInternal extends ServerResponse,
> = {

@@ -273,3 +251,3 @@ state: boolean;

RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
ResponseInternal extends ServerResponse,
> =

@@ -284,12 +262,34 @@ | Record<string, string | number>

res: ResponseInternal,
context: Context<RequestInternal, ResponseInternal>
context: Context<RequestInternal, ResponseInternal>,
) => void | undefined | Record<string, string | number>)
| undefined;
type Options<
RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse,
> = {
mimeTypes?:
| {
[key: string]: string;
}
| undefined;
mimeTypeDefault?: string | undefined;
writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined;
methods?: string[] | undefined;
headers?: Headers<RequestInternal, ResponseInternal>;
publicPath?: NonNullable<Configuration["output"]>["publicPath"];
stats?: Configuration["stats"];
serverSideRender?: boolean | undefined;
outputFileSystem?: OutputFileSystem | undefined;
index?: string | boolean | undefined;
modifyResponseData?:
| ModifyResponseData<RequestInternal, ResponseInternal>
| undefined;
};
type Middleware<
RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
ResponseInternal extends ServerResponse,
> = (
req: RequestInternal,
res: ResponseInternal,
next: NextFunction
next: NextFunction,
) => Promise<void>;

@@ -302,3 +302,3 @@ type GetFilenameFromUrl = (url: string) => string | undefined;

RequestInternal extends import("http").IncomingMessage,
ResponseInternal extends ServerResponse
ResponseInternal extends ServerResponse,
> = {

@@ -305,0 +305,0 @@ getFilenameFromUrl: GetFilenameFromUrl;

@@ -11,5 +11,5 @@ /// <reference types="node" />

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("./index.js").ServerResponse
Response_1 extends import("./index.js").ServerResponse,
>(
context: import("./index.js").Context<Request_1, Response_1>
context: import("./index.js").Context<Request_1, Response_1>,
): import("./index.js").Middleware<Request_1, Response_1>;

@@ -16,0 +16,0 @@ declare namespace wrapper {

@@ -32,3 +32,3 @@ /// <reference types="node" />

export function getHeaderNames<
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(res: Response_1): string[];

@@ -42,3 +42,3 @@ /**

export function getHeaderFromRequest<
Request_1 extends import("http").IncomingMessage
Request_1 extends import("http").IncomingMessage,
>(req: Request_1, name: string): string | undefined;

@@ -52,3 +52,3 @@ /**

export function getHeaderFromResponse<
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(res: Response_1, name: string): number | string | string[] | undefined;

@@ -63,3 +63,3 @@ /**

export function setHeaderForResponse<
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(res: Response_1, name: string, value: number | string | string[]): void;

@@ -72,3 +72,3 @@ /**

export function setStatusCode<
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(res: Response_1, code: number): void;

@@ -85,3 +85,3 @@ /**

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(

@@ -91,3 +91,3 @@ req: Request_1,

bufferOtStream: string | Buffer | import("fs").ReadStream,
byteLength: number
byteLength: number,
): void;

@@ -12,6 +12,6 @@ /// <reference types="node" />

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(
context: import("../index.js").Context<Request_1, Response_1>,
url: string
url: string,
): string | undefined;

@@ -18,0 +18,0 @@ declare namespace getFilenameFromUrl {

@@ -15,5 +15,5 @@ /// <reference types="node" />

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(
context: import("../index.js").Context<Request_1, Response_1>
context: import("../index.js").Context<Request_1, Response_1>,
): {

@@ -20,0 +20,0 @@ outputPath: string;

@@ -15,7 +15,7 @@ /// <reference types="node" />

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(
context: import("../index.js").Context<Request_1, Response_1>,
callback: (...args: any[]) => any,
req?: Request_1 | undefined
req?: Request_1 | undefined,
): void;

@@ -22,0 +22,0 @@ declare namespace ready {

@@ -20,3 +20,3 @@ /// <reference types="node" />

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(context: import("../index.js").Context<Request_1, Response_1>): void;

@@ -23,0 +23,0 @@ declare namespace setupHooks {

@@ -13,3 +13,3 @@ /// <reference types="node" />

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(context: import("../index.js").Context<Request_1, Response_1>): void;

@@ -16,0 +16,0 @@ declare namespace setupOutputFileSystem {

@@ -15,3 +15,3 @@ /// <reference types="node" />

Request_1 extends import("http").IncomingMessage,
Response_1 extends import("../index.js").ServerResponse
Response_1 extends import("../index.js").ServerResponse,
>(context: import("../index.js").Context<Request_1, Response_1>): void;

@@ -18,0 +18,0 @@ declare namespace setupWriteToDisk {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc