@umijs/bundler-utils 4.0.16 → 4.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/http-proxy-middleware/LICENSE +22 -0
- package/compiled/http-proxy-middleware/dist/index.d.ts +4 -0
- package/compiled/http-proxy-middleware/dist/types.d.ts +54 -0
- package/compiled/http-proxy-middleware/http-proxy/index.d.ts +233 -0
- package/compiled/http-proxy-middleware/index.js +66 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/proxy.d.ts +5 -0
- package/dist/proxy.js +76 -0
- package/dist/types.d.ts +8 -0
- package/package.json +4 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Steven Chim
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on definition by DefinitelyTyped:
|
|
3
|
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6f529c6c67a447190f86bfbf894d1061e41e07b7/types/http-proxy-middleware/index.d.ts
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="node" />
|
|
6
|
+
import type * as express from '../../express';
|
|
7
|
+
import type * as http from 'http';
|
|
8
|
+
import type * as httpProxy from '../http-proxy';
|
|
9
|
+
import type * as net from 'net';
|
|
10
|
+
import type * as url from 'url';
|
|
11
|
+
export interface Request extends express.Request {
|
|
12
|
+
}
|
|
13
|
+
export interface Response extends express.Response {
|
|
14
|
+
}
|
|
15
|
+
export interface RequestHandler extends express.RequestHandler {
|
|
16
|
+
upgrade?: (req: Request, socket: net.Socket, head: any) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare type Filter = string | string[] | ((pathname: string, req: Request) => boolean);
|
|
19
|
+
export interface Options extends httpProxy.ServerOptions {
|
|
20
|
+
pathRewrite?: {
|
|
21
|
+
[regexp: string]: string;
|
|
22
|
+
} | ((path: string, req: Request) => string) | ((path: string, req: Request) => Promise<string>);
|
|
23
|
+
router?: {
|
|
24
|
+
[hostOrPath: string]: httpProxy.ServerOptions['target'];
|
|
25
|
+
} | ((req: Request) => httpProxy.ServerOptions['target']) | ((req: Request) => Promise<httpProxy.ServerOptions['target']>);
|
|
26
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
27
|
+
logProvider?: LogProviderCallback;
|
|
28
|
+
onError?: OnErrorCallback;
|
|
29
|
+
onProxyRes?: OnProxyResCallback;
|
|
30
|
+
onProxyReq?: OnProxyReqCallback;
|
|
31
|
+
onProxyReqWs?: OnProxyReqWsCallback;
|
|
32
|
+
onOpen?: OnOpenCallback;
|
|
33
|
+
onClose?: OnCloseCallback;
|
|
34
|
+
}
|
|
35
|
+
interface LogProvider {
|
|
36
|
+
log: Logger;
|
|
37
|
+
debug?: Logger;
|
|
38
|
+
info?: Logger;
|
|
39
|
+
warn?: Logger;
|
|
40
|
+
error?: Logger;
|
|
41
|
+
}
|
|
42
|
+
declare type Logger = (...args: any[]) => void;
|
|
43
|
+
export declare type LogProviderCallback = (provider: LogProvider) => LogProvider;
|
|
44
|
+
/**
|
|
45
|
+
* Use types based on the events listeners from http-proxy
|
|
46
|
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/51504fd999031b7f025220fab279f1b2155cbaff/types/http-proxy/index.d.ts
|
|
47
|
+
*/
|
|
48
|
+
export declare type OnErrorCallback = (err: Error, req: Request, res: Response, target?: string | Partial<url.Url>) => void;
|
|
49
|
+
export declare type OnProxyResCallback = (proxyRes: http.IncomingMessage, req: Request, res: Response) => void;
|
|
50
|
+
export declare type OnProxyReqCallback = (proxyReq: http.ClientRequest, req: Request, res: Response, options: httpProxy.ServerOptions) => void;
|
|
51
|
+
export declare type OnProxyReqWsCallback = (proxyReq: http.ClientRequest, req: Request, socket: net.Socket, options: httpProxy.ServerOptions, head: any) => void;
|
|
52
|
+
export declare type OnCloseCallback = (proxyRes: Response, proxySocket: net.Socket, proxyHead: any) => void;
|
|
53
|
+
export declare type OnOpenCallback = (proxySocket: net.Socket) => void;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// Type definitions for node-http-proxy 1.17
|
|
2
|
+
// Project: https://github.com/nodejitsu/node-http-proxy
|
|
3
|
+
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
|
4
|
+
// Florian Oellerich <https://github.com/Raigen>
|
|
5
|
+
// Daniel Schmidt <https://github.com/DanielMSchmidt>
|
|
6
|
+
// Jordan Abreu <https://github.com/jabreu610>
|
|
7
|
+
// Samuel Bodin <https://github.com/bodinsamuel>
|
|
8
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
9
|
+
// TypeScript Version: 2.1
|
|
10
|
+
|
|
11
|
+
/// <reference types="node" />
|
|
12
|
+
|
|
13
|
+
import * as net from 'net';
|
|
14
|
+
import * as http from 'http';
|
|
15
|
+
import * as https from 'https';
|
|
16
|
+
import * as events from 'events';
|
|
17
|
+
import * as url from 'url';
|
|
18
|
+
import * as stream from 'stream';
|
|
19
|
+
|
|
20
|
+
interface ProxyTargetDetailed {
|
|
21
|
+
host: string;
|
|
22
|
+
port: number;
|
|
23
|
+
protocol?: string | undefined;
|
|
24
|
+
hostname?: string | undefined;
|
|
25
|
+
socketPath?: string | undefined;
|
|
26
|
+
key?: string | undefined;
|
|
27
|
+
passphrase?: string | undefined;
|
|
28
|
+
pfx?: Buffer | string | undefined;
|
|
29
|
+
cert?: string | undefined;
|
|
30
|
+
ca?: string | undefined;
|
|
31
|
+
ciphers?: string | undefined;
|
|
32
|
+
secureProtocol?: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class Server extends events.EventEmitter {
|
|
36
|
+
/**
|
|
37
|
+
* Creates the proxy server with specified options.
|
|
38
|
+
* @param options - Config object passed to the proxy
|
|
39
|
+
*/
|
|
40
|
+
constructor(options?: Server.ServerOptions);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Used for proxying regular HTTP(S) requests
|
|
44
|
+
* @param req - Client request.
|
|
45
|
+
* @param res - Client response.
|
|
46
|
+
* @param options - Additional options.
|
|
47
|
+
*/
|
|
48
|
+
web(
|
|
49
|
+
req: http.IncomingMessage,
|
|
50
|
+
res: http.ServerResponse,
|
|
51
|
+
options?: Server.ServerOptions,
|
|
52
|
+
callback?: Server.ErrorCallback,
|
|
53
|
+
): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Used for proxying regular HTTP(S) requests
|
|
57
|
+
* @param req - Client request.
|
|
58
|
+
* @param socket - Client socket.
|
|
59
|
+
* @param head - Client head.
|
|
60
|
+
* @param options - Additionnal options.
|
|
61
|
+
*/
|
|
62
|
+
ws(
|
|
63
|
+
req: http.IncomingMessage,
|
|
64
|
+
socket: any,
|
|
65
|
+
head: any,
|
|
66
|
+
options?: Server.ServerOptions,
|
|
67
|
+
callback?: Server.ErrorCallback,
|
|
68
|
+
): void;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A function that wraps the object in a webserver, for your convenience
|
|
72
|
+
* @param port - Port to listen on
|
|
73
|
+
*/
|
|
74
|
+
listen(port: number): Server;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A function that closes the inner webserver and stops listening on given port
|
|
78
|
+
*/
|
|
79
|
+
close(callback?: () => void): void;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Creates the proxy server with specified options.
|
|
83
|
+
* @param options Config object passed to the proxy
|
|
84
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
85
|
+
*/
|
|
86
|
+
static createProxyServer(options?: Server.ServerOptions): Server;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Creates the proxy server with specified options.
|
|
90
|
+
* @param options Config object passed to the proxy
|
|
91
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
92
|
+
*/
|
|
93
|
+
static createServer(options?: Server.ServerOptions): Server;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Creates the proxy server with specified options.
|
|
97
|
+
* @param options Config object passed to the proxy
|
|
98
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
99
|
+
*/
|
|
100
|
+
static createProxy(options?: Server.ServerOptions): Server;
|
|
101
|
+
|
|
102
|
+
addListener(event: string, listener: () => void): this;
|
|
103
|
+
on(event: string, listener: () => void): this;
|
|
104
|
+
on(event: "error", listener: Server.ErrorCallback): this;
|
|
105
|
+
on(event: "start", listener: Server.StartCallback): this;
|
|
106
|
+
on(event: "proxyReq", listener: Server.ProxyReqCallback): this;
|
|
107
|
+
on(event: "proxyRes", listener: Server.ProxyResCallback): this;
|
|
108
|
+
on(event: "proxyReqWs", listener: Server.ProxyReqWsCallback): this;
|
|
109
|
+
on(event: "econnreset", listener: Server.EconnresetCallback): this;
|
|
110
|
+
on(event: "end", listener: Server.EndCallback): this;
|
|
111
|
+
on(event: "open", listener: Server.OpenCallback): this;
|
|
112
|
+
on(event: "close", listener: Server.CloseCallback): this;
|
|
113
|
+
|
|
114
|
+
once(event: string, listener: () => void): this;
|
|
115
|
+
once(event: "error", listener: Server.ErrorCallback): this;
|
|
116
|
+
once(event: "start", listener: Server.StartCallback): this;
|
|
117
|
+
once(event: "proxyReq", listener: Server.ProxyReqCallback): this;
|
|
118
|
+
once(event: "proxyRes", listener: Server.ProxyResCallback): this;
|
|
119
|
+
once(event: "proxyReqWs", listener: Server.ProxyReqWsCallback): this;
|
|
120
|
+
once(event: "econnreset", listener: Server.EconnresetCallback): this;
|
|
121
|
+
once(event: "end", listener: Server.EndCallback): this;
|
|
122
|
+
once(event: "open", listener: Server.OpenCallback): this;
|
|
123
|
+
once(event: "close", listener: Server.CloseCallback): this;
|
|
124
|
+
removeListener(event: string, listener: () => void): this;
|
|
125
|
+
removeAllListeners(event?: string): this;
|
|
126
|
+
getMaxListeners(): number;
|
|
127
|
+
setMaxListeners(n: number): this;
|
|
128
|
+
listeners(event: string): Array<() => void>;
|
|
129
|
+
emit(event: string, ...args: any[]): boolean;
|
|
130
|
+
listenerCount(type: string): number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
declare namespace Server {
|
|
134
|
+
type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed;
|
|
135
|
+
type ProxyTargetUrl = string | Partial<url.Url>;
|
|
136
|
+
|
|
137
|
+
interface ServerOptions {
|
|
138
|
+
/** URL string to be parsed with the url module. */
|
|
139
|
+
target?: ProxyTarget | undefined;
|
|
140
|
+
/** URL string to be parsed with the url module. */
|
|
141
|
+
forward?: ProxyTargetUrl | undefined;
|
|
142
|
+
/** Object to be passed to http(s).request. */
|
|
143
|
+
agent?: any;
|
|
144
|
+
/** Object to be passed to https.createServer(). */
|
|
145
|
+
ssl?: any;
|
|
146
|
+
/** If you want to proxy websockets. */
|
|
147
|
+
ws?: boolean | undefined;
|
|
148
|
+
/** Adds x- forward headers. */
|
|
149
|
+
xfwd?: boolean | undefined;
|
|
150
|
+
/** Verify SSL certificate. */
|
|
151
|
+
secure?: boolean | undefined;
|
|
152
|
+
/** Explicitly specify if we are proxying to another proxy. */
|
|
153
|
+
toProxy?: boolean | undefined;
|
|
154
|
+
/** Specify whether you want to prepend the target's path to the proxy path. */
|
|
155
|
+
prependPath?: boolean | undefined;
|
|
156
|
+
/** Specify whether you want to ignore the proxy path of the incoming request. */
|
|
157
|
+
ignorePath?: boolean | undefined;
|
|
158
|
+
/** Local interface string to bind for outgoing connections. */
|
|
159
|
+
localAddress?: string | undefined;
|
|
160
|
+
/** Changes the origin of the host header to the target URL. */
|
|
161
|
+
changeOrigin?: boolean | undefined;
|
|
162
|
+
/** specify whether you want to keep letter case of response header key */
|
|
163
|
+
preserveHeaderKeyCase?: boolean | undefined;
|
|
164
|
+
/** Basic authentication i.e. 'user:password' to compute an Authorization header. */
|
|
165
|
+
auth?: string | undefined;
|
|
166
|
+
/** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
|
|
167
|
+
hostRewrite?: string | undefined;
|
|
168
|
+
/** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
|
|
169
|
+
autoRewrite?: boolean | undefined;
|
|
170
|
+
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
|
|
171
|
+
protocolRewrite?: string | undefined;
|
|
172
|
+
/** rewrites domain of set-cookie headers. */
|
|
173
|
+
cookieDomainRewrite?: false | string | { [oldDomain: string]: string } | undefined;
|
|
174
|
+
/** rewrites path of set-cookie headers. Default: false */
|
|
175
|
+
cookiePathRewrite?: false | string | { [oldPath: string]: string } | undefined;
|
|
176
|
+
/** object with extra headers to be added to target requests. */
|
|
177
|
+
headers?: { [header: string]: string } | undefined;
|
|
178
|
+
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
|
|
179
|
+
proxyTimeout?: number | undefined;
|
|
180
|
+
/** Timeout (in milliseconds) for incoming requests */
|
|
181
|
+
timeout?: number | undefined;
|
|
182
|
+
/** Specify whether you want to follow redirects. Default: false */
|
|
183
|
+
followRedirects?: boolean | undefined;
|
|
184
|
+
/** 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 */
|
|
185
|
+
selfHandleResponse?: boolean | undefined;
|
|
186
|
+
/** Buffer */
|
|
187
|
+
buffer?: stream.Stream | undefined;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type StartCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
191
|
+
req: TIncomingMessage,
|
|
192
|
+
res: TServerResponse,
|
|
193
|
+
target: ProxyTargetUrl,
|
|
194
|
+
) => void;
|
|
195
|
+
type ProxyReqCallback<
|
|
196
|
+
TClientRequest = http.ClientRequest,
|
|
197
|
+
TIncomingMessage = http.IncomingMessage,
|
|
198
|
+
TServerResponse = http.ServerResponse,
|
|
199
|
+
> = (proxyReq: TClientRequest, req: TIncomingMessage, res: TServerResponse, options: ServerOptions) => void;
|
|
200
|
+
type ProxyResCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
201
|
+
proxyRes: TIncomingMessage,
|
|
202
|
+
req: TIncomingMessage,
|
|
203
|
+
res: TServerResponse,
|
|
204
|
+
) => void;
|
|
205
|
+
type ProxyReqWsCallback<TClientRequest = http.ClientRequest, TIncomingMessage = http.IncomingMessage> = (
|
|
206
|
+
proxyReq: TClientRequest,
|
|
207
|
+
req: TIncomingMessage,
|
|
208
|
+
socket: net.Socket,
|
|
209
|
+
options: ServerOptions,
|
|
210
|
+
head: any,
|
|
211
|
+
) => void;
|
|
212
|
+
type EconnresetCallback<TError = Error, TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
213
|
+
err: TError,
|
|
214
|
+
req: TIncomingMessage,
|
|
215
|
+
res: TServerResponse,
|
|
216
|
+
target: ProxyTargetUrl,
|
|
217
|
+
) => void;
|
|
218
|
+
type EndCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
219
|
+
req: TIncomingMessage,
|
|
220
|
+
res: TServerResponse,
|
|
221
|
+
proxyRes: TIncomingMessage
|
|
222
|
+
) => void;
|
|
223
|
+
type OpenCallback = (proxySocket: net.Socket) => void;
|
|
224
|
+
type CloseCallback<TIncomingMessage = http.IncomingMessage> = (proxyRes: TIncomingMessage, proxySocket: net.Socket, proxyHead: any) => void;
|
|
225
|
+
type ErrorCallback<TError = Error, TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
226
|
+
err: TError,
|
|
227
|
+
req: TIncomingMessage,
|
|
228
|
+
res: TServerResponse | net.Socket,
|
|
229
|
+
target?: ProxyTargetUrl,
|
|
230
|
+
) => void;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export = Server;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
(function(){var e={1570:function(e,t,r){"use strict";const n=r(3625);const o=r(4666);const s=r(6183);const i=r(2467);const braces=(e,t={})=>{let r=[];if(Array.isArray(e)){for(let n of e){let e=braces.create(n,t);if(Array.isArray(e)){r.push(...e)}else{r.push(e)}}}else{r=[].concat(braces.create(e,t))}if(t&&t.expand===true&&t.nodupes===true){r=[...new Set(r)]}return r};braces.parse=(e,t={})=>i(e,t);braces.stringify=(e,t={})=>{if(typeof e==="string"){return n(braces.parse(e,t),t)}return n(e,t)};braces.compile=(e,t={})=>{if(typeof e==="string"){e=braces.parse(e,t)}return o(e,t)};braces.expand=(e,t={})=>{if(typeof e==="string"){e=braces.parse(e,t)}let r=s(e,t);if(t.noempty===true){r=r.filter(Boolean)}if(t.nodupes===true){r=[...new Set(r)]}return r};braces.create=(e,t={})=>{if(e===""||e.length<3){return[e]}return t.expand!==true?braces.compile(e,t):braces.expand(e,t)};e.exports=braces},4666:function(e,t,r){"use strict";const n=r(442);const o=r(2456);const compile=(e,t={})=>{let walk=(e,r={})=>{let s=o.isInvalidBrace(r);let i=e.invalid===true&&t.escapeInvalid===true;let u=s===true||i===true;let a=t.escapeInvalid===true?"\\":"";let c="";if(e.isOpen===true){return a+e.value}if(e.isClose===true){return a+e.value}if(e.type==="open"){return u?a+e.value:"("}if(e.type==="close"){return u?a+e.value:")"}if(e.type==="comma"){return e.prev.type==="comma"?"":u?e.value:"|"}if(e.value){return e.value}if(e.nodes&&e.ranges>0){let r=o.reduce(e.nodes);let s=n(...r,{...t,wrap:false,toRegex:true});if(s.length!==0){return r.length>1&&s.length>1?`(${s})`:s}}if(e.nodes){for(let t of e.nodes){c+=walk(t,e)}}return c};return walk(e)};e.exports=compile},487:function(e){"use strict";e.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"}},6183:function(e,t,r){"use strict";const n=r(442);const o=r(3625);const s=r(2456);const append=(e="",t="",r=false)=>{let n=[];e=[].concat(e);t=[].concat(t);if(!t.length)return e;if(!e.length){return r?s.flatten(t).map((e=>`{${e}}`)):t}for(let o of e){if(Array.isArray(o)){for(let e of o){n.push(append(e,t,r))}}else{for(let e of t){if(r===true&&typeof e==="string")e=`{${e}}`;n.push(Array.isArray(e)?append(o,e,r):o+e)}}}return s.flatten(n)};const expand=(e,t={})=>{let r=t.rangeLimit===void 0?1e3:t.rangeLimit;let walk=(e,i={})=>{e.queue=[];let u=i;let a=i.queue;while(u.type!=="brace"&&u.type!=="root"&&u.parent){u=u.parent;a=u.queue}if(e.invalid||e.dollar){a.push(append(a.pop(),o(e,t)));return}if(e.type==="brace"&&e.invalid!==true&&e.nodes.length===2){a.push(append(a.pop(),["{}"]));return}if(e.nodes&&e.ranges>0){let i=s.reduce(e.nodes);if(s.exceedsLimit(...i,t.step,r)){throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.")}let u=n(...i,t);if(u.length===0){u=o(e,t)}a.push(append(a.pop(),u));e.nodes=[];return}let c=s.encloseBrace(e);let l=e.queue;let f=e;while(f.type!=="brace"&&f.type!=="root"&&f.parent){f=f.parent;l=f.queue}for(let t=0;t<e.nodes.length;t++){let r=e.nodes[t];if(r.type==="comma"&&e.type==="brace"){if(t===1)l.push("");l.push("");continue}if(r.type==="close"){a.push(append(a.pop(),l,c));continue}if(r.value&&r.type!=="open"){l.push(append(l.pop(),r.value));continue}if(r.nodes){walk(r,e)}}return l};return s.flatten(walk(e))};e.exports=expand},2467:function(e,t,r){"use strict";const n=r(3625);const{MAX_LENGTH:o,CHAR_BACKSLASH:s,CHAR_BACKTICK:i,CHAR_COMMA:u,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:c,CHAR_RIGHT_PARENTHESES:l,CHAR_LEFT_CURLY_BRACE:f,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:h,CHAR_RIGHT_SQUARE_BRACKET:d,CHAR_DOUBLE_QUOTE:g,CHAR_SINGLE_QUOTE:R,CHAR_NO_BREAK_SPACE:y,CHAR_ZERO_WIDTH_NOBREAK_SPACE:_}=r(487);const parse=(e,t={})=>{if(typeof e!=="string"){throw new TypeError("Expected a string")}let r=t||{};let v=typeof r.maxLength==="number"?Math.min(o,r.maxLength):o;if(e.length>v){throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${v})`)}let E={type:"root",input:e,nodes:[]};let x=[E];let A=E;let m=E;let b=0;let w=e.length;let C=0;let S=0;let H;let O={};const advance=()=>e[C++];const push=e=>{if(e.type==="text"&&m.type==="dot"){m.type="text"}if(m&&m.type==="text"&&e.type==="text"){m.value+=e.value;return}A.nodes.push(e);e.parent=A;e.prev=m;m=e;return e};push({type:"bos"});while(C<w){A=x[x.length-1];H=advance();if(H===_||H===y){continue}if(H===s){push({type:"text",value:(t.keepEscaping?H:"")+advance()});continue}if(H===d){push({type:"text",value:"\\"+H});continue}if(H===h){b++;let e=true;let t;while(C<w&&(t=advance())){H+=t;if(t===h){b++;continue}if(t===s){H+=advance();continue}if(t===d){b--;if(b===0){break}}}push({type:"text",value:H});continue}if(H===c){A=push({type:"paren",nodes:[]});x.push(A);push({type:"text",value:H});continue}if(H===l){if(A.type!=="paren"){push({type:"text",value:H});continue}A=x.pop();push({type:"text",value:H});A=x[x.length-1];continue}if(H===g||H===R||H===i){let e=H;let r;if(t.keepQuotes!==true){H=""}while(C<w&&(r=advance())){if(r===s){H+=r+advance();continue}if(r===e){if(t.keepQuotes===true)H+=r;break}H+=r}push({type:"text",value:H});continue}if(H===f){S++;let e=m.value&&m.value.slice(-1)==="$"||A.dollar===true;let t={type:"brace",open:true,close:false,dollar:e,depth:S,commas:0,ranges:0,nodes:[]};A=push(t);x.push(A);push({type:"open",value:H});continue}if(H===p){if(A.type!=="brace"){push({type:"text",value:H});continue}let e="close";A=x.pop();A.close=true;push({type:e,value:H});S--;A=x[x.length-1];continue}if(H===u&&S>0){if(A.ranges>0){A.ranges=0;let e=A.nodes.shift();A.nodes=[e,{type:"text",value:n(A)}]}push({type:"comma",value:H});A.commas++;continue}if(H===a&&S>0&&A.commas===0){let e=A.nodes;if(S===0||e.length===0){push({type:"text",value:H});continue}if(m.type==="dot"){A.range=[];m.value+=H;m.type="range";if(A.nodes.length!==3&&A.nodes.length!==5){A.invalid=true;A.ranges=0;m.type="text";continue}A.ranges++;A.args=[];continue}if(m.type==="range"){e.pop();let t=e[e.length-1];t.value+=m.value+H;m=t;A.ranges--;continue}push({type:"dot",value:H});continue}push({type:"text",value:H})}do{A=x.pop();if(A.type!=="root"){A.nodes.forEach((e=>{if(!e.nodes){if(e.type==="open")e.isOpen=true;if(e.type==="close")e.isClose=true;if(!e.nodes)e.type="text";e.invalid=true}}));let e=x[x.length-1];let t=e.nodes.indexOf(A);e.nodes.splice(t,1,...A.nodes)}}while(x.length>0);push({type:"eos"});return E};e.exports=parse},3625:function(e,t,r){"use strict";const n=r(2456);e.exports=(e,t={})=>{let stringify=(e,r={})=>{let o=t.escapeInvalid&&n.isInvalidBrace(r);let s=e.invalid===true&&t.escapeInvalid===true;let i="";if(e.value){if((o||s)&&n.isOpenOrClose(e)){return"\\"+e.value}return e.value}if(e.value){return e.value}if(e.nodes){for(let t of e.nodes){i+=stringify(t)}}return i};return stringify(e)}},2456:function(e,t){"use strict";t.isInteger=e=>{if(typeof e==="number"){return Number.isInteger(e)}if(typeof e==="string"&&e.trim()!==""){return Number.isInteger(Number(e))}return false};t.find=(e,t)=>e.nodes.find((e=>e.type===t));t.exceedsLimit=(e,r,n=1,o)=>{if(o===false)return false;if(!t.isInteger(e)||!t.isInteger(r))return false;return(Number(r)-Number(e))/Number(n)>=o};t.escapeNode=(e,t=0,r)=>{let n=e.nodes[t];if(!n)return;if(r&&n.type===r||n.type==="open"||n.type==="close"){if(n.escaped!==true){n.value="\\"+n.value;n.escaped=true}}};t.encloseBrace=e=>{if(e.type!=="brace")return false;if(e.commas>>0+e.ranges>>0===0){e.invalid=true;return true}return false};t.isInvalidBrace=e=>{if(e.type!=="brace")return false;if(e.invalid===true||e.dollar)return true;if(e.commas>>0+e.ranges>>0===0){e.invalid=true;return true}if(e.open!==true||e.close!==true){e.invalid=true;return true}return false};t.isOpenOrClose=e=>{if(e.type==="open"||e.type==="close"){return true}return e.open===true||e.close===true};t.reduce=e=>e.reduce(((e,t)=>{if(t.type==="text")e.push(t.value);if(t.type==="range")t.type="text";return e}),[]);t.flatten=(...e)=>{const t=[];const flat=e=>{for(let r=0;r<e.length;r++){let n=e[r];Array.isArray(n)?flat(n,t):n!==void 0&&t.push(n)}return t};flat(e);return t}},5377:function(e){"use strict";var t=Object.prototype.hasOwnProperty,r="~";function Events(){}if(Object.create){Events.prototype=Object.create(null);if(!(new Events).__proto__)r=false}function EE(e,t,r){this.fn=e;this.context=t;this.once=r||false}function addListener(e,t,n,o,s){if(typeof n!=="function"){throw new TypeError("The listener must be a function")}var i=new EE(n,o||e,s),u=r?r+t:t;if(!e._events[u])e._events[u]=i,e._eventsCount++;else if(!e._events[u].fn)e._events[u].push(i);else e._events[u]=[e._events[u],i];return e}function clearEvent(e,t){if(--e._eventsCount===0)e._events=new Events;else delete e._events[t]}function EventEmitter(){this._events=new Events;this._eventsCount=0}EventEmitter.prototype.eventNames=function eventNames(){var e=[],n,o;if(this._eventsCount===0)return e;for(o in n=this._events){if(t.call(n,o))e.push(r?o.slice(1):o)}if(Object.getOwnPropertySymbols){return e.concat(Object.getOwnPropertySymbols(n))}return e};EventEmitter.prototype.listeners=function listeners(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,s=n.length,i=new Array(s);o<s;o++){i[o]=n[o].fn}return i};EventEmitter.prototype.listenerCount=function listenerCount(e){var t=r?r+e:e,n=this._events[t];if(!n)return 0;if(n.fn)return 1;return n.length};EventEmitter.prototype.emit=function emit(e,t,n,o,s,i){var u=r?r+e:e;if(!this._events[u])return false;var a=this._events[u],c=arguments.length,l,f;if(a.fn){if(a.once)this.removeListener(e,a.fn,undefined,true);switch(c){case 1:return a.fn.call(a.context),true;case 2:return a.fn.call(a.context,t),true;case 3:return a.fn.call(a.context,t,n),true;case 4:return a.fn.call(a.context,t,n,o),true;case 5:return a.fn.call(a.context,t,n,o,s),true;case 6:return a.fn.call(a.context,t,n,o,s,i),true}for(f=1,l=new Array(c-1);f<c;f++){l[f-1]=arguments[f]}a.fn.apply(a.context,l)}else{var p=a.length,h;for(f=0;f<p;f++){if(a[f].once)this.removeListener(e,a[f].fn,undefined,true);switch(c){case 1:a[f].fn.call(a[f].context);break;case 2:a[f].fn.call(a[f].context,t);break;case 3:a[f].fn.call(a[f].context,t,n);break;case 4:a[f].fn.call(a[f].context,t,n,o);break;default:if(!l)for(h=1,l=new Array(c-1);h<c;h++){l[h-1]=arguments[h]}a[f].fn.apply(a[f].context,l)}}}return true};EventEmitter.prototype.on=function on(e,t,r){return addListener(this,e,t,r,false)};EventEmitter.prototype.once=function once(e,t,r){return addListener(this,e,t,r,true)};EventEmitter.prototype.removeListener=function removeListener(e,t,n,o){var s=r?r+e:e;if(!this._events[s])return this;if(!t){clearEvent(this,s);return this}var i=this._events[s];if(i.fn){if(i.fn===t&&(!o||i.once)&&(!n||i.context===n)){clearEvent(this,s)}}else{for(var u=0,a=[],c=i.length;u<c;u++){if(i[u].fn!==t||o&&!i[u].once||n&&i[u].context!==n){a.push(i[u])}}if(a.length)this._events[s]=a.length===1?a[0]:a;else clearEvent(this,s)}return this};EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t;if(e){t=r?r+e:e;if(this._events[t])clearEvent(this,t)}else{this._events=new Events;this._eventsCount=0}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.addListener=EventEmitter.prototype.on;EventEmitter.prefixed=r;EventEmitter.EventEmitter=EventEmitter;if(true){e.exports=EventEmitter}},442:function(e,t,r){"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/const n=r(3837);const o=r(211);const isObject=e=>e!==null&&typeof e==="object"&&!Array.isArray(e);const transform=e=>t=>e===true?Number(t):String(t);const isValidValue=e=>typeof e==="number"||typeof e==="string"&&e!=="";const isNumber=e=>Number.isInteger(+e);const zeros=e=>{let t=`${e}`;let r=-1;if(t[0]==="-")t=t.slice(1);if(t==="0")return false;while(t[++r]==="0");return r>0};const stringify=(e,t,r)=>{if(typeof e==="string"||typeof t==="string"){return true}return r.stringify===true};const pad=(e,t,r)=>{if(t>0){let r=e[0]==="-"?"-":"";if(r)e=e.slice(1);e=r+e.padStart(r?t-1:t,"0")}if(r===false){return String(e)}return e};const toMaxLen=(e,t)=>{let r=e[0]==="-"?"-":"";if(r){e=e.slice(1);t--}while(e.length<t)e="0"+e;return r?"-"+e:e};const toSequence=(e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0));e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let r=t.capture?"":"?:";let n="";let o="";let s;if(e.positives.length){n=e.positives.join("|")}if(e.negatives.length){o=`-(${r}${e.negatives.join("|")})`}if(n&&o){s=`${n}|${o}`}else{s=n||o}if(t.wrap){return`(${r}${s})`}return s};const toRange=(e,t,r,n)=>{if(r){return o(e,t,{wrap:false,...n})}let s=String.fromCharCode(e);if(e===t)return s;let i=String.fromCharCode(t);return`[${s}-${i}]`};const toRegex=(e,t,r)=>{if(Array.isArray(e)){let t=r.wrap===true;let n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return o(e,t,r)};const rangeError=(...e)=>new RangeError("Invalid range arguments: "+n.inspect(...e));const invalidRange=(e,t,r)=>{if(r.strictRanges===true)throw rangeError([e,t]);return[]};const invalidStep=(e,t)=>{if(t.strictRanges===true){throw new TypeError(`Expected step "${e}" to be a number`)}return[]};const fillNumbers=(e,t,r=1,n={})=>{let o=Number(e);let s=Number(t);if(!Number.isInteger(o)||!Number.isInteger(s)){if(n.strictRanges===true)throw rangeError([e,t]);return[]}if(o===0)o=0;if(s===0)s=0;let i=o>s;let u=String(e);let a=String(t);let c=String(r);r=Math.max(Math.abs(r),1);let l=zeros(u)||zeros(a)||zeros(c);let f=l?Math.max(u.length,a.length,c.length):0;let p=l===false&&stringify(e,t,n)===false;let h=n.transform||transform(p);if(n.toRegex&&r===1){return toRange(toMaxLen(e,f),toMaxLen(t,f),true,n)}let d={negatives:[],positives:[]};let push=e=>d[e<0?"negatives":"positives"].push(Math.abs(e));let g=[];let R=0;while(i?o>=s:o<=s){if(n.toRegex===true&&r>1){push(o)}else{g.push(pad(h(o,R),f,p))}o=i?o-r:o+r;R++}if(n.toRegex===true){return r>1?toSequence(d,n):toRegex(g,null,{wrap:false,...n})}return g};const fillLetters=(e,t,r=1,n={})=>{if(!isNumber(e)&&e.length>1||!isNumber(t)&&t.length>1){return invalidRange(e,t,n)}let o=n.transform||(e=>String.fromCharCode(e));let s=`${e}`.charCodeAt(0);let i=`${t}`.charCodeAt(0);let u=s>i;let a=Math.min(s,i);let c=Math.max(s,i);if(n.toRegex&&r===1){return toRange(a,c,false,n)}let l=[];let f=0;while(u?s>=i:s<=i){l.push(o(s,f));s=u?s-r:s+r;f++}if(n.toRegex===true){return toRegex(l,null,{wrap:false,options:n})}return l};const fill=(e,t,r,n={})=>{if(t==null&&isValidValue(e)){return[e]}if(!isValidValue(e)||!isValidValue(t)){return invalidRange(e,t,n)}if(typeof r==="function"){return fill(e,t,1,{transform:r})}if(isObject(r)){return fill(e,t,0,r)}let o={...n};if(o.capture===true)o.wrap=true;r=r||o.step||1;if(!isNumber(r)){if(r!=null&&!isObject(r))return invalidStep(r,o);return fill(e,t,1,r)}if(isNumber(e)&&isNumber(t)){return fillNumbers(e,t,r,o)}return fillLetters(e,t,Math.max(Math.abs(r),1),o)};e.exports=fill},2794:function(e,t,r){var n;e.exports=function(){if(!n){try{n=r(4755)("follow-redirects")}catch(e){}if(typeof n!=="function"){n=function(){}}}n.apply(null,arguments)}},4113:function(e,t,r){var n=r(7310);var o=n.URL;var s=r(3685);var i=r(5687);var u=r(2781).Writable;var a=r(9491);var c=r(2794);var l=["abort","aborted","connect","error","socket","timeout"];var f=Object.create(null);l.forEach((function(e){f[e]=function(t,r,n){this._redirectable.emit(e,t,r,n)}}));var p=createErrorType("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var h=createErrorType("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded");var d=createErrorType("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var g=createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");function RedirectableRequest(e,t){u.call(this);this._sanitizeOptions(e);this._options=e;this._ended=false;this._ending=false;this._redirectCount=0;this._redirects=[];this._requestBodyLength=0;this._requestBodyBuffers=[];if(t){this.on("response",t)}var r=this;this._onNativeResponse=function(e){r._processResponse(e)};this._performRequest()}RedirectableRequest.prototype=Object.create(u.prototype);RedirectableRequest.prototype.abort=function(){abortRequest(this._currentRequest);this.emit("abort")};RedirectableRequest.prototype.write=function(e,t,r){if(this._ending){throw new g}if(!(typeof e==="string"||typeof e==="object"&&"length"in e)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(typeof t==="function"){r=t;t=null}if(e.length===0){if(r){r()}return}if(this._requestBodyLength+e.length<=this._options.maxBodyLength){this._requestBodyLength+=e.length;this._requestBodyBuffers.push({data:e,encoding:t});this._currentRequest.write(e,t,r)}else{this.emit("error",new d);this.abort()}};RedirectableRequest.prototype.end=function(e,t,r){if(typeof e==="function"){r=e;e=t=null}else if(typeof t==="function"){r=t;t=null}if(!e){this._ended=this._ending=true;this._currentRequest.end(null,null,r)}else{var n=this;var o=this._currentRequest;this.write(e,t,(function(){n._ended=true;o.end(null,null,r)}));this._ending=true}};RedirectableRequest.prototype.setHeader=function(e,t){this._options.headers[e]=t;this._currentRequest.setHeader(e,t)};RedirectableRequest.prototype.removeHeader=function(e){delete this._options.headers[e];this._currentRequest.removeHeader(e)};RedirectableRequest.prototype.setTimeout=function(e,t){var r=this;function destroyOnTimeout(t){t.setTimeout(e);t.removeListener("timeout",t.destroy);t.addListener("timeout",t.destroy)}function startTimer(t){if(r._timeout){clearTimeout(r._timeout)}r._timeout=setTimeout((function(){r.emit("timeout");clearTimer()}),e);destroyOnTimeout(t)}function clearTimer(){if(r._timeout){clearTimeout(r._timeout);r._timeout=null}r.removeListener("abort",clearTimer);r.removeListener("error",clearTimer);r.removeListener("response",clearTimer);if(t){r.removeListener("timeout",t)}if(!r.socket){r._currentRequest.removeListener("socket",startTimer)}}if(t){this.on("timeout",t)}if(this.socket){startTimer(this.socket)}else{this._currentRequest.once("socket",startTimer)}this.on("socket",destroyOnTimeout);this.on("abort",clearTimer);this.on("error",clearTimer);this.on("response",clearTimer);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){RedirectableRequest.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}}));["aborted","connection","socket"].forEach((function(e){Object.defineProperty(RedirectableRequest.prototype,e,{get:function(){return this._currentRequest[e]}})}));RedirectableRequest.prototype._sanitizeOptions=function(e){if(!e.headers){e.headers={}}if(e.host){if(!e.hostname){e.hostname=e.host}delete e.host}if(!e.pathname&&e.path){var t=e.path.indexOf("?");if(t<0){e.pathname=e.path}else{e.pathname=e.path.substring(0,t);e.search=e.path.substring(t)}}};RedirectableRequest.prototype._performRequest=function(){var e=this._options.protocol;var t=this._options.nativeProtocols[e];if(!t){this.emit("error",new TypeError("Unsupported protocol "+e));return}if(this._options.agents){var r=e.slice(0,-1);this._options.agent=this._options.agents[r]}var o=this._currentRequest=t.request(this._options,this._onNativeResponse);o._redirectable=this;for(var s of l){o.on(s,f[s])}this._currentUrl=/^\//.test(this._options.path)?n.format(this._options):this._currentUrl=this._options.path;if(this._isRedirect){var i=0;var u=this;var a=this._requestBodyBuffers;(function writeNext(e){if(o===u._currentRequest){if(e){u.emit("error",e)}else if(i<a.length){var t=a[i++];if(!o.finished){o.write(t.data,t.encoding,writeNext)}}else if(u._ended){o.end()}}})()}};RedirectableRequest.prototype._processResponse=function(e){var t=e.statusCode;if(this._options.trackRedirects){this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t})}var r=e.headers.location;if(!r||this._options.followRedirects===false||t<300||t>=400){e.responseUrl=this._currentUrl;e.redirects=this._redirects;this.emit("response",e);this._requestBodyBuffers=[];return}abortRequest(this._currentRequest);e.destroy();if(++this._redirectCount>this._options.maxRedirects){this.emit("error",new h);return}var o;var s=this._options.beforeRedirect;if(s){o=Object.assign({Host:e.req.getHeader("host")},this._options.headers)}var i=this._options.method;if((t===301||t===302)&&this._options.method==="POST"||t===303&&!/^(?:GET|HEAD)$/.test(this._options.method)){this._options.method="GET";this._requestBodyBuffers=[];removeMatchingHeaders(/^content-/i,this._options.headers)}var u=removeMatchingHeaders(/^host$/i,this._options.headers);var a=n.parse(this._currentUrl);var l=u||a.host;var f=/^\w+:/.test(r)?this._currentUrl:n.format(Object.assign(a,{host:l}));var d;try{d=n.resolve(f,r)}catch(e){this.emit("error",new p(e));return}c("redirecting to",d);this._isRedirect=true;var g=n.parse(d);Object.assign(this._options,g);if(g.protocol!==a.protocol&&g.protocol!=="https:"||g.host!==l&&!isSubdomain(g.host,l)){removeMatchingHeaders(/^(?:authorization|cookie)$/i,this._options.headers)}if(typeof s==="function"){var R={headers:e.headers,statusCode:t};var y={url:f,method:i,headers:o};try{s(this._options,R,y)}catch(e){this.emit("error",e);return}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new p(e))}};function wrap(e){var t={maxRedirects:21,maxBodyLength:10*1024*1024};var r={};Object.keys(e).forEach((function(s){var i=s+":";var u=r[i]=e[s];var l=t[s]=Object.create(u);function request(e,s,u){if(typeof e==="string"){var l=e;try{e=urlToOptions(new o(l))}catch(t){e=n.parse(l)}}else if(o&&e instanceof o){e=urlToOptions(e)}else{u=s;s=e;e={protocol:i}}if(typeof s==="function"){u=s;s=null}s=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,s);s.nativeProtocols=r;a.equal(s.protocol,i,"protocol mismatch");c("options",s);return new RedirectableRequest(s,u)}function get(e,t,r){var n=l.request(e,t,r);n.end();return n}Object.defineProperties(l,{request:{value:request,configurable:true,enumerable:true,writable:true},get:{value:get,configurable:true,enumerable:true,writable:true}})}));return t}function noop(){}function urlToOptions(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};if(e.port!==""){t.port=Number(e.port)}return t}function removeMatchingHeaders(e,t){var r;for(var n in t){if(e.test(n)){r=t[n];delete t[n]}}return r===null||typeof r==="undefined"?undefined:String(r).trim()}function createErrorType(e,t){function CustomError(e){Error.captureStackTrace(this,this.constructor);if(!e){this.message=t}else{this.message=t+": "+e.message;this.cause=e}}CustomError.prototype=new Error;CustomError.prototype.constructor=CustomError;CustomError.prototype.name="Error ["+e+"]";CustomError.prototype.code=e;return CustomError}function abortRequest(e){for(var t of l){e.removeListener(t,f[t])}e.on("error",noop);e.abort()}function isSubdomain(e,t){const r=e.length-t.length-1;return r>0&&e[r]==="."&&e.endsWith(t)}e.exports=wrap({http:s,https:i});e.exports.wrap=wrap},66:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getHandlers=t.init=void 0;const n=r(1936);const o=(0,n.getInstance)();function init(e,t){const r=getHandlers(t);for(const t of Object.keys(r)){e.on(t,r[t])}o.debug("[HPM] Subscribed to http-proxy events:",Object.keys(r))}t.init=init;function getHandlers(e){const t={error:"onError",proxyReq:"onProxyReq",proxyReqWs:"onProxyReqWs",proxyRes:"onProxyRes",open:"onOpen",close:"onClose"};const r={};for(const[n,o]of Object.entries(t)){const t=e?e[o]:null;if(typeof t==="function"){r[n]=t}}if(typeof r.error!=="function"){r.error=defaultErrorHandler}if(typeof r.close!=="function"){r.close=logClose}return r}t.getHandlers=getHandlers;function defaultErrorHandler(e,t,r){if(!t&&!r){throw e}const n=t.headers&&t.headers.host;const o=e.code;if(r.writeHead&&!r.headersSent){if(/HPE_INVALID/.test(o)){r.writeHead(502)}else{switch(o){case"ECONNRESET":case"ENOTFOUND":case"ECONNREFUSED":case"ETIMEDOUT":r.writeHead(504);break;default:r.writeHead(500)}}}r.end(`Error occurred while trying to proxy: ${n}${t.url}`)}function logClose(e,t,r){o.info("[HPM] Client disconnected")}},6418:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createConfig=void 0;const n=r(4273);const o=r(7310);const s=r(6721);const i=r(1936);const u=(0,i.getInstance)();function createConfig(e,t){const r={context:undefined,options:{}};if(isContextless(e,t)){r.context="/";r.options=Object.assign(r.options,e)}else if(isStringShortHand(e)){const n=o.parse(e);const s=[n.protocol,"//",n.host].join("");r.context=n.pathname||"/";r.options=Object.assign(r.options,{target:s},t);if(n.protocol==="ws:"||n.protocol==="wss:"){r.options.ws=true}}else{r.context=e;r.options=Object.assign(r.options,t)}configureLogger(r.options);if(!r.options.target&&!r.options.router){throw new Error(s.ERRORS.ERR_CONFIG_FACTORY_TARGET_MISSING)}return r}t.createConfig=createConfig;function isStringShortHand(e){if(typeof e==="string"){return!!o.parse(e).host}}function isContextless(e,t){return n(e)&&(t==null||Object.keys(t).length===0)}function configureLogger(e){if(e.logLevel){u.setLevel(e.logLevel)}if(e.logProvider){u.setProvider(e.logProvider)}}},1572:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.match=void 0;const n=r(6654);const o=r(8627);const s=r(7310);const i=r(6721);function match(e,t,r){if(isStringPath(e)){return matchSingleStringPath(e,t)}if(isGlobPath(e)){return matchSingleGlobPath(e,t)}if(Array.isArray(e)){if(e.every(isStringPath)){return matchMultiPath(e,t)}if(e.every(isGlobPath)){return matchMultiGlobPath(e,t)}throw new Error(i.ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY)}if(typeof e==="function"){const n=getUrlPathName(t);return e(n,r)}throw new Error(i.ERRORS.ERR_CONTEXT_MATCHER_GENERIC)}t.match=match;function matchSingleStringPath(e,t){const r=getUrlPathName(t);return r.indexOf(e)===0}function matchSingleGlobPath(e,t){const r=getUrlPathName(t);const n=o([r],e);return n&&n.length>0}function matchMultiGlobPath(e,t){return matchSingleGlobPath(e,t)}function matchMultiPath(e,t){let r=false;for(const n of e){if(matchSingleStringPath(n,t)){r=true;break}}return r}function getUrlPathName(e){return e&&s.parse(e).pathname}function isStringPath(e){return typeof e==="string"&&!n(e)}function isGlobPath(e){return n(e)}},6721:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ERRORS=void 0;var r;(function(e){e["ERR_CONFIG_FACTORY_TARGET_MISSING"]='[HPM] Missing "target" option. Example: {target: "http://www.example.org"}';e["ERR_CONTEXT_MATCHER_GENERIC"]='[HPM] Invalid context. Expecting something like: "/api" or ["/api", "/ajax"]';e["ERR_CONTEXT_MATCHER_INVALID_ARRAY"]='[HPM] Invalid context. Expecting something like: ["/api", "/ajax"] or ["/api/**", "!**.html"]';e["ERR_PATH_REWRITER_CONFIG"]="[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function"})(r=t.ERRORS||(t.ERRORS={}))},8330:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.fixRequestBody=void 0;const n=r(3477);function fixRequestBody(e,t){const r=t.body;if(!r){return}const o=e.getHeader("Content-Type");const writeBody=t=>{e.setHeader("Content-Length",Buffer.byteLength(t));e.write(t)};if(o&&o.includes("application/json")){writeBody(JSON.stringify(r))}if(o&&o.includes("application/x-www-form-urlencoded")){writeBody(n.stringify(r))}}t.fixRequestBody=fixRequestBody},4249:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});o(r(4265),t)},4265:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.fixRequestBody=t.responseInterceptor=void 0;var n=r(9678);Object.defineProperty(t,"responseInterceptor",{enumerable:true,get:function(){return n.responseInterceptor}});var o=r(8330);Object.defineProperty(t,"fixRequestBody",{enumerable:true,get:function(){return o.fixRequestBody}})},9678:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.responseInterceptor=void 0;const n=r(9796);function responseInterceptor(e){return async function proxyRes(proxyRes,t,r){const n=proxyRes;let o=Buffer.from("","utf8");const s=decompress(proxyRes,proxyRes.headers["content-encoding"]);s.on("data",(e=>o=Buffer.concat([o,e])));s.on("end",(async()=>{copyHeaders(proxyRes,r);const s=Buffer.from(await e(o,n,t,r));r.setHeader("content-length",Buffer.byteLength(s,"utf8"));r.write(s);r.end()}));s.on("error",(e=>{r.end(`Error fetching proxied request: ${e.message}`)}))}}t.responseInterceptor=responseInterceptor;function decompress(e,t){let r=e;let o;switch(t){case"gzip":o=n.createGunzip();break;case"br":o=n.createBrotliDecompress();break;case"deflate":o=n.createInflate();break;default:break}if(o){r.pipe(o);r=o}return r}function copyHeaders(e,t){t.statusCode=e.statusCode;t.statusMessage=e.statusMessage;if(t.setHeader){let r=Object.keys(e.headers);r=r.filter((e=>!["content-encoding","transfer-encoding"].includes(e)));r.forEach((r=>{let n=e.headers[r];if(r==="set-cookie"){n=Array.isArray(n)?n:[n];n=n.map((e=>e.replace(/Domain=[^;]+?/i,"")))}t.setHeader(r,n)}))}else{t.headers=e.headers}}},5037:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.HttpProxyMiddleware=void 0;const n=r(6873);const o=r(6418);const s=r(1572);const i=r(66);const u=r(1936);const a=r(5132);const c=r(4112);class HttpProxyMiddleware{constructor(e,t){this.logger=(0,u.getInstance)();this.wsInternalSubscribed=false;this.serverOnCloseSubscribed=false;this.middleware=async(e,t,r)=>{var n,o;if(this.shouldProxy(this.config.context,e)){try{const r=await this.prepareProxyRequest(e);this.proxy.web(e,t,r)}catch(e){r(e)}}else{r()}const s=(o=(n=e.socket)!==null&&n!==void 0?n:e.connection)===null||o===void 0?void 0:o.server;if(s&&!this.serverOnCloseSubscribed){s.on("close",(()=>{this.logger.info("[HPM] server close signal received: closing proxy server");this.proxy.close()}));this.serverOnCloseSubscribed=true}if(this.proxyOptions.ws===true){this.catchUpgradeRequest(s)}};this.catchUpgradeRequest=e=>{if(!this.wsInternalSubscribed){e.on("upgrade",this.handleUpgrade);this.wsInternalSubscribed=true}};this.handleUpgrade=async(e,t,r)=>{if(this.shouldProxy(this.config.context,e)){const n=await this.prepareProxyRequest(e);this.proxy.ws(e,t,r,n);this.logger.info("[HPM] Upgrading to WebSocket")}};this.shouldProxy=(e,t)=>{const r=t.originalUrl||t.url;return s.match(e,r,t)};this.prepareProxyRequest=async e=>{e.url=e.originalUrl||e.url;const t=e.url;const r=Object.assign({},this.proxyOptions);await this.applyRouter(e,r);await this.applyPathRewrite(e,this.pathRewriter);if(this.proxyOptions.logLevel==="debug"){const n=(0,u.getArrow)(t,e.url,this.proxyOptions.target,r.target);this.logger.debug("[HPM] %s %s %s %s",e.method,t,n,r.target)}return r};this.applyRouter=async(e,t)=>{let r;if(t.router){r=await c.getTarget(e,t);if(r){this.logger.debug('[HPM] Router new target: %s -> "%s"',t.target,r);t.target=r}}};this.applyPathRewrite=async(e,t)=>{if(t){const r=await t(e.url,e);if(typeof r==="string"){e.url=r}else{this.logger.info("[HPM] pathRewrite: No rewritten path found. (%s)",e.url)}}};this.logError=(e,t,r,n)=>{var o;const s=((o=t.headers)===null||o===void 0?void 0:o.host)||t.hostname||t.host;const i=`${s}${t.url}`;const u=`${n===null||n===void 0?void 0:n.href}`;const a="[HPM] Error occurred while proxying request %s to %s [%s] (%s)";const c="https://nodejs.org/api/errors.html#errors_common_system_errors";this.logger.error(a,i,u,e.code||e,c)};this.config=(0,o.createConfig)(e,t);this.proxyOptions=this.config.options;this.proxy=n.createProxyServer({});this.logger.info(`[HPM] Proxy created: ${this.config.context} -> ${this.proxyOptions.target}`);this.pathRewriter=a.createPathRewriter(this.proxyOptions.pathRewrite);i.init(this.proxy,this.proxyOptions);this.proxy.on("error",this.logError);this.middleware.upgrade=(e,t,r)=>{if(!this.wsInternalSubscribed){this.handleUpgrade(e,t,r)}}}}t.HttpProxyMiddleware=HttpProxyMiddleware},7666:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.createProxyMiddleware=void 0;const s=r(5037);function createProxyMiddleware(e,t){const{middleware:r}=new s.HttpProxyMiddleware(e,t);return r}t.createProxyMiddleware=createProxyMiddleware;o(r(4249),t)},1936:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getArrow=t.getInstance=void 0;const n=r(3837);let o;const s={log:console.log,debug:console.log,info:console.info,warn:console.warn,error:console.error};var i;(function(e){e[e["debug"]=10]="debug";e[e["info"]=20]="info";e[e["warn"]=30]="warn";e[e["error"]=50]="error";e[e["silent"]=80]="silent"})(i||(i={}));function getInstance(){if(!o){o=new Logger}return o}t.getInstance=getInstance;class Logger{constructor(){this.setLevel("info");this.setProvider((()=>s))}log(){this.provider.log(this._interpolate.apply(null,arguments))}debug(){if(this._showLevel("debug")){this.provider.debug(this._interpolate.apply(null,arguments))}}info(){if(this._showLevel("info")){this.provider.info(this._interpolate.apply(null,arguments))}}warn(){if(this._showLevel("warn")){this.provider.warn(this._interpolate.apply(null,arguments))}}error(){if(this._showLevel("error")){this.provider.error(this._interpolate.apply(null,arguments))}}setLevel(e){if(this.isValidLevel(e)){this.logLevel=e}}setProvider(e){if(e&&this.isValidProvider(e)){this.provider=e(s)}}isValidProvider(e){const t=true;if(e&&typeof e!=="function"){throw new Error("[HPM] Log provider config error. Expecting a function.")}return t}isValidLevel(e){const t=Object.keys(i);const r=t.includes(e);if(!r){throw new Error("[HPM] Log level error. Invalid logLevel.")}return r}_showLevel(e){let t=false;const r=i[this.logLevel];if(r&&r<=i[e]){t=true}return t}_interpolate(e,...t){const r=n.format(e,...t);return r}}function getArrow(e,t,r,n){const o=[">"];const s=r!==n;const i=e!==t;if(i&&!s){o.unshift("~")}else if(!i&&s){o.unshift("=")}else if(i&&s){o.unshift("≈")}else{o.unshift("-")}return o.join("")}t.getArrow=getArrow},5132:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.createPathRewriter=void 0;const n=r(4273);const o=r(6721);const s=r(1936);const i=(0,s.getInstance)();function createPathRewriter(e){let t;if(!isValidRewriteConfig(e)){return}if(typeof e==="function"){const t=e;return t}else{t=parsePathRewriteRules(e);return rewritePath}function rewritePath(e){let r=e;for(const n of t){if(n.regex.test(e)){r=r.replace(n.regex,n.value);i.debug('[HPM] Rewriting path from "%s" to "%s"',e,r);break}}return r}}t.createPathRewriter=createPathRewriter;function isValidRewriteConfig(e){if(typeof e==="function"){return true}else if(n(e)){return Object.keys(e).length!==0}else if(e===undefined||e===null){return false}else{throw new Error(o.ERRORS.ERR_PATH_REWRITER_CONFIG)}}function parsePathRewriteRules(e){const t=[];if(n(e)){for(const[r]of Object.entries(e)){t.push({regex:new RegExp(r),value:e[r]});i.info('[HPM] Proxy rewrite rule created: "%s" ~> "%s"',r,e[r])}}return t}},4112:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getTarget=void 0;const n=r(4273);const o=r(1936);const s=(0,o.getInstance)();async function getTarget(e,t){let r;const o=t.router;if(n(o)){r=getTargetFromProxyTable(e,o)}else if(typeof o==="function"){r=await o(e)}return r}t.getTarget=getTarget;function getTargetFromProxyTable(e,t){let r;const n=e.headers.host;const o=e.url;const i=n+o;for(const[e]of Object.entries(t)){if(containsPath(e)){if(i.indexOf(e)>-1){r=t[e];s.debug('[HPM] Router table match: "%s"',e);break}}else{if(e===n){r=t[e];s.debug('[HPM] Router table match: "%s"',n);break}}}return r}function containsPath(e){return e.indexOf("/")>-1}},6873:function(e,t,r){
|
|
8
|
+
/*!
|
|
9
|
+
* Caron dimonio, con occhi di bragia
|
|
10
|
+
* loro accennando, tutte le raccoglie;
|
|
11
|
+
* batte col remo qualunque s’adagia
|
|
12
|
+
*
|
|
13
|
+
* Charon the demon, with the eyes of glede,
|
|
14
|
+
* Beckoning to them, collects them all together,
|
|
15
|
+
* Beats with his oar whoever lags behind
|
|
16
|
+
*
|
|
17
|
+
* Dante - The Divine Comedy (Canto III)
|
|
18
|
+
*/
|
|
19
|
+
e.exports=r(8831)},8831:function(e,t,r){var n=r(9691).Server;function createProxyServer(e){return new n(e)}n.createProxyServer=createProxyServer;n.createServer=createProxyServer;n.createProxy=createProxyServer;e.exports=n},8398:function(e,t,r){var n=t,o=r(7310),s=r(3837)._extend,i=r(926);var u=/(^|,)\s*upgrade\s*($|,)/i,a=/^https|wss/;n.isSSL=a;n.setupOutgoing=function(e,t,r,c){e.port=t[c||"target"].port||(a.test(t[c||"target"].protocol)?443:80);["host","hostname","socketPath","pfx","key","passphrase","cert","ca","ciphers","secureProtocol"].forEach((function(r){e[r]=t[c||"target"][r]}));e.method=t.method||r.method;e.headers=s({},r.headers);if(t.headers){s(e.headers,t.headers)}if(t.auth){e.auth=t.auth}if(t.ca){e.ca=t.ca}if(a.test(t[c||"target"].protocol)){e.rejectUnauthorized=typeof t.secure==="undefined"?true:t.secure}e.agent=t.agent||false;e.localAddress=t.localAddress;if(!e.agent){e.headers=e.headers||{};if(typeof e.headers.connection!=="string"||!u.test(e.headers.connection)){e.headers.connection="close"}}var l=t[c||"target"];var f=l&&t.prependPath!==false?l.path||"":"";var p=!t.toProxy?o.parse(r.url).path||"":r.url;p=!t.ignorePath?p:"";e.path=n.urlJoin(f,p);if(t.changeOrigin){e.headers.host=i(e.port,t[c||"target"].protocol)&&!hasPort(e.host)?e.host+":"+e.port:e.host}return e};n.setupSocket=function(e){e.setTimeout(0);e.setNoDelay(true);e.setKeepAlive(true,0);return e};n.getPort=function(e){var t=e.headers.host?e.headers.host.match(/:(\d+)/):"";return t?t[1]:n.hasEncryptedConnection(e)?"443":"80"};n.hasEncryptedConnection=function(e){return Boolean(e.connection.encrypted||e.connection.pair)};n.urlJoin=function(){var e=Array.prototype.slice.call(arguments),t=e.length-1,r=e[t],n=r.split("?"),o;e[t]=n.shift();o=[e.filter(Boolean).join("/").replace(/\/+/g,"/").replace("http:/","http://").replace("https:/","https://")];o.push.apply(o,n);return o.join("?")};n.rewriteCookieProperty=function rewriteCookieProperty(e,t,r){if(Array.isArray(e)){return e.map((function(e){return rewriteCookieProperty(e,t,r)}))}return e.replace(new RegExp("(;\\s*"+r+"=)([^;]+)","i"),(function(e,r,n){var o;if(n in t){o=t[n]}else if("*"in t){o=t["*"]}else{return e}if(o){return r+o}else{return""}}))};function hasPort(e){return!!~e.indexOf(":")}},9691:function(e,t,r){var n=e.exports,o=r(3837)._extend,s=r(7310).parse,i=r(5377),u=r(3685),a=r(5687),c=r(3756),l=r(2733);n.Server=ProxyServer;function createRightProxy(e){return function(t){return function(r,n){var i=e==="ws"?this.wsPasses:this.webPasses,u=[].slice.call(arguments),a=u.length-1,c,l;if(typeof u[a]==="function"){l=u[a];a--}var f=t;if(!(u[a]instanceof Buffer)&&u[a]!==n){f=o({},t);o(f,u[a]);a--}if(u[a]instanceof Buffer){c=u[a]}["target","forward"].forEach((function(e){if(typeof f[e]==="string")f[e]=s(f[e])}));if(!f.target&&!f.forward){return this.emit("error",new Error("Must provide a proper URL as target"))}for(var p=0;p<i.length;p++){if(i[p](r,n,f,c,this,l)){break}}}}}n.createRightProxy=createRightProxy;function ProxyServer(e){i.call(this);e=e||{};e.prependPath=e.prependPath===false?false:true;this.web=this.proxyRequest=createRightProxy("web")(e);this.ws=this.proxyWebsocketRequest=createRightProxy("ws")(e);this.options=e;this.webPasses=Object.keys(c).map((function(e){return c[e]}));this.wsPasses=Object.keys(l).map((function(e){return l[e]}));this.on("error",this.onError,this)}r(3837).inherits(ProxyServer,i);ProxyServer.prototype.onError=function(e){if(this.listeners("error").length===1){throw e}};ProxyServer.prototype.listen=function(e,t){var r=this,closure=function(e,t){r.web(e,t)};this._server=this.options.ssl?a.createServer(this.options.ssl,closure):u.createServer(closure);if(this.options.ws){this._server.on("upgrade",(function(e,t,n){r.ws(e,t,n)}))}this._server.listen(e,t);return this};ProxyServer.prototype.close=function(e){var t=this;if(this._server){this._server.close(done)}function done(){t._server=null;if(e){e.apply(null,arguments)}}};ProxyServer.prototype.before=function(e,t,r){if(e!=="ws"&&e!=="web"){throw new Error("type must be `web` or `ws`")}var n=e==="ws"?this.wsPasses:this.webPasses,o=false;n.forEach((function(e,r){if(e.name===t)o=r}));if(o===false)throw new Error("No such pass");n.splice(o,0,r)};ProxyServer.prototype.after=function(e,t,r){if(e!=="ws"&&e!=="web"){throw new Error("type must be `web` or `ws`")}var n=e==="ws"?this.wsPasses:this.webPasses,o=false;n.forEach((function(e,r){if(e.name===t)o=r}));if(o===false)throw new Error("No such pass");n.splice(o++,0,r)}},3756:function(e,t,r){var n=r(3685),o=r(5687),s=r(2272),i=r(8398),u=r(4113);s=Object.keys(s).map((function(e){return s[e]}));var a={http:n,https:o};
|
|
20
|
+
/*!
|
|
21
|
+
* Array of passes.
|
|
22
|
+
*
|
|
23
|
+
* A `pass` is just a function that is executed on `req, res, options`
|
|
24
|
+
* so that you can easily add new checks while still keeping the base
|
|
25
|
+
* flexible.
|
|
26
|
+
*/e.exports={deleteLength:function deleteLength(e,t,r){if((e.method==="DELETE"||e.method==="OPTIONS")&&!e.headers["content-length"]){e.headers["content-length"]="0";delete e.headers["transfer-encoding"]}},timeout:function timeout(e,t,r){if(r.timeout){e.socket.setTimeout(r.timeout)}},XHeaders:function XHeaders(e,t,r){if(!r.xfwd)return;var n=e.isSpdy||i.hasEncryptedConnection(e);var o={for:e.connection.remoteAddress||e.socket.remoteAddress,port:i.getPort(e),proto:n?"https":"http"};["for","port","proto"].forEach((function(t){e.headers["x-forwarded-"+t]=(e.headers["x-forwarded-"+t]||"")+(e.headers["x-forwarded-"+t]?",":"")+o[t]}));e.headers["x-forwarded-host"]=e.headers["x-forwarded-host"]||e.headers["host"]||""},stream:function stream(e,t,r,n,o,c){o.emit("start",e,t,r.target||r.forward);var l=r.followRedirects?u:a;var f=l.http;var p=l.https;if(r.forward){var h=(r.forward.protocol==="https:"?p:f).request(i.setupOutgoing(r.ssl||{},r,e,"forward"));var d=createErrorHandler(h,r.forward);e.on("error",d);h.on("error",d);(r.buffer||e).pipe(h);if(!r.target){return t.end()}}var g=(r.target.protocol==="https:"?p:f).request(i.setupOutgoing(r.ssl||{},r,e));g.on("socket",(function(n){if(o&&!g.getHeader("expect")){o.emit("proxyReq",g,e,t,r)}}));if(r.proxyTimeout){g.setTimeout(r.proxyTimeout,(function(){g.abort()}))}e.on("aborted",(function(){g.abort()}));var R=createErrorHandler(g,r.target);e.on("error",R);g.on("error",R);function createErrorHandler(r,n){return function proxyError(s){if(e.socket.destroyed&&s.code==="ECONNRESET"){o.emit("econnreset",s,e,t,n);return r.abort()}if(c){c(s,e,t,n)}else{o.emit("error",s,e,t,n)}}}(r.buffer||e).pipe(g);g.on("response",(function(n){if(o){o.emit("proxyRes",n,e,t)}if(!t.headersSent&&!r.selfHandleResponse){for(var i=0;i<s.length;i++){if(s[i](e,t,n,r)){break}}}if(!t.finished){n.on("end",(function(){if(o)o.emit("end",e,t,n)}));if(!r.selfHandleResponse)n.pipe(t)}else{if(o)o.emit("end",e,t,n)}}))}}},2272:function(e,t,r){var n=r(7310),o=r(8398);var s=/^201|30(1|2|7|8)$/;
|
|
27
|
+
/*!
|
|
28
|
+
* Array of passes.
|
|
29
|
+
*
|
|
30
|
+
* A `pass` is just a function that is executed on `req, res, options`
|
|
31
|
+
* so that you can easily add new checks while still keeping the base
|
|
32
|
+
* flexible.
|
|
33
|
+
*/e.exports={removeChunked:function removeChunked(e,t,r){if(e.httpVersion==="1.0"){delete r.headers["transfer-encoding"]}},setConnection:function setConnection(e,t,r){if(e.httpVersion==="1.0"){r.headers.connection=e.headers.connection||"close"}else if(e.httpVersion!=="2.0"&&!r.headers.connection){r.headers.connection=e.headers.connection||"keep-alive"}},setRedirectHostRewrite:function setRedirectHostRewrite(e,t,r,o){if((o.hostRewrite||o.autoRewrite||o.protocolRewrite)&&r.headers["location"]&&s.test(r.statusCode)){var i=n.parse(o.target);var u=n.parse(r.headers["location"]);if(i.host!=u.host){return}if(o.hostRewrite){u.host=o.hostRewrite}else if(o.autoRewrite){u.host=e.headers["host"]}if(o.protocolRewrite){u.protocol=o.protocolRewrite}r.headers["location"]=u.format()}},writeHeaders:function writeHeaders(e,t,r,n){var s=n.cookieDomainRewrite,i=n.cookiePathRewrite,u=n.preserveHeaderKeyCase,a,setHeader=function(e,r){if(r==undefined)return;if(s&&e.toLowerCase()==="set-cookie"){r=o.rewriteCookieProperty(r,s,"domain")}if(i&&e.toLowerCase()==="set-cookie"){r=o.rewriteCookieProperty(r,i,"path")}t.setHeader(String(e).trim(),r)};if(typeof s==="string"){s={"*":s}}if(typeof i==="string"){i={"*":i}}if(u&&r.rawHeaders!=undefined){a={};for(var c=0;c<r.rawHeaders.length;c+=2){var l=r.rawHeaders[c];a[l.toLowerCase()]=l}}Object.keys(r.headers).forEach((function(e){var t=r.headers[e];if(u&&a){e=a[e]||e}setHeader(e,t)}))},writeStatusCode:function writeStatusCode(e,t,r){if(r.statusMessage){t.statusCode=r.statusCode;t.statusMessage=r.statusMessage}else{t.statusCode=r.statusCode}}}},2733:function(e,t,r){var n=r(3685),o=r(5687),s=r(8398);
|
|
34
|
+
/*!
|
|
35
|
+
* Array of passes.
|
|
36
|
+
*
|
|
37
|
+
* A `pass` is just a function that is executed on `req, socket, options`
|
|
38
|
+
* so that you can easily add new checks while still keeping the base
|
|
39
|
+
* flexible.
|
|
40
|
+
*/e.exports={checkMethodAndHeader:function checkMethodAndHeader(e,t){if(e.method!=="GET"||!e.headers.upgrade){t.destroy();return true}if(e.headers.upgrade.toLowerCase()!=="websocket"){t.destroy();return true}},XHeaders:function XHeaders(e,t,r){if(!r.xfwd)return;var n={for:e.connection.remoteAddress||e.socket.remoteAddress,port:s.getPort(e),proto:s.hasEncryptedConnection(e)?"wss":"ws"};["for","port","proto"].forEach((function(t){e.headers["x-forwarded-"+t]=(e.headers["x-forwarded-"+t]||"")+(e.headers["x-forwarded-"+t]?",":"")+n[t]}))},stream:function stream(e,t,r,i,u,a){var createHttpHeader=function(e,t){return Object.keys(t).reduce((function(e,r){var n=t[r];if(!Array.isArray(n)){e.push(r+": "+n);return e}for(var o=0;o<n.length;o++){e.push(r+": "+n[o])}return e}),[e]).join("\r\n")+"\r\n\r\n"};s.setupSocket(t);if(i&&i.length)t.unshift(i);var c=(s.isSSL.test(r.target.protocol)?o:n).request(s.setupOutgoing(r.ssl||{},r,e));if(u){u.emit("proxyReqWs",c,e,t,r,i)}c.on("error",onOutgoingError);c.on("response",(function(e){if(!e.upgrade){t.write(createHttpHeader("HTTP/"+e.httpVersion+" "+e.statusCode+" "+e.statusMessage,e.headers));e.pipe(t)}}));c.on("upgrade",(function(e,r,n){r.on("error",onOutgoingError);r.on("end",(function(){u.emit("close",e,r,n)}));t.on("error",(function(){r.end()}));s.setupSocket(r);if(n&&n.length)r.unshift(n);t.write(createHttpHeader("HTTP/1.1 101 Switching Protocols",e.headers));r.pipe(t).pipe(r);u.emit("open",r);u.emit("proxySocket",r)}));return c.end();function onOutgoingError(r){if(a){a(r,e,t)}else{u.emit("error",r,e,t)}t.end()}}}},3071:function(e){
|
|
41
|
+
/*!
|
|
42
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
45
|
+
* Licensed under the MIT License.
|
|
46
|
+
*/
|
|
47
|
+
e.exports=function isExtglob(e){if(typeof e!=="string"||e===""){return false}var t;while(t=/(\\).|([@?!+*]\(.*\))/g.exec(e)){if(t[2])return true;e=e.slice(t.index+t[0].length)}return false}},6654:function(e,t,r){
|
|
48
|
+
/*!
|
|
49
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
50
|
+
*
|
|
51
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
52
|
+
* Released under the MIT License.
|
|
53
|
+
*/
|
|
54
|
+
var n=r(3071);var o={"{":"}","(":")","[":"]"};var strictCheck=function(e){if(e[0]==="!"){return true}var t=0;var r=-2;var n=-2;var s=-2;var i=-2;var u=-2;while(t<e.length){if(e[t]==="*"){return true}if(e[t+1]==="?"&&/[\].+)]/.test(e[t])){return true}if(n!==-1&&e[t]==="["&&e[t+1]!=="]"){if(n<t){n=e.indexOf("]",t)}if(n>t){if(u===-1||u>n){return true}u=e.indexOf("\\",t);if(u===-1||u>n){return true}}}if(s!==-1&&e[t]==="{"&&e[t+1]!=="}"){s=e.indexOf("}",t);if(s>t){u=e.indexOf("\\",t);if(u===-1||u>s){return true}}}if(i!==-1&&e[t]==="("&&e[t+1]==="?"&&/[:!=]/.test(e[t+2])&&e[t+3]!==")"){i=e.indexOf(")",t);if(i>t){u=e.indexOf("\\",t);if(u===-1||u>i){return true}}}if(r!==-1&&e[t]==="("&&e[t+1]!=="|"){if(r<t){r=e.indexOf("|",t)}if(r!==-1&&e[r+1]!==")"){i=e.indexOf(")",r);if(i>r){u=e.indexOf("\\",r);if(u===-1||u>i){return true}}}}if(e[t]==="\\"){var a=e[t+1];t+=2;var c=o[a];if(c){var l=e.indexOf(c,t);if(l!==-1){t=l+1}}if(e[t]==="!"){return true}}else{t++}}return false};var relaxedCheck=function(e){if(e[0]==="!"){return true}var t=0;while(t<e.length){if(/[*?{}()[\]]/.test(e[t])){return true}if(e[t]==="\\"){var r=e[t+1];t+=2;var n=o[r];if(n){var s=e.indexOf(n,t);if(s!==-1){t=s+1}}if(e[t]==="!"){return true}}else{t++}}return false};e.exports=function isGlob(e,t){if(typeof e!=="string"||e===""){return false}if(n(e)){return true}var r=strictCheck;if(t&&t.strict===false){r=relaxedCheck}return r(e)}},8387:function(e){"use strict";
|
|
55
|
+
/*!
|
|
56
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
57
|
+
*
|
|
58
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
59
|
+
* Released under the MIT License.
|
|
60
|
+
*/e.exports=function(e){if(typeof e==="number"){return e-e===0}if(typeof e==="string"&&e.trim()!==""){return Number.isFinite?Number.isFinite(+e):isFinite(+e)}return false}},4273:function(e){"use strict";e.exports=e=>{if(Object.prototype.toString.call(e)!=="[object Object]"){return false}const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}},8627:function(e,t,r){"use strict";const n=r(3837);const o=r(1570);const s=r(376);const i=r(8658);const isEmptyString=e=>e===""||e==="./";const micromatch=(e,t,r)=>{t=[].concat(t);e=[].concat(e);let n=new Set;let o=new Set;let i=new Set;let u=0;let onResult=e=>{i.add(e.output);if(r&&r.onResult){r.onResult(e)}};for(let i=0;i<t.length;i++){let a=s(String(t[i]),{...r,onResult:onResult},true);let c=a.state.negated||a.state.negatedExtglob;if(c)u++;for(let t of e){let e=a(t,true);let r=c?!e.isMatch:e.isMatch;if(!r)continue;if(c){n.add(e.output)}else{n.delete(e.output);o.add(e.output)}}}let a=u===t.length?[...i]:[...o];let c=a.filter((e=>!n.has(e)));if(r&&c.length===0){if(r.failglob===true){throw new Error(`No matches found for "${t.join(", ")}"`)}if(r.nonull===true||r.nullglob===true){return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}}return c};micromatch.match=micromatch;micromatch.matcher=(e,t)=>s(e,t);micromatch.isMatch=(e,t,r)=>s(t,r)(e);micromatch.any=micromatch.isMatch;micromatch.not=(e,t,r={})=>{t=[].concat(t).map(String);let n=new Set;let o=[];let onResult=e=>{if(r.onResult)r.onResult(e);o.push(e.output)};let s=new Set(micromatch(e,t,{...r,onResult:onResult}));for(let e of o){if(!s.has(e)){n.add(e)}}return[...n]};micromatch.contains=(e,t,r)=>{if(typeof e!=="string"){throw new TypeError(`Expected a string: "${n.inspect(e)}"`)}if(Array.isArray(t)){return t.some((t=>micromatch.contains(e,t,r)))}if(typeof t==="string"){if(isEmptyString(e)||isEmptyString(t)){return false}if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t)){return true}}return micromatch.isMatch(e,t,{...r,contains:true})};micromatch.matchKeys=(e,t,r)=>{if(!i.isObject(e)){throw new TypeError("Expected the first argument to be an object")}let n=micromatch(Object.keys(e),t,r);let o={};for(let t of n)o[t]=e[t];return o};micromatch.some=(e,t,r)=>{let n=[].concat(e);for(let e of[].concat(t)){let t=s(String(e),r);if(n.some((e=>t(e)))){return true}}return false};micromatch.every=(e,t,r)=>{let n=[].concat(e);for(let e of[].concat(t)){let t=s(String(e),r);if(!n.every((e=>t(e)))){return false}}return true};micromatch.all=(e,t,r)=>{if(typeof e!=="string"){throw new TypeError(`Expected a string: "${n.inspect(e)}"`)}return[].concat(t).every((t=>s(t,r)(e)))};micromatch.capture=(e,t,r)=>{let n=i.isWindows(r);let o=s.makeRe(String(e),{...r,capture:true});let u=o.exec(n?i.toPosixSlashes(t):t);if(u){return u.slice(1).map((e=>e===void 0?"":e))}};micromatch.makeRe=(...e)=>s.makeRe(...e);micromatch.scan=(...e)=>s.scan(...e);micromatch.parse=(e,t)=>{let r=[];for(let n of[].concat(e||[])){for(let e of o(String(n),t)){r.push(s.parse(e,t))}}return r};micromatch.braces=(e,t)=>{if(typeof e!=="string")throw new TypeError("Expected a string");if(t&&t.nobrace===true||!/\{.*\}/.test(e)){return[e]}return o(e,t)};micromatch.braceExpand=(e,t)=>{if(typeof e!=="string")throw new TypeError("Expected a string");return micromatch.braces(e,{...t,expand:true})};e.exports=micromatch},376:function(e,t,r){"use strict";e.exports=r(7631)},7820:function(e,t,r){"use strict";const n=r(1017);const o="\\\\/";const s=`[^${o}]`;const i="\\.";const u="\\+";const a="\\?";const c="\\/";const l="(?=.)";const f="[^/]";const p=`(?:${c}|$)`;const h=`(?:^|${c})`;const d=`${i}{1,2}${p}`;const g=`(?!${i})`;const R=`(?!${h}${d})`;const y=`(?!${i}{0,1}${p})`;const _=`(?!${d})`;const v=`[^.${c}]`;const E=`${f}*?`;const x={DOT_LITERAL:i,PLUS_LITERAL:u,QMARK_LITERAL:a,SLASH_LITERAL:c,ONE_CHAR:l,QMARK:f,END_ANCHOR:p,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:R,NO_DOT_SLASH:y,NO_DOTS_SLASH:_,QMARK_NO_DOT:v,STAR:E,START_ANCHOR:h};const A={...x,SLASH_LITERAL:`[${o}]`,QMARK:s,STAR:`${s}*?`,DOTS_SLASH:`${i}{1,2}(?:[${o}]|$)`,NO_DOT:`(?!${i})`,NO_DOTS:`(?!(?:^|[${o}])${i}{1,2}(?:[${o}]|$))`,NO_DOT_SLASH:`(?!${i}{0,1}(?:[${o}]|$))`,NO_DOTS_SLASH:`(?!${i}{1,2}(?:[${o}]|$))`,QMARK_NO_DOT:`[^.${o}]`,START_ANCHOR:`(?:^|[${o}])`,END_ANCHOR:`(?:[${o}]|$)`};const m={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};e.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:m,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:n.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===true?A:x}}},6986:function(e,t,r){"use strict";const n=r(7820);const o=r(8658);const{MAX_LENGTH:s,POSIX_REGEX_SOURCE:i,REGEX_NON_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:c}=n;const expandRange=(e,t)=>{if(typeof t.expandRange==="function"){return t.expandRange(...e,t)}e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(t){return e.map((e=>o.escapeRegex(e))).join("..")}return r};const syntaxError=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`;const parse=(e,t)=>{if(typeof e!=="string"){throw new TypeError("Expected a string")}e=c[e]||e;const r={...t};const l=typeof r.maxLength==="number"?Math.min(s,r.maxLength):s;let f=e.length;if(f>l){throw new SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${l}`)}const p={type:"bos",value:"",output:r.prepend||""};const h=[p];const d=r.capture?"":"?:";const g=o.isWindows(t);const R=n.globChars(g);const y=n.extglobChars(R);const{DOT_LITERAL:_,PLUS_LITERAL:v,SLASH_LITERAL:E,ONE_CHAR:x,DOTS_SLASH:A,NO_DOT:m,NO_DOT_SLASH:b,NO_DOTS_SLASH:w,QMARK:C,QMARK_NO_DOT:S,STAR:H,START_ANCHOR:O}=R;const globstar=e=>`(${d}(?:(?!${O}${e.dot?A:_}).)*?)`;const T=r.dot?"":m;const P=r.dot?C:S;let L=r.bash===true?globstar(r):H;if(r.capture){L=`(${L})`}if(typeof r.noext==="boolean"){r.noextglob=r.noext}const $={input:e,index:-1,start:0,dot:r.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:h};e=o.removePrefix(e,$);f=e.length;const k=[];const N=[];const M=[];let I=p;let B;const eos=()=>$.index===f-1;const q=$.peek=(t=1)=>e[$.index+t];const j=$.advance=()=>e[++$.index]||"";const remaining=()=>e.slice($.index+1);const consume=(e="",t=0)=>{$.consumed+=e;$.index+=t};const append=e=>{$.output+=e.output!=null?e.output:e.value;consume(e.value)};const negate=()=>{let e=1;while(q()==="!"&&(q(2)!=="("||q(3)==="?")){j();$.start++;e++}if(e%2===0){return false}$.negated=true;$.start++;return true};const increment=e=>{$[e]++;M.push(e)};const decrement=e=>{$[e]--;M.pop()};const push=e=>{if(I.type==="globstar"){const t=$.braces>0&&(e.type==="comma"||e.type==="brace");const r=e.extglob===true||k.length&&(e.type==="pipe"||e.type==="paren");if(e.type!=="slash"&&e.type!=="paren"&&!t&&!r){$.output=$.output.slice(0,-I.output.length);I.type="star";I.value="*";I.output=L;$.output+=I.output}}if(k.length&&e.type!=="paren"){k[k.length-1].inner+=e.value}if(e.value||e.output)append(e);if(I&&I.type==="text"&&e.type==="text"){I.value+=e.value;I.output=(I.output||"")+e.value;return}e.prev=I;h.push(e);I=e};const extglobOpen=(e,t)=>{const n={...y[t],conditions:1,inner:""};n.prev=I;n.parens=$.parens;n.output=$.output;const o=(r.capture?"(":"")+n.open;increment("parens");push({type:e,value:t,output:$.output?"":x});push({type:"paren",extglob:true,value:j(),output:o});k.push(n)};const extglobClose=e=>{let n=e.close+(r.capture?")":"");let o;if(e.type==="negate"){let s=L;if(e.inner&&e.inner.length>1&&e.inner.includes("/")){s=globstar(r)}if(s!==L||eos()||/^\)+$/.test(remaining())){n=e.close=`)$))${s}`}if(e.inner.includes("*")&&(o=remaining())&&/^\.[^\\/.]+$/.test(o)){const r=parse(o,{...t,fastpaths:false}).output;n=e.close=`)${r})${s})`}if(e.prev.type==="bos"){$.negatedExtglob=true}}push({type:"paren",extglob:true,value:B,output:n});decrement("parens")};if(r.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=false;let s=e.replace(a,((e,t,r,o,s,i)=>{if(o==="\\"){n=true;return e}if(o==="?"){if(t){return t+o+(s?C.repeat(s.length):"")}if(i===0){return P+(s?C.repeat(s.length):"")}return C.repeat(r.length)}if(o==="."){return _.repeat(r.length)}if(o==="*"){if(t){return t+o+(s?L:"")}return L}return t?e:`\\${e}`}));if(n===true){if(r.unescape===true){s=s.replace(/\\/g,"")}else{s=s.replace(/\\+/g,(e=>e.length%2===0?"\\\\":e?"\\":""))}}if(s===e&&r.contains===true){$.output=e;return $}$.output=o.wrapOutput(s,$,t);return $}while(!eos()){B=j();if(B==="\0"){continue}if(B==="\\"){const e=q();if(e==="/"&&r.bash!==true){continue}if(e==="."||e===";"){continue}if(!e){B+="\\";push({type:"text",value:B});continue}const t=/^\\+/.exec(remaining());let n=0;if(t&&t[0].length>2){n=t[0].length;$.index+=n;if(n%2!==0){B+="\\"}}if(r.unescape===true){B=j()}else{B+=j()}if($.brackets===0){push({type:"text",value:B});continue}}if($.brackets>0&&(B!=="]"||I.value==="["||I.value==="[^")){if(r.posix!==false&&B===":"){const e=I.value.slice(1);if(e.includes("[")){I.posix=true;if(e.includes(":")){const e=I.value.lastIndexOf("[");const t=I.value.slice(0,e);const r=I.value.slice(e+2);const n=i[r];if(n){I.value=t+n;$.backtrack=true;j();if(!p.output&&h.indexOf(I)===1){p.output=x}continue}}}}if(B==="["&&q()!==":"||B==="-"&&q()==="]"){B=`\\${B}`}if(B==="]"&&(I.value==="["||I.value==="[^")){B=`\\${B}`}if(r.posix===true&&B==="!"&&I.value==="["){B="^"}I.value+=B;append({value:B});continue}if($.quotes===1&&B!=='"'){B=o.escapeRegex(B);I.value+=B;append({value:B});continue}if(B==='"'){$.quotes=$.quotes===1?0:1;if(r.keepQuotes===true){push({type:"text",value:B})}continue}if(B==="("){increment("parens");push({type:"paren",value:B});continue}if(B===")"){if($.parens===0&&r.strictBrackets===true){throw new SyntaxError(syntaxError("opening","("))}const e=k[k.length-1];if(e&&$.parens===e.parens+1){extglobClose(k.pop());continue}push({type:"paren",value:B,output:$.parens?")":"\\)"});decrement("parens");continue}if(B==="["){if(r.nobracket===true||!remaining().includes("]")){if(r.nobracket!==true&&r.strictBrackets===true){throw new SyntaxError(syntaxError("closing","]"))}B=`\\${B}`}else{increment("brackets")}push({type:"bracket",value:B});continue}if(B==="]"){if(r.nobracket===true||I&&I.type==="bracket"&&I.value.length===1){push({type:"text",value:B,output:`\\${B}`});continue}if($.brackets===0){if(r.strictBrackets===true){throw new SyntaxError(syntaxError("opening","["))}push({type:"text",value:B,output:`\\${B}`});continue}decrement("brackets");const e=I.value.slice(1);if(I.posix!==true&&e[0]==="^"&&!e.includes("/")){B=`/${B}`}I.value+=B;append({value:B});if(r.literalBrackets===false||o.hasRegexChars(e)){continue}const t=o.escapeRegex(I.value);$.output=$.output.slice(0,-I.value.length);if(r.literalBrackets===true){$.output+=t;I.value=t;continue}I.value=`(${d}${t}|${I.value})`;$.output+=I.value;continue}if(B==="{"&&r.nobrace!==true){increment("braces");const e={type:"brace",value:B,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};N.push(e);push(e);continue}if(B==="}"){const e=N[N.length-1];if(r.nobrace===true||!e){push({type:"text",value:B,output:B});continue}let t=")";if(e.dots===true){const e=h.slice();const n=[];for(let t=e.length-1;t>=0;t--){h.pop();if(e[t].type==="brace"){break}if(e[t].type!=="dots"){n.unshift(e[t].value)}}t=expandRange(n,r);$.backtrack=true}if(e.comma!==true&&e.dots!==true){const r=$.output.slice(0,e.outputIndex);const n=$.tokens.slice(e.tokensIndex);e.value=e.output="\\{";B=t="\\}";$.output=r;for(const e of n){$.output+=e.output||e.value}}push({type:"brace",value:B,output:t});decrement("braces");N.pop();continue}if(B==="|"){if(k.length>0){k[k.length-1].conditions++}push({type:"text",value:B});continue}if(B===","){let e=B;const t=N[N.length-1];if(t&&M[M.length-1]==="braces"){t.comma=true;e="|"}push({type:"comma",value:B,output:e});continue}if(B==="/"){if(I.type==="dot"&&$.index===$.start+1){$.start=$.index+1;$.consumed="";$.output="";h.pop();I=p;continue}push({type:"slash",value:B,output:E});continue}if(B==="."){if($.braces>0&&I.type==="dot"){if(I.value===".")I.output=_;const e=N[N.length-1];I.type="dots";I.output+=B;I.value+=B;e.dots=true;continue}if($.braces+$.parens===0&&I.type!=="bos"&&I.type!=="slash"){push({type:"text",value:B,output:_});continue}push({type:"dot",value:B,output:_});continue}if(B==="?"){const e=I&&I.value==="(";if(!e&&r.noextglob!==true&&q()==="("&&q(2)!=="?"){extglobOpen("qmark",B);continue}if(I&&I.type==="paren"){const e=q();let t=B;if(e==="<"&&!o.supportsLookbehinds()){throw new Error("Node.js v10 or higher is required for regex lookbehinds")}if(I.value==="("&&!/[!=<:]/.test(e)||e==="<"&&!/<([!=]|\w+>)/.test(remaining())){t=`\\${B}`}push({type:"text",value:B,output:t});continue}if(r.dot!==true&&(I.type==="slash"||I.type==="bos")){push({type:"qmark",value:B,output:S});continue}push({type:"qmark",value:B,output:C});continue}if(B==="!"){if(r.noextglob!==true&&q()==="("){if(q(2)!=="?"||!/[!=<:]/.test(q(3))){extglobOpen("negate",B);continue}}if(r.nonegate!==true&&$.index===0){negate();continue}}if(B==="+"){if(r.noextglob!==true&&q()==="("&&q(2)!=="?"){extglobOpen("plus",B);continue}if(I&&I.value==="("||r.regex===false){push({type:"plus",value:B,output:v});continue}if(I&&(I.type==="bracket"||I.type==="paren"||I.type==="brace")||$.parens>0){push({type:"plus",value:B});continue}push({type:"plus",value:v});continue}if(B==="@"){if(r.noextglob!==true&&q()==="("&&q(2)!=="?"){push({type:"at",extglob:true,value:B,output:""});continue}push({type:"text",value:B});continue}if(B!=="*"){if(B==="$"||B==="^"){B=`\\${B}`}const e=u.exec(remaining());if(e){B+=e[0];$.index+=e[0].length}push({type:"text",value:B});continue}if(I&&(I.type==="globstar"||I.star===true)){I.type="star";I.star=true;I.value+=B;I.output=L;$.backtrack=true;$.globstar=true;consume(B);continue}let t=remaining();if(r.noextglob!==true&&/^\([^?]/.test(t)){extglobOpen("star",B);continue}if(I.type==="star"){if(r.noglobstar===true){consume(B);continue}const n=I.prev;const o=n.prev;const s=n.type==="slash"||n.type==="bos";const i=o&&(o.type==="star"||o.type==="globstar");if(r.bash===true&&(!s||t[0]&&t[0]!=="/")){push({type:"star",value:B,output:""});continue}const u=$.braces>0&&(n.type==="comma"||n.type==="brace");const a=k.length&&(n.type==="pipe"||n.type==="paren");if(!s&&n.type!=="paren"&&!u&&!a){push({type:"star",value:B,output:""});continue}while(t.slice(0,3)==="/**"){const r=e[$.index+4];if(r&&r!=="/"){break}t=t.slice(3);consume("/**",3)}if(n.type==="bos"&&eos()){I.type="globstar";I.value+=B;I.output=globstar(r);$.output=I.output;$.globstar=true;consume(B);continue}if(n.type==="slash"&&n.prev.type!=="bos"&&!i&&eos()){$.output=$.output.slice(0,-(n.output+I.output).length);n.output=`(?:${n.output}`;I.type="globstar";I.output=globstar(r)+(r.strictSlashes?")":"|$)");I.value+=B;$.globstar=true;$.output+=n.output+I.output;consume(B);continue}if(n.type==="slash"&&n.prev.type!=="bos"&&t[0]==="/"){const e=t[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(n.output+I.output).length);n.output=`(?:${n.output}`;I.type="globstar";I.output=`${globstar(r)}${E}|${E}${e})`;I.value+=B;$.output+=n.output+I.output;$.globstar=true;consume(B+j());push({type:"slash",value:"/",output:""});continue}if(n.type==="bos"&&t[0]==="/"){I.type="globstar";I.value+=B;I.output=`(?:^|${E}|${globstar(r)}${E})`;$.output=I.output;$.globstar=true;consume(B+j());push({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-I.output.length);I.type="globstar";I.output=globstar(r);I.value+=B;$.output+=I.output;$.globstar=true;consume(B);continue}const n={type:"star",value:B,output:L};if(r.bash===true){n.output=".*?";if(I.type==="bos"||I.type==="slash"){n.output=T+n.output}push(n);continue}if(I&&(I.type==="bracket"||I.type==="paren")&&r.regex===true){n.output=B;push(n);continue}if($.index===$.start||I.type==="slash"||I.type==="dot"){if(I.type==="dot"){$.output+=b;I.output+=b}else if(r.dot===true){$.output+=w;I.output+=w}else{$.output+=T;I.output+=T}if(q()!=="*"){$.output+=x;I.output+=x}}push(n)}while($.brackets>0){if(r.strictBrackets===true)throw new SyntaxError(syntaxError("closing","]"));$.output=o.escapeLast($.output,"[");decrement("brackets")}while($.parens>0){if(r.strictBrackets===true)throw new SyntaxError(syntaxError("closing",")"));$.output=o.escapeLast($.output,"(");decrement("parens")}while($.braces>0){if(r.strictBrackets===true)throw new SyntaxError(syntaxError("closing","}"));$.output=o.escapeLast($.output,"{");decrement("braces")}if(r.strictSlashes!==true&&(I.type==="star"||I.type==="bracket")){push({type:"maybe_slash",value:"",output:`${E}?`})}if($.backtrack===true){$.output="";for(const e of $.tokens){$.output+=e.output!=null?e.output:e.value;if(e.suffix){$.output+=e.suffix}}}return $};parse.fastpaths=(e,t)=>{const r={...t};const i=typeof r.maxLength==="number"?Math.min(s,r.maxLength):s;const u=e.length;if(u>i){throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`)}e=c[e]||e;const a=o.isWindows(t);const{DOT_LITERAL:l,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:h,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:R,STAR:y,START_ANCHOR:_}=n.globChars(a);const v=r.dot?g:d;const E=r.dot?R:d;const x=r.capture?"":"?:";const A={negated:false,prefix:""};let m=r.bash===true?".*?":y;if(r.capture){m=`(${m})`}const globstar=e=>{if(e.noglobstar===true)return m;return`(${x}(?:(?!${_}${e.dot?h:l}).)*?)`};const create=e=>{switch(e){case"*":return`${v}${p}${m}`;case".*":return`${l}${p}${m}`;case"*.*":return`${v}${m}${l}${p}${m}`;case"*/*":return`${v}${m}${f}${p}${E}${m}`;case"**":return v+globstar(r);case"**/*":return`(?:${v}${globstar(r)}${f})?${E}${p}${m}`;case"**/*.*":return`(?:${v}${globstar(r)}${f})?${E}${m}${l}${p}${m}`;case"**/.*":return`(?:${v}${globstar(r)}${f})?${l}${p}${m}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=create(t[1]);if(!r)return;return r+l+t[2]}}};const b=o.removePrefix(e,A);let w=create(b);if(w&&r.strictSlashes!==true){w+=`${f}?`}return w};e.exports=parse},7631:function(e,t,r){"use strict";const n=r(1017);const o=r(8640);const s=r(6986);const i=r(8658);const u=r(7820);const isObject=e=>e&&typeof e==="object"&&!Array.isArray(e);const picomatch=(e,t,r=false)=>{if(Array.isArray(e)){const n=e.map((e=>picomatch(e,t,r)));const arrayMatcher=e=>{for(const t of n){const r=t(e);if(r)return r}return false};return arrayMatcher}const n=isObject(e)&&e.tokens&&e.input;if(e===""||typeof e!=="string"&&!n){throw new TypeError("Expected pattern to be a non-empty string")}const o=t||{};const s=i.isWindows(t);const u=n?picomatch.compileRe(e,t):picomatch.makeRe(e,t,false,true);const a=u.state;delete u.state;let isIgnored=()=>false;if(o.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};isIgnored=picomatch(o.ignore,e,r)}const matcher=(r,n=false)=>{const{isMatch:i,match:c,output:l}=picomatch.test(r,u,t,{glob:e,posix:s});const f={glob:e,state:a,regex:u,posix:s,input:r,output:l,match:c,isMatch:i};if(typeof o.onResult==="function"){o.onResult(f)}if(i===false){f.isMatch=false;return n?f:false}if(isIgnored(r)){if(typeof o.onIgnore==="function"){o.onIgnore(f)}f.isMatch=false;return n?f:false}if(typeof o.onMatch==="function"){o.onMatch(f)}return n?f:true};if(r){matcher.state=a}return matcher};picomatch.test=(e,t,r,{glob:n,posix:o}={})=>{if(typeof e!=="string"){throw new TypeError("Expected input to be a string")}if(e===""){return{isMatch:false,output:""}}const s=r||{};const u=s.format||(o?i.toPosixSlashes:null);let a=e===n;let c=a&&u?u(e):e;if(a===false){c=u?u(e):e;a=c===n}if(a===false||s.capture===true){if(s.matchBase===true||s.basename===true){a=picomatch.matchBase(e,t,r,o)}else{a=t.exec(c)}}return{isMatch:Boolean(a),match:a,output:c}};picomatch.matchBase=(e,t,r,o=i.isWindows(r))=>{const s=t instanceof RegExp?t:picomatch.makeRe(t,r);return s.test(n.basename(e))};picomatch.isMatch=(e,t,r)=>picomatch(t,r)(e);picomatch.parse=(e,t)=>{if(Array.isArray(e))return e.map((e=>picomatch.parse(e,t)));return s(e,{...t,fastpaths:false})};picomatch.scan=(e,t)=>o(e,t);picomatch.compileRe=(e,t,r=false,n=false)=>{if(r===true){return e.output}const o=t||{};const s=o.contains?"":"^";const i=o.contains?"":"$";let u=`${s}(?:${e.output})${i}`;if(e&&e.negated===true){u=`^(?!${u}).*$`}const a=picomatch.toRegex(u,t);if(n===true){a.state=e}return a};picomatch.makeRe=(e,t={},r=false,n=false)=>{if(!e||typeof e!=="string"){throw new TypeError("Expected a non-empty string")}let o={negated:false,fastpaths:true};if(t.fastpaths!==false&&(e[0]==="."||e[0]==="*")){o.output=s.fastpaths(e,t)}if(!o.output){o=s(e,t)}return picomatch.compileRe(o,t,r,n)};picomatch.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&t.debug===true)throw e;return/$^/}};picomatch.constants=u;e.exports=picomatch},8640:function(e,t,r){"use strict";const n=r(8658);const{CHAR_ASTERISK:o,CHAR_AT:s,CHAR_BACKWARD_SLASH:i,CHAR_COMMA:u,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:f,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:h,CHAR_PLUS:d,CHAR_QUESTION_MARK:g,CHAR_RIGHT_CURLY_BRACE:R,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:_}=r(7820);const isPathSeparator=e=>e===l||e===i;const depth=e=>{if(e.isPrefix!==true){e.depth=e.isGlobstar?Infinity:1}};const scan=(e,t)=>{const r=t||{};const v=e.length-1;const E=r.parts===true||r.scanToEnd===true;const x=[];const A=[];const m=[];let b=e;let w=-1;let C=0;let S=0;let H=false;let O=false;let T=false;let P=false;let L=false;let $=false;let k=false;let N=false;let M=false;let I=false;let B=0;let q;let j;let G={value:"",depth:0,isGlob:false};const eos=()=>w>=v;const peek=()=>b.charCodeAt(w+1);const advance=()=>{q=j;return b.charCodeAt(++w)};while(w<v){j=advance();let e;if(j===i){k=G.backslashes=true;j=advance();if(j===f){$=true}continue}if($===true||j===f){B++;while(eos()!==true&&(j=advance())){if(j===i){k=G.backslashes=true;advance();continue}if(j===f){B++;continue}if($!==true&&j===a&&(j=advance())===a){H=G.isBrace=true;T=G.isGlob=true;I=true;if(E===true){continue}break}if($!==true&&j===u){H=G.isBrace=true;T=G.isGlob=true;I=true;if(E===true){continue}break}if(j===R){B--;if(B===0){$=false;H=G.isBrace=true;I=true;break}}}if(E===true){continue}break}if(j===l){x.push(w);A.push(G);G={value:"",depth:0,isGlob:false};if(I===true)continue;if(q===a&&w===C+1){C+=2;continue}S=w+1;continue}if(r.noext!==true){const e=j===d||j===s||j===o||j===g||j===c;if(e===true&&peek()===p){T=G.isGlob=true;P=G.isExtglob=true;I=true;if(j===c&&w===C){M=true}if(E===true){while(eos()!==true&&(j=advance())){if(j===i){k=G.backslashes=true;j=advance();continue}if(j===y){T=G.isGlob=true;I=true;break}}continue}break}}if(j===o){if(q===o)L=G.isGlobstar=true;T=G.isGlob=true;I=true;if(E===true){continue}break}if(j===g){T=G.isGlob=true;I=true;if(E===true){continue}break}if(j===h){while(eos()!==true&&(e=advance())){if(e===i){k=G.backslashes=true;advance();continue}if(e===_){O=G.isBracket=true;T=G.isGlob=true;I=true;break}}if(E===true){continue}break}if(r.nonegate!==true&&j===c&&w===C){N=G.negated=true;C++;continue}if(r.noparen!==true&&j===p){T=G.isGlob=true;if(E===true){while(eos()!==true&&(j=advance())){if(j===p){k=G.backslashes=true;j=advance();continue}if(j===y){I=true;break}}continue}break}if(T===true){I=true;if(E===true){continue}break}}if(r.noext===true){P=false;T=false}let U=b;let D="";let K="";if(C>0){D=b.slice(0,C);b=b.slice(C);S-=C}if(U&&T===true&&S>0){U=b.slice(0,S);K=b.slice(S)}else if(T===true){U="";K=b}else{U=b}if(U&&U!==""&&U!=="/"&&U!==b){if(isPathSeparator(U.charCodeAt(U.length-1))){U=U.slice(0,-1)}}if(r.unescape===true){if(K)K=n.removeBackslashes(K);if(U&&k===true){U=n.removeBackslashes(U)}}const F={prefix:D,input:e,start:C,base:U,glob:K,isBrace:H,isBracket:O,isGlob:T,isExtglob:P,isGlobstar:L,negated:N,negatedExtglob:M};if(r.tokens===true){F.maxDepth=0;if(!isPathSeparator(j)){A.push(G)}F.tokens=A}if(r.parts===true||r.tokens===true){let t;for(let n=0;n<x.length;n++){const o=t?t+1:C;const s=x[n];const i=e.slice(o,s);if(r.tokens){if(n===0&&C!==0){A[n].isPrefix=true;A[n].value=D}else{A[n].value=i}depth(A[n]);F.maxDepth+=A[n].depth}if(n!==0||i!==""){m.push(i)}t=s}if(t&&t+1<e.length){const n=e.slice(t+1);m.push(n);if(r.tokens){A[A.length-1].value=n;depth(A[A.length-1]);F.maxDepth+=A[A.length-1].depth}}F.slashes=x;F.parts=m}return F};e.exports=scan},8658:function(e,t,r){"use strict";const n=r(1017);const o=process.platform==="win32";const{REGEX_BACKSLASH:s,REGEX_REMOVE_BACKSLASH:i,REGEX_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_GLOBAL:a}=r(7820);t.isObject=e=>e!==null&&typeof e==="object"&&!Array.isArray(e);t.hasRegexChars=e=>u.test(e);t.isRegexChar=e=>e.length===1&&t.hasRegexChars(e);t.escapeRegex=e=>e.replace(a,"\\$1");t.toPosixSlashes=e=>e.replace(s,"/");t.removeBackslashes=e=>e.replace(i,(e=>e==="\\"?"":e));t.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);if(e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10){return true}return false};t.isWindows=e=>{if(e&&typeof e.windows==="boolean"){return e.windows}return o===true||n.sep==="\\"};t.escapeLast=(e,r,n)=>{const o=e.lastIndexOf(r,n);if(o===-1)return e;if(e[o-1]==="\\")return t.escapeLast(e,r,o-1);return`${e.slice(0,o)}\\${e.slice(o)}`};t.removePrefix=(e,t={})=>{let r=e;if(r.startsWith("./")){r=r.slice(2);t.prefix="./"}return r};t.wrapOutput=(e,t={},r={})=>{const n=r.contains?"":"^";const o=r.contains?"":"$";let s=`${n}(?:${e})${o}`;if(t.negated===true){s=`(?:^(?!${s}).*$)`}return s}},926:function(e){"use strict";e.exports=function required(e,t){t=t.split(":")[0];e=+e;if(!e)return false;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return false}return e!==0}},211:function(e,t,r){"use strict";
|
|
61
|
+
/*!
|
|
62
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
63
|
+
*
|
|
64
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
65
|
+
* Released under the MIT License.
|
|
66
|
+
*/const n=r(8387);const toRegexRange=(e,t,r)=>{if(n(e)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(t===void 0||e===t){return String(e)}if(n(t)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let o={relaxZeros:true,...r};if(typeof o.strictZeros==="boolean"){o.relaxZeros=o.strictZeros===false}let s=String(o.relaxZeros);let i=String(o.shorthand);let u=String(o.capture);let a=String(o.wrap);let c=e+":"+t+"="+s+i+u+a;if(toRegexRange.cache.hasOwnProperty(c)){return toRegexRange.cache[c].result}let l=Math.min(e,t);let f=Math.max(e,t);if(Math.abs(l-f)===1){let r=e+"|"+t;if(o.capture){return`(${r})`}if(o.wrap===false){return r}return`(?:${r})`}let p=hasPadding(e)||hasPadding(t);let h={min:e,max:t,a:l,b:f};let d=[];let g=[];if(p){h.isPadded=p;h.maxLen=String(h.max).length}if(l<0){let e=f<0?Math.abs(f):1;g=splitToPatterns(e,Math.abs(l),h,o);l=h.a=0}if(f>=0){d=splitToPatterns(l,f,h,o)}h.negatives=g;h.positives=d;h.result=collatePatterns(g,d,o);if(o.capture===true){h.result=`(${h.result})`}else if(o.wrap!==false&&d.length+g.length>1){h.result=`(?:${h.result})`}toRegexRange.cache[c]=h;return h.result};function collatePatterns(e,t,r){let n=filterPatterns(e,t,"-",false,r)||[];let o=filterPatterns(t,e,"",false,r)||[];let s=filterPatterns(e,t,"-?",true,r)||[];let i=n.concat(s).concat(o);return i.join("|")}function splitToRanges(e,t){let r=1;let n=1;let o=countNines(e,r);let s=new Set([t]);while(e<=o&&o<=t){s.add(o);r+=1;o=countNines(e,r)}o=countZeros(t+1,n)-1;while(e<o&&o<=t){s.add(o);n+=1;o=countZeros(t+1,n)-1}s=[...s];s.sort(compare);return s}function rangeToPattern(e,t,r){if(e===t){return{pattern:e,count:[],digits:0}}let n=zip(e,t);let o=n.length;let s="";let i=0;for(let e=0;e<o;e++){let[t,o]=n[e];if(t===o){s+=t}else if(t!=="0"||o!=="9"){s+=toCharacterClass(t,o,r)}else{i++}}if(i){s+=r.shorthand===true?"\\d":"[0-9]"}return{pattern:s,count:[i],digits:o}}function splitToPatterns(e,t,r,n){let o=splitToRanges(e,t);let s=[];let i=e;let u;for(let e=0;e<o.length;e++){let t=o[e];let a=rangeToPattern(String(i),String(t),n);let c="";if(!r.isPadded&&u&&u.pattern===a.pattern){if(u.count.length>1){u.count.pop()}u.count.push(a.count[0]);u.string=u.pattern+toQuantifier(u.count);i=t+1;continue}if(r.isPadded){c=padZeros(t,r,n)}a.string=c+a.pattern+toQuantifier(a.count);s.push(a);i=t+1;u=a}return s}function filterPatterns(e,t,r,n,o){let s=[];for(let o of e){let{string:e}=o;if(!n&&!contains(t,"string",e)){s.push(r+e)}if(n&&contains(t,"string",e)){s.push(r+e)}}return s}function zip(e,t){let r=[];for(let n=0;n<e.length;n++)r.push([e[n],t[n]]);return r}function compare(e,t){return e>t?1:t>e?-1:0}function contains(e,t,r){return e.some((e=>e[t]===r))}function countNines(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function countZeros(e,t){return e-e%Math.pow(10,t)}function toQuantifier(e){let[t=0,r=""]=e;if(r||t>1){return`{${t+(r?","+r:"")}}`}return""}function toCharacterClass(e,t,r){return`[${e}${t-e===1?"":"-"}${t}]`}function hasPadding(e){return/^-?(0+)\d/.test(e)}function padZeros(e,t,r){if(!t.isPadded){return e}let n=Math.abs(t.maxLen-String(e).length);let o=r.relaxZeros!==false;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:{return o?`0{0,${n}}`:`0{${n}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};e.exports=toRegexRange},4755:function(e){"use strict";e.exports=require("@umijs/utils/compiled/debug")},9491:function(e){"use strict";e.exports=require("assert")},3685:function(e){"use strict";e.exports=require("http")},5687:function(e){"use strict";e.exports=require("https")},1017:function(e){"use strict";e.exports=require("path")},3477:function(e){"use strict";e.exports=require("querystring")},2781:function(e){"use strict";e.exports=require("stream")},7310:function(e){"use strict";e.exports=require("url")},3837:function(e){"use strict";e.exports=require("util")},9796:function(e){"use strict";e.exports=require("zlib")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var s=true;try{e[r].call(o.exports,o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(7666);module.exports=r})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"http-proxy-middleware","version":"2.0.4","author":"Steven Chim","license":"MIT","types":"dist/index.d.ts"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var import_utils = require("@umijs/utils");
|
|
|
32
32
|
var import_path = require("path");
|
|
33
33
|
__reExport(src_exports, require("./https"), module.exports);
|
|
34
34
|
__reExport(src_exports, require("./types"), module.exports);
|
|
35
|
+
__reExport(src_exports, require("./proxy"), module.exports);
|
|
35
36
|
async function parseModule(opts) {
|
|
36
37
|
await import_es_module_lexer.init;
|
|
37
38
|
return parseModuleSync(opts);
|
package/dist/proxy.d.ts
ADDED
package/dist/proxy.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/proxy.ts
|
|
23
|
+
var proxy_exports = {};
|
|
24
|
+
__export(proxy_exports, {
|
|
25
|
+
createProxy: () => createProxy
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(proxy_exports);
|
|
28
|
+
var import_http_proxy_middleware = require("../compiled/http-proxy-middleware");
|
|
29
|
+
var import_assert = __toESM(require("assert"));
|
|
30
|
+
function createProxy(proxy, app) {
|
|
31
|
+
const proxyArr = Array.isArray(proxy) ? proxy : proxy.target ? [proxy] : Object.keys(proxy).map((key) => {
|
|
32
|
+
return {
|
|
33
|
+
...proxy[key],
|
|
34
|
+
context: key
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
proxyArr.forEach((proxy2) => {
|
|
38
|
+
let middleware;
|
|
39
|
+
if (proxy2.target) {
|
|
40
|
+
(0, import_assert.default)(typeof proxy2.target === "string", "proxy.target must be string");
|
|
41
|
+
(0, import_assert.default)(proxy2.context, "proxy.context must be supplied");
|
|
42
|
+
middleware = (0, import_http_proxy_middleware.createProxyMiddleware)(proxy2.context, {
|
|
43
|
+
...proxy2,
|
|
44
|
+
onProxyReq(proxyReq, req, res) {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
if (proxyReq.getHeader("origin")) {
|
|
47
|
+
proxyReq.setHeader("origin", ((_a = new URL(proxy2.target)) == null ? void 0 : _a.href) || "");
|
|
48
|
+
}
|
|
49
|
+
(_b = proxy2.onProxyReq) == null ? void 0 : _b.call(proxy2, proxyReq, req, res, proxy2);
|
|
50
|
+
},
|
|
51
|
+
onProxyRes(proxyRes, req, res) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
proxyRes.headers["x-real-url"] = ((_a = new URL(req.url || "", proxy2.target)) == null ? void 0 : _a.href) || "";
|
|
54
|
+
(_b = proxy2.onProxyRes) == null ? void 0 : _b.call(proxy2, proxyRes, req, res);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
app.use((req, res, next) => {
|
|
59
|
+
const bypassUrl = typeof proxy2.bypass === "function" ? proxy2.bypass(req, res, proxy2) : null;
|
|
60
|
+
if (typeof bypassUrl === "string") {
|
|
61
|
+
req.url = bypassUrl;
|
|
62
|
+
return next();
|
|
63
|
+
} else if (bypassUrl === false) {
|
|
64
|
+
return res.end(404);
|
|
65
|
+
} else if ((bypassUrl === null || bypassUrl === void 0) && middleware) {
|
|
66
|
+
return middleware(req, res, next);
|
|
67
|
+
} else {
|
|
68
|
+
next();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
createProxy
|
|
76
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import type { Options as HPMOptions } from '../compiled/http-proxy-middleware';
|
|
1
2
|
export interface HttpsServerOptions {
|
|
2
3
|
key?: string;
|
|
3
4
|
cert?: string;
|
|
4
5
|
hosts?: string[];
|
|
5
6
|
}
|
|
7
|
+
declare type HPMFnArgs = Parameters<NonNullable<HPMOptions['onProxyReq']>>;
|
|
8
|
+
export interface ProxyOptions extends HPMOptions {
|
|
9
|
+
target?: string;
|
|
10
|
+
context?: string | string[];
|
|
11
|
+
bypass?: (...args: [HPMFnArgs[1], HPMFnArgs[2], HPMFnArgs[3]]) => string | boolean | null | void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.19",
|
|
4
4
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-utils#readme",
|
|
5
5
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dev": "umi-scripts father dev"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@umijs/utils": "4.0.
|
|
23
|
+
"@umijs/utils": "4.0.19",
|
|
24
24
|
"esbuild": "0.14.49",
|
|
25
25
|
"regenerate": "^1.4.2",
|
|
26
26
|
"regenerate-unicode-properties": "10.0.1",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"cjs-module-lexer": "1.2.2",
|
|
60
60
|
"es-module-lexer": "0.10.5",
|
|
61
61
|
"express": "4.18.1",
|
|
62
|
+
"http-proxy-middleware": "2.0.4",
|
|
62
63
|
"less": "4.1.2",
|
|
63
64
|
"tapable": "2.2.1"
|
|
64
65
|
},
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"express",
|
|
77
78
|
"less",
|
|
78
79
|
"tapable",
|
|
80
|
+
"http-proxy-middleware",
|
|
79
81
|
"./bundles/babel/bundle"
|
|
80
82
|
],
|
|
81
83
|
"externals": {
|