🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More
Socket
Book a DemoSign in
Socket

@rspack/core

Package Overview
Dependencies
Maintainers
2
Versions
1210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rspack/core - npm Package Compare versions

Comparing version
2.0.0
to
2.0.1
+254
-391
compiled/http-proxy-middleware/index.d.ts

@@ -1,249 +0,134 @@

/// <reference types="node" />
import * as http from 'http';
import events from 'events';
import * as net from 'net';
import stream from 'stream';
import * as url from 'url';
import * as http from 'node:http';
import http__default, { ServerResponse, IncomingMessage } from 'node:http';
import * as net from 'node:net';
import net__default, { Socket } from 'node:net';
import http2, { Http2ServerResponse, Http2ServerRequest } from 'node:http2';
import { EventEmitter } from 'node:events';
import * as stream from 'node:stream';
import { HttpBindings } from '@hono/node-server';
import { MiddlewareHandler } from 'hono';
interface ProxyTargetDetailed {
host: string;
port: number;
protocol?: string | undefined;
hostname?: string | undefined;
socketPath?: string | undefined;
key?: string | undefined;
passphrase?: string | undefined;
pfx?: Buffer | string | undefined;
cert?: string | undefined;
ca?: string | undefined;
ciphers?: string | undefined;
secureProtocol?: string | undefined;
host?: string;
port?: number | string;
protocol?: string;
hostname?: string;
socketPath?: string;
key?: string;
passphrase?: string;
pfx?: Buffer | string;
cert?: string;
ca?: string;
ciphers?: string;
secureProtocol?: string;
}
declare class Server<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>
extends events.EventEmitter
{
/**
* Creates the proxy server with specified options.
* @param options - Config object passed to the proxy
*/
constructor(options?: Server.ServerOptions);
/**
* Used for proxying regular HTTP(S) requests
* @param req - Client request.
* @param res - Client response.
* @param options - Additional options.
*/
web(
req: http.IncomingMessage,
res: http.ServerResponse,
options?: Server.ServerOptions,
callback?: Server.ErrorCallback,
): void;
/**
* Used for proxying WS(S) requests
* @param req - Client request.
* @param socket - Client socket.
* @param head - Client head.
* @param options - Additionnal options.
*/
ws(
req: http.IncomingMessage,
socket: any,
head: any,
options?: Server.ServerOptions,
callback?: Server.ErrorCallback,
): void;
/**
* A function that wraps the object in a webserver, for your convenience
* @param port - Port to listen on
* @param hostname - The hostname to listen on
*/
listen(port: number, hostname?: string): Server<TIncomingMessage, TServerResponse>;
/**
* A function that closes the inner webserver and stops listening on given port
*/
close(callback?: () => void): void;
/**
* Creates the proxy server with specified options.
* @param options Config object passed to the proxy
* @returns Proxy object with handlers for `ws` and `web` requests
*/
// tslint:disable:no-unnecessary-generics
static createProxyServer<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>(
options?: Server.ServerOptions,
): Server<TIncomingMessage, TServerResponse>;
/**
* Creates the proxy server with specified options.
* @param options Config object passed to the proxy
* @returns Proxy object with handlers for `ws` and `web` requests
*/
// tslint:disable:no-unnecessary-generics
static createServer<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>(
options?: Server.ServerOptions,
): Server<TIncomingMessage, TServerResponse>;
/**
* Creates the proxy server with specified options.
* @param options Config object passed to the proxy
* @returns Proxy object with handlers for `ws` and `web` requests
*/
// tslint:disable:no-unnecessary-generics
static createProxy<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>(
options?: Server.ServerOptions,
): Server<TIncomingMessage, TServerResponse>;
addListener(event: string, listener: () => void): this;
on(event: string, listener: () => void): this;
on(event: "error", listener: Server.ErrorCallback<Error, TIncomingMessage, TServerResponse>): this;
on(event: "start", listener: Server.StartCallback<TIncomingMessage, TServerResponse>): this;
on(
event: "proxyReq",
listener: Server.ProxyReqCallback<http.ClientRequest, TIncomingMessage, TServerResponse>,
): this;
on(event: "proxyRes", listener: Server.ProxyResCallback<TIncomingMessage, TServerResponse>): this;
on(event: "proxyReqWs", listener: Server.ProxyReqWsCallback<http.ClientRequest, TIncomingMessage>): this;
on(event: "econnreset", listener: Server.EconnresetCallback<Error, TIncomingMessage, TServerResponse>): this;
on(event: "end", listener: Server.EndCallback<TIncomingMessage, TServerResponse>): this;
on(event: "open", listener: Server.OpenCallback): this;
on(event: "close", listener: Server.CloseCallback<TIncomingMessage>): this;
once(event: string, listener: () => void): this;
once(event: "error", listener: Server.ErrorCallback<Error, TIncomingMessage, TServerResponse>): this;
once(event: "start", listener: Server.StartCallback<TIncomingMessage, TServerResponse>): this;
once(
event: "proxyReq",
listener: Server.ProxyReqCallback<http.ClientRequest, TIncomingMessage, TServerResponse>,
): this;
once(event: "proxyRes", listener: Server.ProxyResCallback<TIncomingMessage, TServerResponse>): this;
once(event: "proxyReqWs", listener: Server.ProxyReqWsCallback<http.ClientRequest, TIncomingMessage>): this;
once(event: "econnreset", listener: Server.EconnresetCallback<Error, TIncomingMessage, TServerResponse>): this;
once(event: "end", listener: Server.EndCallback<TIncomingMessage, TServerResponse>): this;
once(event: "open", listener: Server.OpenCallback): this;
once(event: "close", listener: Server.CloseCallback<TIncomingMessage>): this;
removeListener(event: string, listener: () => void): this;
removeAllListeners(event?: string): this;
getMaxListeners(): number;
setMaxListeners(n: number): this;
listeners(event: string): Array<() => void>;
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
type ProxyTarget = string | URL | ProxyTargetDetailed;
interface ProxyServerOptions {
/** URL string to be parsed. */
target?: ProxyTarget;
/** URL string to be parsed. */
forward?: ProxyTarget;
/** Object to be passed to http(s).request. */
agent?: any;
/** Enable HTTP/2 listener, default is `false` */
http2?: boolean;
/** Object to be passed to https.createServer()
* or http2.createSecureServer() if the `http2` option is enabled
*/
ssl?: any;
/** If you want to proxy websockets. */
ws?: boolean;
/** Adds x- forward headers. */
xfwd?: boolean;
/** Verify SSL certificate. */
secure?: boolean;
/** Explicitly specify if we are proxying to another proxy. */
toProxy?: boolean;
/** Specify whether you want to prepend the target's path to the proxy path. */
prependPath?: boolean;
/** Specify whether you want to ignore the proxy path of the incoming request. */
ignorePath?: boolean;
/** Local interface string to bind for outgoing connections. */
localAddress?: string;
/** Changes the origin of the host header to the target URL. */
changeOrigin?: boolean;
/** specify whether you want to keep letter case of response header key */
preserveHeaderKeyCase?: boolean;
/** Basic authentication i.e. 'user:password' to compute an Authorization header. */
auth?: string;
/** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
hostRewrite?: string;
/** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
autoRewrite?: boolean;
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
protocolRewrite?: string;
/** Rewrites domain of set-cookie headers. */
cookieDomainRewrite?: false | string | {
[oldDomain: string]: string;
};
/** Rewrites path of set-cookie headers. Default: false */
cookiePathRewrite?: false | string | {
[oldPath: string]: string;
};
/** Object with extra headers to be added to target requests. */
headers?: {
[header: string]: string;
};
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
proxyTimeout?: number;
/** Timeout (in milliseconds) for incoming requests */
timeout?: number;
/** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
selfHandleResponse?: boolean;
/** Follow HTTP redirects from target. `true` = max 5 hops; number = custom max. */
followRedirects?: boolean | number;
/** Buffer */
buffer?: stream.Stream;
}
declare namespace Server {
type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed;
type ProxyTargetUrl = string | Partial<url.Url>;
interface ServerOptions {
/** URL string to be parsed with the url module. */
target?: ProxyTarget | undefined;
/** URL string to be parsed with the url module. */
forward?: ProxyTargetUrl | undefined;
/** Object to be passed to http(s).request. */
agent?: any;
/** Object to be passed to https.createServer(). */
ssl?: any;
/** If you want to proxy websockets. */
ws?: boolean | undefined;
/** Adds x- forward headers. */
xfwd?: boolean | undefined;
/** Verify SSL certificate. */
secure?: boolean | undefined;
/** Explicitly specify if we are proxying to another proxy. */
toProxy?: boolean | undefined;
/** Specify whether you want to prepend the target's path to the proxy path. */
prependPath?: boolean | undefined;
/** Specify whether you want to ignore the proxy path of the incoming request. */
ignorePath?: boolean | undefined;
/** Local interface string to bind for outgoing connections. */
localAddress?: string | undefined;
/** Changes the origin of the host header to the target URL. */
changeOrigin?: boolean | undefined;
/** specify whether you want to keep letter case of response header key */
preserveHeaderKeyCase?: boolean | undefined;
/** Basic authentication i.e. 'user:password' to compute an Authorization header. */
auth?: string | undefined;
/** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
hostRewrite?: string | undefined;
/** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
autoRewrite?: boolean | undefined;
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
protocolRewrite?: string | undefined;
/** rewrites domain of set-cookie headers. */
cookieDomainRewrite?: false | string | { [oldDomain: string]: string } | undefined;
/** rewrites path of set-cookie headers. Default: false */
cookiePathRewrite?: false | string | { [oldPath: string]: string } | undefined;
/** object with extra headers to be added to target requests. */
headers?: { [header: string]: string } | undefined;
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
proxyTimeout?: number | undefined;
/** Timeout (in milliseconds) for incoming requests */
timeout?: number | undefined;
/** Specify whether you want to follow redirects. Default: false */
followRedirects?: boolean | undefined;
/** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
selfHandleResponse?: boolean | undefined;
/** Buffer */
buffer?: stream.Stream | undefined;
/** Explicitly set the method type of the ProxyReq */
method?: string | undefined;
}
type StartCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
req: TIncomingMessage,
res: TServerResponse,
target: ProxyTargetUrl,
) => void;
type ProxyReqCallback<
TClientRequest = http.ClientRequest,
TIncomingMessage = http.IncomingMessage,
TServerResponse = http.ServerResponse,
> = (proxyReq: TClientRequest, req: TIncomingMessage, res: TServerResponse, options: ServerOptions) => void;
type ProxyResCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
proxyRes: TIncomingMessage,
req: TIncomingMessage,
res: TServerResponse,
) => void;
type ProxyReqWsCallback<TClientRequest = http.ClientRequest, TIncomingMessage = http.IncomingMessage> = (
proxyReq: TClientRequest,
req: TIncomingMessage,
socket: net.Socket,
options: ServerOptions,
head: any,
) => void;
type EconnresetCallback<
TError = Error,
TIncomingMessage = http.IncomingMessage,
TServerResponse = http.ServerResponse,
> = (
err: TError,
req: TIncomingMessage,
res: TServerResponse,
target: ProxyTargetUrl,
) => void;
type EndCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
req: TIncomingMessage,
res: TServerResponse,
proxyRes: TIncomingMessage,
) => void;
type OpenCallback = (proxySocket: net.Socket) => void;
type CloseCallback<TIncomingMessage = http.IncomingMessage> = (
proxyRes: TIncomingMessage,
proxySocket: net.Socket,
proxyHead: any,
) => void;
type ErrorCallback<TError = Error, TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> =
(
err: TError,
req: TIncomingMessage,
res: TServerResponse | net.Socket,
target?: ProxyTargetUrl,
) => void;
type ResOfType<T extends "web" | "ws"> = T extends "ws" ? T extends "web" ? ServerResponse | Http2ServerResponse | Socket : Socket : T extends "web" ? ServerResponse | Http2ServerResponse : never;
type ProxyMiddleware<T extends ServerResponse | Http2ServerResponse | Socket> = (req: IncomingMessage | Http2ServerRequest, res: T, opts: ProxyServerOptions & {
target: URL | ProxyTargetDetailed;
forward: URL;
}, server: ProxyServer<IncomingMessage | Http2ServerRequest, ServerResponse | Http2ServerResponse>, head?: Buffer, callback?: (err: any, req: IncomingMessage | Http2ServerRequest, socket: T, url?: any) => void) => void | true;
interface ProxyServerEventMap<Req extends http__default.IncomingMessage | http2.Http2ServerRequest = http__default.IncomingMessage, Res extends http__default.ServerResponse | http2.Http2ServerResponse = http__default.ServerResponse> {
error: [err: Error, req?: Req, res?: Res | net__default.Socket, target?: URL | ProxyTarget];
start: [req: Req, res: Res, target: URL | ProxyTarget];
econnreset: [err: Error, req: Req, res: Res, target: URL | ProxyTarget];
proxyReq: [proxyReq: http__default.ClientRequest, req: Req, res: Res, options: ProxyServerOptions];
proxyReqWs: [proxyReq: http__default.ClientRequest, req: Req, socket: net__default.Socket, options: ProxyServerOptions, head: any];
proxyRes: [proxyRes: http__default.IncomingMessage, req: Req, res: Res];
end: [req: Req, res: Res, proxyRes: http__default.IncomingMessage];
open: [proxySocket: net__default.Socket];
/** @deprecated */
proxySocket: [proxySocket: net__default.Socket];
close: [proxyRes: Req, proxySocket: net__default.Socket, proxyHead: any];
}
declare class ProxyServer<Req extends http__default.IncomingMessage | http2.Http2ServerRequest = http__default.IncomingMessage, Res extends http__default.ServerResponse | http2.Http2ServerResponse = http__default.ServerResponse> extends EventEmitter<ProxyServerEventMap<Req, Res>> {
private _server?;
_webPasses: ProxyMiddleware<http__default.ServerResponse>[];
_wsPasses: ProxyMiddleware<net__default.Socket>[];
options: ProxyServerOptions;
web: (req: Req, res: Res, opts?: ProxyServerOptions, head?: any) => Promise<void>;
ws: (req: Req, socket: net__default.Socket, opts: ProxyServerOptions, head?: any) => Promise<void>;
/**
* Creates the proxy server with specified options.
* @param options - Config object passed to the proxy
*/
constructor(options?: ProxyServerOptions);
/**
* A function that wraps the object in a webserver, for your convenience
* @param port - Port to listen on
* @param hostname - The hostname to listen on
* @param listeningListener - A callback function that is called when the server starts listening
*/
listen(port: number, hostname?: string, listeningListener?: () => void): this;
/**
* A function that closes the inner webserver and stops listening on given port
*/
close(callback?: () => void): void;
before<Type extends "ws" | "web">(type: Type, passName: string, pass: ProxyMiddleware<ResOfType<Type>>): void;
after<Type extends "ws" | "web">(type: Type, passName: string, pass: ProxyMiddleware<ResOfType<Type>>): void;
/** @internal */
_getPasses<Type extends "ws" | "web">(type: Type): ProxyMiddleware<ResOfType<Type>>[];
}

@@ -256,23 +141,26 @@ /**

type NextFunction<T = (err?: any) => void> = T;
interface RequestHandler<TReq = http.IncomingMessage, TRes = http.ServerResponse, TNext = NextFunction> {
interface RequestHandler<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse, TNext = NextFunction> {
(req: TReq, res: TRes, next?: TNext): Promise<void>;
upgrade: (req: http.IncomingMessage, socket: net.Socket, head: Buffer) => void;
upgrade: (req: TReq, socket: net.Socket, head: Buffer) => void;
}
type Filter<TReq = http.IncomingMessage> = string | string[] | ((pathname: string, req: TReq) => boolean);
interface Plugin<TReq = http.IncomingMessage, TRes = http.ServerResponse> {
(proxyServer: Server<TReq, TRes>, options: Options<TReq, TRes>): void;
type Filter<TReq extends http.IncomingMessage = http.IncomingMessage> = string | string[] | ((pathname: string, req: TReq) => boolean);
interface Plugin<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> {
(proxyServer: ProxyServer<TReq, TRes>, options: Options<TReq, TRes>): void;
}
interface OnProxyEvent<TReq = http.IncomingMessage, TRes = http.ServerResponse> {
error?: Server.ErrorCallback<Error, TReq, TRes>;
proxyReq?: Server.ProxyReqCallback<http.ClientRequest, TReq, TRes>;
proxyReqWs?: Server.ProxyReqWsCallback<http.ClientRequest, TReq>;
proxyRes?: Server.ProxyResCallback<TReq, TRes>;
open?: Server.OpenCallback;
close?: Server.CloseCallback<TReq>;
start?: Server.StartCallback<TReq, TRes>;
end?: Server.EndCallback<TReq, TRes>;
econnreset?: Server.EconnresetCallback<Error, TReq, TRes>;
interface OnProxyEvent<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> {
error?: (err: Error, req: TReq, res: TRes | net.Socket, target?: string | Partial<URL>) => void;
proxyReq?: (proxyReq: http.ClientRequest, req: TReq, res: TRes, options: ProxyServerOptions) => void;
proxyReqWs?: (proxyReq: http.ClientRequest, req: TReq, socket: net.Socket, options: ProxyServerOptions, head: any) => void;
proxyRes?: (proxyRes: TReq, req: TReq, res: TRes) => void | Promise<void>;
open?: (proxySocket: net.Socket) => void;
close?: (proxyRes: TReq, proxySocket: net.Socket, proxyHead: any) => void;
start?: (req: TReq, res: TRes, target: string | Partial<URL>) => void;
end?: (req: TReq, res: TRes, proxyRes: TReq) => void;
econnreset?: (err: Error, req: TReq, res: TRes, target: string | Partial<URL>) => void;
}
type Logger = Pick<Console, 'info' | 'warn' | 'error'>;
interface Options<TReq = http.IncomingMessage, TRes = http.ServerResponse> extends Server.ServerOptions {
type PathRewriteConfig<TReq extends http.IncomingMessage = http.IncomingMessage> = {
[regexp: string]: string;
} | ((path: string, req: TReq) => string | undefined) | ((path: string, req: TReq) => Promise<string>);
interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> extends ProxyServerOptions {
/**

@@ -298,5 +186,3 @@ * Narrow down requests to proxy or not.

*/
pathRewrite?: {
[regexp: string]: string;
} | ((path: string, req: TReq) => string | undefined) | ((path: string, req: TReq) => Promise<string>);
pathRewrite?: PathRewriteConfig<TReq>;
/**

@@ -356,5 +242,3 @@ * Access the internal http-proxy server instance to customize behavior

*/
router?: {
[hostOrPath: string]: Server.ServerOptions['target'];
} | ((req: TReq) => Server.ServerOptions['target']) | ((req: TReq) => Promise<Server.ServerOptions['target']>);
router?: Record<string, ProxyServerOptions['target']> | ((req: TReq) => ProxyServerOptions['target']) | ((req: TReq) => Promise<ProxyServerOptions['target']>);
/**

@@ -371,9 +255,108 @@ * Log information from http-proxy-middleware

*/
logger?: Logger | any;
logger?: Logger;
}
declare function createProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse, TNext = NextFunction>(options: Options<TReq, TRes>): RequestHandler<TReq, TRes, TNext>;
/**
* Create proxy middleware for Express-like servers. ([list of servers with examples](https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/servers.md))
*
* @example Basic proxy to a single target.
* ```ts
* import { createProxyMiddleware } from 'http-proxy-middleware';
*
* const proxy = createProxyMiddleware({
* target: 'http://www.example.org',
* changeOrigin: true,
* });
* ```
*
* @example Proxy only matching paths and rewrite the forwarded path.
* ```ts
* import { createProxyMiddleware } from 'http-proxy-middleware';
*
* const proxy = createProxyMiddleware({
* target: 'http://localhost:3000',
* pathFilter: '/api',
* pathRewrite: {
* '^/api/': '/',
* },
* });
* ```
*
* @example Native path rewrite by mounting at a route (alternative to `pathRewrite`).
* ```ts
* import express from 'express';
* import { createProxyMiddleware } from 'http-proxy-middleware';
*
* const app = express();
* app.use(
* '/users',
* createProxyMiddleware({
* target: 'http://jsonplaceholder.typicode.com/users',
* changeOrigin: true,
* }),
* );
* ```
*
* @example Use framework-specific request/response types (Express).
* ```ts
* import type { Request, Response } from 'express';
* import { createProxyMiddleware } from 'http-proxy-middleware';
*
* const proxy = createProxyMiddleware<Request, Response>({
* target: 'http://www.example.org/api',
* changeOrigin: true,
* });
* ```
*
* @example Intercept and modify a proxied response body.
* ```ts
* import { createProxyMiddleware, responseInterceptor } from 'http-proxy-middleware';
*
* const proxy = createProxyMiddleware({
* target: 'http://www.example.org',
* selfHandleResponse: true,
* on: {
* proxyRes: responseInterceptor(async (responseBuffer) => {
* const response = responseBuffer.toString('utf8');
* return response.replace('Hello', 'Goodbye');
* }),
* },
* });
* ```
*
* @see https://github.com/chimurai/http-proxy-middleware/
* @see https://github.com/chimurai/http-proxy-middleware/#basic-usage
* @see https://github.com/chimurai/http-proxy-middleware/#intercept-and-manipulate-responses
* @see https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/servers.md
* @see https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathFilter.md
* @see https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathRewrite.md
* @see https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/response-interceptor.md
*/
declare function createProxyMiddleware<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse, TNext = NextFunction>(options: Options<TReq, TRes>): RequestHandler<TReq, TRes, TNext>;
type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buffer: Buffer, proxyRes: TReq, req: TReq, res: TRes) => Promise<Buffer | string>;
/**
* Creates a Hono middleware that proxies requests using http-proxy-middleware.
*
* `@remarks`
* This middleware requires Hono to be running on Node.js via `@hono/node-server`.
* It uses `c.env.incoming` and `c.env.outgoing` which are only available with `HttpBindings`.
*
* `@experimental` This API is experimental and may change without a major version bump.
*
* `@example`
* ```ts
* import { serve } from '@hono/node-server';
* import { Hono } from 'hono';
* import { createHonoProxyMiddleware } from 'http-proxy-middleware';
*
* const app = new Hono();
* app.use('/api', createHonoProxyMiddleware({ target: 'http://example.com', changeOrigin: true }));
* serve(app);
*/
declare function createHonoProxyMiddleware(options: Options): MiddlewareHandler<{
Bindings: HttpBindings;
}>;
type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buffer: Buffer, proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<Buffer | string>;
/**
* Intercept responses from upstream.

@@ -385,3 +368,3 @@ * Automatically decompress (deflate, gzip, brotli).

*/
declare function responseInterceptor<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(interceptor: Interceptor<TReq, TRes>): (proxyRes: TReq, req: TReq, res: TRes) => Promise<void>;
declare function responseInterceptor<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(interceptor: Interceptor<TReq, TRes>): (proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<void>;

@@ -428,123 +411,3 @@ type BodyParserLikeRequest = http.IncomingMessage & {

/**
* @deprecated
*
* Will be removed in a future version.
*/
interface LegacyOptions<TReq = http.IncomingMessage, TRes = http.ServerResponse> extends Options<TReq, TRes> {
/**
* @deprecated
* Use `on.error` instead.
*
* @example
* ```js
* {
* on: {
* error: () => {}
* }
* ```
*/
onError?: (...args: any[]) => void;
/**
* @deprecated
* Use `on.proxyRes` instead.
*
* @example
* ```js
* {
* on: {
* proxyRes: () => {}
* }
* ```
*/
onProxyRes?: (...args: any[]) => void;
/**
* @deprecated
* Use `on.proxyReq` instead.
*
* @example
* ```js
* {
* on: {
* proxyReq: () => {}
* }
* ```
*/
onProxyReq?: (...args: any[]) => void;
/**
* @deprecated
* Use `on.proxyReqWs` instead.
*
* @example
* ```js
* {
* on: {
* proxyReqWs: () => {}
* }
* ```
*/
onProxyReqWs?: (...args: any[]) => void;
/**
* @deprecated
* Use `on.open` instead.
*
* @example
* ```js
* {
* on: {
* open: () => {}
* }
* ```
*/
onOpen?: (...args: any[]) => void;
/**
* @deprecated
* Use `on.close` instead.
*
* @example
* ```js
* {
* on: {
* close: () => {}
* }
* ```
*/
onClose?: (...args: any[]) => void;
/**
* @deprecated
* Use `logger` instead.
*
* @example
* ```js
* {
* logger: console
* }
* ```
*/
logProvider?: any;
/**
* @deprecated
* Use `logger` instead.
*
* @example
* ```js
* {
* logger: console
* }
* ```
*/
logLevel?: any;
}
/**
* @deprecated
* This function is deprecated and will be removed in a future version.
*
* Use {@link createProxyMiddleware} instead.
*/
declare function legacyCreateProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse>(shortHand: string): RequestHandler<TReq, TRes>;
declare function legacyCreateProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse>(legacyOptions: LegacyOptions<TReq, TRes>): RequestHandler<TReq, TRes>;
declare function legacyCreateProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse>(legacyContext: Filter<TReq>, legacyOptions: LegacyOptions<TReq, TRes>): RequestHandler<TReq, TRes>;
export { createProxyMiddleware, debugProxyErrorsPlugin, errorResponsePlugin, fixRequestBody, legacyCreateProxyMiddleware, loggerPlugin, proxyEventsPlugin, responseInterceptor };
export type { Filter, LegacyOptions, Options, Plugin, RequestHandler };
export { createHonoProxyMiddleware, createProxyMiddleware, debugProxyErrorsPlugin, errorResponsePlugin, fixRequestBody, loggerPlugin, proxyEventsPlugin, responseInterceptor };
export type { Filter, Options, Plugin, RequestHandler };

@@ -1,1 +0,1 @@

{"name":"http-proxy-middleware","author":"Steven Chim","version":"3.0.5","license":"MIT","types":"index.d.ts","type":"commonjs"}
{"name":"http-proxy-middleware","author":"Steven Chim","version":"4.0.0-beta.5","license":"MIT","types":"index.d.ts","type":"module"}
{
"name": "@rspack/core",
"version": "2.0.0",
"version": "2.0.1",
"webpackVersion": "5.75.0",

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

"@rsbuild/plugin-node-polyfill": "^1.4.4",
"@rslib/core": "0.21.2",
"@rslib/core": "0.21.3",
"@rspack/lite-tapable": "1.1.0",

@@ -52,4 +52,4 @@ "@swc/types": "0.1.26",

"connect-next": "^4.0.1",
"enhanced-resolve": "5.20.1",
"http-proxy-middleware": "^3.0.5",
"enhanced-resolve": "5.21.0",
"http-proxy-middleware": "^4.0.0-beta.5",
"memfs": "4.53.0",

@@ -64,3 +64,3 @@ "open": "^11.0.0",

"dependencies": {
"@rspack/binding": "2.0.0"
"@rspack/binding": "2.0.1"
},

@@ -67,0 +67,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display