@rspack/dev-server 2.0.0-beta.7 → 2.0.0-rc.1
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/client/overlay.d.ts +4 -1
- package/dist/0~connect-history-api-fallback.js +76 -0
- package/dist/0~debug.js +621 -0
- package/dist/0~http-proxy-middleware.js +4447 -0
- package/dist/0~http-proxy-middleware.js.LICENSE.txt +69 -0
- package/dist/0~launch-editor.js +17 -35
- package/dist/0~serve-static.js +1595 -0
- package/dist/0~serve-static.js.LICENSE.txt +108 -0
- package/dist/621.js +2653 -0
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1467
- package/dist/server.d.ts +4 -3
- package/dist/servers/BaseServer.d.ts +2 -2
- package/dist/servers/WebsocketServer.d.ts +2 -2
- package/dist/types.d.ts +8 -8
- package/package.json +23 -22
- package/dist/rslib-runtime.js +0 -75
|
@@ -0,0 +1,4447 @@
|
|
|
1
|
+
/*! LICENSE: 0~http-proxy-middleware.js.LICENSE.txt */
|
|
2
|
+
import { __webpack_require__ } from "./621.js";
|
|
3
|
+
import "./621.js";
|
|
4
|
+
import "./0~debug.js";
|
|
5
|
+
__webpack_require__.add({
|
|
6
|
+
"./node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
7
|
+
const stringify = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js");
|
|
8
|
+
const compile = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js");
|
|
9
|
+
const expand = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js");
|
|
10
|
+
const parse = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js");
|
|
11
|
+
const braces = (input, options = {})=>{
|
|
12
|
+
let output = [];
|
|
13
|
+
if (Array.isArray(input)) for (const pattern of input){
|
|
14
|
+
const result = braces.create(pattern, options);
|
|
15
|
+
if (Array.isArray(result)) output.push(...result);
|
|
16
|
+
else output.push(result);
|
|
17
|
+
}
|
|
18
|
+
else output = [].concat(braces.create(input, options));
|
|
19
|
+
if (options && true === options.expand && true === options.nodupes) output = [
|
|
20
|
+
...new Set(output)
|
|
21
|
+
];
|
|
22
|
+
return output;
|
|
23
|
+
};
|
|
24
|
+
braces.parse = (input, options = {})=>parse(input, options);
|
|
25
|
+
braces.stringify = (input, options = {})=>{
|
|
26
|
+
if ('string' == typeof input) return stringify(braces.parse(input, options), options);
|
|
27
|
+
return stringify(input, options);
|
|
28
|
+
};
|
|
29
|
+
braces.compile = (input, options = {})=>{
|
|
30
|
+
if ('string' == typeof input) input = braces.parse(input, options);
|
|
31
|
+
return compile(input, options);
|
|
32
|
+
};
|
|
33
|
+
braces.expand = (input, options = {})=>{
|
|
34
|
+
if ('string' == typeof input) input = braces.parse(input, options);
|
|
35
|
+
let result = expand(input, options);
|
|
36
|
+
if (true === options.noempty) result = result.filter(Boolean);
|
|
37
|
+
if (true === options.nodupes) result = [
|
|
38
|
+
...new Set(result)
|
|
39
|
+
];
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
braces.create = (input, options = {})=>{
|
|
43
|
+
if ('' === input || input.length < 3) return [
|
|
44
|
+
input
|
|
45
|
+
];
|
|
46
|
+
return true !== options.expand ? braces.compile(input, options) : braces.expand(input, options);
|
|
47
|
+
};
|
|
48
|
+
module.exports = braces;
|
|
49
|
+
},
|
|
50
|
+
"./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
51
|
+
const fill = __webpack_require__("./node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js");
|
|
52
|
+
const utils = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
|
|
53
|
+
const compile = (ast, options = {})=>{
|
|
54
|
+
const walk = (node, parent = {})=>{
|
|
55
|
+
const invalidBlock = utils.isInvalidBrace(parent);
|
|
56
|
+
const invalidNode = true === node.invalid && true === options.escapeInvalid;
|
|
57
|
+
const invalid = true === invalidBlock || true === invalidNode;
|
|
58
|
+
const prefix = true === options.escapeInvalid ? '\\' : '';
|
|
59
|
+
let output = '';
|
|
60
|
+
if (true === node.isOpen) return prefix + node.value;
|
|
61
|
+
if (true === node.isClose) {
|
|
62
|
+
console.log('node.isClose', prefix, node.value);
|
|
63
|
+
return prefix + node.value;
|
|
64
|
+
}
|
|
65
|
+
if ('open' === node.type) return invalid ? prefix + node.value : '(';
|
|
66
|
+
if ('close' === node.type) return invalid ? prefix + node.value : ')';
|
|
67
|
+
if ('comma' === node.type) return 'comma' === node.prev.type ? '' : invalid ? node.value : '|';
|
|
68
|
+
if (node.value) return node.value;
|
|
69
|
+
if (node.nodes && node.ranges > 0) {
|
|
70
|
+
const args = utils.reduce(node.nodes);
|
|
71
|
+
const range = fill(...args, {
|
|
72
|
+
...options,
|
|
73
|
+
wrap: false,
|
|
74
|
+
toRegex: true,
|
|
75
|
+
strictZeros: true
|
|
76
|
+
});
|
|
77
|
+
if (0 !== range.length) return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
78
|
+
}
|
|
79
|
+
if (node.nodes) for (const child of node.nodes)output += walk(child, node);
|
|
80
|
+
return output;
|
|
81
|
+
};
|
|
82
|
+
return walk(ast);
|
|
83
|
+
};
|
|
84
|
+
module.exports = compile;
|
|
85
|
+
},
|
|
86
|
+
"./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js" (module) {
|
|
87
|
+
module.exports = {
|
|
88
|
+
MAX_LENGTH: 10000,
|
|
89
|
+
CHAR_0: '0',
|
|
90
|
+
CHAR_9: '9',
|
|
91
|
+
CHAR_UPPERCASE_A: 'A',
|
|
92
|
+
CHAR_LOWERCASE_A: 'a',
|
|
93
|
+
CHAR_UPPERCASE_Z: 'Z',
|
|
94
|
+
CHAR_LOWERCASE_Z: 'z',
|
|
95
|
+
CHAR_LEFT_PARENTHESES: '(',
|
|
96
|
+
CHAR_RIGHT_PARENTHESES: ')',
|
|
97
|
+
CHAR_ASTERISK: '*',
|
|
98
|
+
CHAR_AMPERSAND: '&',
|
|
99
|
+
CHAR_AT: '@',
|
|
100
|
+
CHAR_BACKSLASH: '\\',
|
|
101
|
+
CHAR_BACKTICK: '`',
|
|
102
|
+
CHAR_CARRIAGE_RETURN: '\r',
|
|
103
|
+
CHAR_CIRCUMFLEX_ACCENT: '^',
|
|
104
|
+
CHAR_COLON: ':',
|
|
105
|
+
CHAR_COMMA: ',',
|
|
106
|
+
CHAR_DOLLAR: '$',
|
|
107
|
+
CHAR_DOT: '.',
|
|
108
|
+
CHAR_DOUBLE_QUOTE: '"',
|
|
109
|
+
CHAR_EQUAL: '=',
|
|
110
|
+
CHAR_EXCLAMATION_MARK: '!',
|
|
111
|
+
CHAR_FORM_FEED: '\f',
|
|
112
|
+
CHAR_FORWARD_SLASH: '/',
|
|
113
|
+
CHAR_HASH: '#',
|
|
114
|
+
CHAR_HYPHEN_MINUS: '-',
|
|
115
|
+
CHAR_LEFT_ANGLE_BRACKET: '<',
|
|
116
|
+
CHAR_LEFT_CURLY_BRACE: '{',
|
|
117
|
+
CHAR_LEFT_SQUARE_BRACKET: '[',
|
|
118
|
+
CHAR_LINE_FEED: '\n',
|
|
119
|
+
CHAR_NO_BREAK_SPACE: '\u00A0',
|
|
120
|
+
CHAR_PERCENT: '%',
|
|
121
|
+
CHAR_PLUS: '+',
|
|
122
|
+
CHAR_QUESTION_MARK: '?',
|
|
123
|
+
CHAR_RIGHT_ANGLE_BRACKET: '>',
|
|
124
|
+
CHAR_RIGHT_CURLY_BRACE: '}',
|
|
125
|
+
CHAR_RIGHT_SQUARE_BRACKET: ']',
|
|
126
|
+
CHAR_SEMICOLON: ';',
|
|
127
|
+
CHAR_SINGLE_QUOTE: '\'',
|
|
128
|
+
CHAR_SPACE: ' ',
|
|
129
|
+
CHAR_TAB: '\t',
|
|
130
|
+
CHAR_UNDERSCORE: '_',
|
|
131
|
+
CHAR_VERTICAL_LINE: '|',
|
|
132
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF'
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
"./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
136
|
+
const fill = __webpack_require__("./node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js");
|
|
137
|
+
const stringify = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js");
|
|
138
|
+
const utils = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
|
|
139
|
+
const append = (queue = '', stash = '', enclose = false)=>{
|
|
140
|
+
const result = [];
|
|
141
|
+
queue = [].concat(queue);
|
|
142
|
+
stash = [].concat(stash);
|
|
143
|
+
if (!stash.length) return queue;
|
|
144
|
+
if (!queue.length) return enclose ? utils.flatten(stash).map((ele)=>`{${ele}}`) : stash;
|
|
145
|
+
for (const item of queue)if (Array.isArray(item)) for (const value of item)result.push(append(value, stash, enclose));
|
|
146
|
+
else for (let ele of stash){
|
|
147
|
+
if (true === enclose && 'string' == typeof ele) ele = `{${ele}}`;
|
|
148
|
+
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
149
|
+
}
|
|
150
|
+
return utils.flatten(result);
|
|
151
|
+
};
|
|
152
|
+
const expand = (ast, options = {})=>{
|
|
153
|
+
const rangeLimit = void 0 === options.rangeLimit ? 1000 : options.rangeLimit;
|
|
154
|
+
const walk = (node, parent = {})=>{
|
|
155
|
+
node.queue = [];
|
|
156
|
+
let p = parent;
|
|
157
|
+
let q = parent.queue;
|
|
158
|
+
while('brace' !== p.type && 'root' !== p.type && p.parent){
|
|
159
|
+
p = p.parent;
|
|
160
|
+
q = p.queue;
|
|
161
|
+
}
|
|
162
|
+
if (node.invalid || node.dollar) return void q.push(append(q.pop(), stringify(node, options)));
|
|
163
|
+
if ('brace' === node.type && true !== node.invalid && 2 === node.nodes.length) return void q.push(append(q.pop(), [
|
|
164
|
+
'{}'
|
|
165
|
+
]));
|
|
166
|
+
if (node.nodes && node.ranges > 0) {
|
|
167
|
+
const args = utils.reduce(node.nodes);
|
|
168
|
+
if (utils.exceedsLimit(...args, options.step, rangeLimit)) throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
|
|
169
|
+
let range = fill(...args, options);
|
|
170
|
+
if (0 === range.length) range = stringify(node, options);
|
|
171
|
+
q.push(append(q.pop(), range));
|
|
172
|
+
node.nodes = [];
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const enclose = utils.encloseBrace(node);
|
|
176
|
+
let queue = node.queue;
|
|
177
|
+
let block = node;
|
|
178
|
+
while('brace' !== block.type && 'root' !== block.type && block.parent){
|
|
179
|
+
block = block.parent;
|
|
180
|
+
queue = block.queue;
|
|
181
|
+
}
|
|
182
|
+
for(let i = 0; i < node.nodes.length; i++){
|
|
183
|
+
const child = node.nodes[i];
|
|
184
|
+
if ('comma' === child.type && 'brace' === node.type) {
|
|
185
|
+
if (1 === i) queue.push('');
|
|
186
|
+
queue.push('');
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if ('close' === child.type) {
|
|
190
|
+
q.push(append(q.pop(), queue, enclose));
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (child.value && 'open' !== child.type) {
|
|
194
|
+
queue.push(append(queue.pop(), child.value));
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (child.nodes) walk(child, node);
|
|
198
|
+
}
|
|
199
|
+
return queue;
|
|
200
|
+
};
|
|
201
|
+
return utils.flatten(walk(ast));
|
|
202
|
+
};
|
|
203
|
+
module.exports = expand;
|
|
204
|
+
},
|
|
205
|
+
"./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
206
|
+
const stringify = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js");
|
|
207
|
+
const { MAX_LENGTH, CHAR_BACKSLASH, CHAR_BACKTICK, CHAR_COMMA, CHAR_DOT, CHAR_LEFT_PARENTHESES, CHAR_RIGHT_PARENTHESES, CHAR_LEFT_CURLY_BRACE, CHAR_RIGHT_CURLY_BRACE, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_DOUBLE_QUOTE, CHAR_SINGLE_QUOTE, CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_NOBREAK_SPACE } = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js");
|
|
208
|
+
const parse = (input, options = {})=>{
|
|
209
|
+
if ('string' != typeof input) throw new TypeError('Expected a string');
|
|
210
|
+
const opts = options || {};
|
|
211
|
+
const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
212
|
+
if (input.length > max) throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
213
|
+
const ast = {
|
|
214
|
+
type: 'root',
|
|
215
|
+
input,
|
|
216
|
+
nodes: []
|
|
217
|
+
};
|
|
218
|
+
const stack = [
|
|
219
|
+
ast
|
|
220
|
+
];
|
|
221
|
+
let block = ast;
|
|
222
|
+
let prev = ast;
|
|
223
|
+
let brackets = 0;
|
|
224
|
+
const length = input.length;
|
|
225
|
+
let index = 0;
|
|
226
|
+
let depth = 0;
|
|
227
|
+
let value;
|
|
228
|
+
const advance = ()=>input[index++];
|
|
229
|
+
const push = (node)=>{
|
|
230
|
+
if ('text' === node.type && 'dot' === prev.type) prev.type = 'text';
|
|
231
|
+
if (prev && 'text' === prev.type && 'text' === node.type) {
|
|
232
|
+
prev.value += node.value;
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
block.nodes.push(node);
|
|
236
|
+
node.parent = block;
|
|
237
|
+
node.prev = prev;
|
|
238
|
+
prev = node;
|
|
239
|
+
return node;
|
|
240
|
+
};
|
|
241
|
+
push({
|
|
242
|
+
type: 'bos'
|
|
243
|
+
});
|
|
244
|
+
while(index < length){
|
|
245
|
+
block = stack[stack.length - 1];
|
|
246
|
+
value = advance();
|
|
247
|
+
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) continue;
|
|
248
|
+
if (value === CHAR_BACKSLASH) {
|
|
249
|
+
push({
|
|
250
|
+
type: 'text',
|
|
251
|
+
value: (options.keepEscaping ? value : '') + advance()
|
|
252
|
+
});
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
256
|
+
push({
|
|
257
|
+
type: 'text',
|
|
258
|
+
value: '\\' + value
|
|
259
|
+
});
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
263
|
+
brackets++;
|
|
264
|
+
let next;
|
|
265
|
+
while(index < length && (next = advance())){
|
|
266
|
+
value += next;
|
|
267
|
+
if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
|
268
|
+
brackets++;
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if (next === CHAR_BACKSLASH) {
|
|
272
|
+
value += advance();
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
276
|
+
brackets--;
|
|
277
|
+
if (0 === brackets) break;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
push({
|
|
281
|
+
type: 'text',
|
|
282
|
+
value
|
|
283
|
+
});
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
if (value === CHAR_LEFT_PARENTHESES) {
|
|
287
|
+
block = push({
|
|
288
|
+
type: 'paren',
|
|
289
|
+
nodes: []
|
|
290
|
+
});
|
|
291
|
+
stack.push(block);
|
|
292
|
+
push({
|
|
293
|
+
type: 'text',
|
|
294
|
+
value
|
|
295
|
+
});
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
299
|
+
if ('paren' !== block.type) {
|
|
300
|
+
push({
|
|
301
|
+
type: 'text',
|
|
302
|
+
value
|
|
303
|
+
});
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
block = stack.pop();
|
|
307
|
+
push({
|
|
308
|
+
type: 'text',
|
|
309
|
+
value
|
|
310
|
+
});
|
|
311
|
+
block = stack[stack.length - 1];
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
315
|
+
const open = value;
|
|
316
|
+
let next;
|
|
317
|
+
if (true !== options.keepQuotes) value = '';
|
|
318
|
+
while(index < length && (next = advance())){
|
|
319
|
+
if (next === CHAR_BACKSLASH) {
|
|
320
|
+
value += next + advance();
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (next === open) {
|
|
324
|
+
if (true === options.keepQuotes) value += next;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
value += next;
|
|
328
|
+
}
|
|
329
|
+
push({
|
|
330
|
+
type: 'text',
|
|
331
|
+
value
|
|
332
|
+
});
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
336
|
+
depth++;
|
|
337
|
+
const dollar = prev.value && '$' === prev.value.slice(-1) || true === block.dollar;
|
|
338
|
+
const brace = {
|
|
339
|
+
type: 'brace',
|
|
340
|
+
open: true,
|
|
341
|
+
close: false,
|
|
342
|
+
dollar,
|
|
343
|
+
depth,
|
|
344
|
+
commas: 0,
|
|
345
|
+
ranges: 0,
|
|
346
|
+
nodes: []
|
|
347
|
+
};
|
|
348
|
+
block = push(brace);
|
|
349
|
+
stack.push(block);
|
|
350
|
+
push({
|
|
351
|
+
type: 'open',
|
|
352
|
+
value
|
|
353
|
+
});
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
357
|
+
if ('brace' !== block.type) {
|
|
358
|
+
push({
|
|
359
|
+
type: 'text',
|
|
360
|
+
value
|
|
361
|
+
});
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
const type = 'close';
|
|
365
|
+
block = stack.pop();
|
|
366
|
+
block.close = true;
|
|
367
|
+
push({
|
|
368
|
+
type,
|
|
369
|
+
value
|
|
370
|
+
});
|
|
371
|
+
depth--;
|
|
372
|
+
block = stack[stack.length - 1];
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
if (value === CHAR_COMMA && depth > 0) {
|
|
376
|
+
if (block.ranges > 0) {
|
|
377
|
+
block.ranges = 0;
|
|
378
|
+
const open = block.nodes.shift();
|
|
379
|
+
block.nodes = [
|
|
380
|
+
open,
|
|
381
|
+
{
|
|
382
|
+
type: 'text',
|
|
383
|
+
value: stringify(block)
|
|
384
|
+
}
|
|
385
|
+
];
|
|
386
|
+
}
|
|
387
|
+
push({
|
|
388
|
+
type: 'comma',
|
|
389
|
+
value
|
|
390
|
+
});
|
|
391
|
+
block.commas++;
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
if (value === CHAR_DOT && depth > 0 && 0 === block.commas) {
|
|
395
|
+
const siblings = block.nodes;
|
|
396
|
+
if (0 === depth || 0 === siblings.length) {
|
|
397
|
+
push({
|
|
398
|
+
type: 'text',
|
|
399
|
+
value
|
|
400
|
+
});
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
if ('dot' === prev.type) {
|
|
404
|
+
block.range = [];
|
|
405
|
+
prev.value += value;
|
|
406
|
+
prev.type = 'range';
|
|
407
|
+
if (3 !== block.nodes.length && 5 !== block.nodes.length) {
|
|
408
|
+
block.invalid = true;
|
|
409
|
+
block.ranges = 0;
|
|
410
|
+
prev.type = 'text';
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
block.ranges++;
|
|
414
|
+
block.args = [];
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
if ('range' === prev.type) {
|
|
418
|
+
siblings.pop();
|
|
419
|
+
const before = siblings[siblings.length - 1];
|
|
420
|
+
before.value += prev.value + value;
|
|
421
|
+
prev = before;
|
|
422
|
+
block.ranges--;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
push({
|
|
426
|
+
type: 'dot',
|
|
427
|
+
value
|
|
428
|
+
});
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
push({
|
|
432
|
+
type: 'text',
|
|
433
|
+
value
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
do {
|
|
437
|
+
block = stack.pop();
|
|
438
|
+
if ('root' !== block.type) {
|
|
439
|
+
block.nodes.forEach((node)=>{
|
|
440
|
+
if (!node.nodes) {
|
|
441
|
+
if ('open' === node.type) node.isOpen = true;
|
|
442
|
+
if ('close' === node.type) node.isClose = true;
|
|
443
|
+
if (!node.nodes) node.type = 'text';
|
|
444
|
+
node.invalid = true;
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
const parent = stack[stack.length - 1];
|
|
448
|
+
const index = parent.nodes.indexOf(block);
|
|
449
|
+
parent.nodes.splice(index, 1, ...block.nodes);
|
|
450
|
+
}
|
|
451
|
+
}while (stack.length > 0);
|
|
452
|
+
push({
|
|
453
|
+
type: 'eos'
|
|
454
|
+
});
|
|
455
|
+
return ast;
|
|
456
|
+
};
|
|
457
|
+
module.exports = parse;
|
|
458
|
+
},
|
|
459
|
+
"./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
460
|
+
const utils = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
|
|
461
|
+
module.exports = (ast, options = {})=>{
|
|
462
|
+
const stringify = (node, parent = {})=>{
|
|
463
|
+
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
|
464
|
+
const invalidNode = true === node.invalid && true === options.escapeInvalid;
|
|
465
|
+
let output = '';
|
|
466
|
+
if (node.value) {
|
|
467
|
+
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) return '\\' + node.value;
|
|
468
|
+
return node.value;
|
|
469
|
+
}
|
|
470
|
+
if (node.value) return node.value;
|
|
471
|
+
if (node.nodes) for (const child of node.nodes)output += stringify(child);
|
|
472
|
+
return output;
|
|
473
|
+
};
|
|
474
|
+
return stringify(ast);
|
|
475
|
+
};
|
|
476
|
+
},
|
|
477
|
+
"./node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js" (__unused_rspack_module, exports) {
|
|
478
|
+
exports.isInteger = (num)=>{
|
|
479
|
+
if ('number' == typeof num) return Number.isInteger(num);
|
|
480
|
+
if ('string' == typeof num && '' !== num.trim()) return Number.isInteger(Number(num));
|
|
481
|
+
return false;
|
|
482
|
+
};
|
|
483
|
+
exports.find = (node, type)=>node.nodes.find((node)=>node.type === type);
|
|
484
|
+
exports.exceedsLimit = (min, max, step = 1, limit)=>{
|
|
485
|
+
if (false === limit) return false;
|
|
486
|
+
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
487
|
+
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
488
|
+
};
|
|
489
|
+
exports.escapeNode = (block, n = 0, type)=>{
|
|
490
|
+
const node = block.nodes[n];
|
|
491
|
+
if (!node) return;
|
|
492
|
+
if (type && node.type === type || 'open' === node.type || 'close' === node.type) {
|
|
493
|
+
if (true !== node.escaped) {
|
|
494
|
+
node.value = '\\' + node.value;
|
|
495
|
+
node.escaped = true;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
exports.encloseBrace = (node)=>{
|
|
500
|
+
if ('brace' !== node.type) return false;
|
|
501
|
+
if (node.commas >> 0 + node.ranges === 0) {
|
|
502
|
+
node.invalid = true;
|
|
503
|
+
return true;
|
|
504
|
+
}
|
|
505
|
+
return false;
|
|
506
|
+
};
|
|
507
|
+
exports.isInvalidBrace = (block)=>{
|
|
508
|
+
if ('brace' !== block.type) return false;
|
|
509
|
+
if (true === block.invalid || block.dollar) return true;
|
|
510
|
+
if (block.commas >> 0 + block.ranges === 0) {
|
|
511
|
+
block.invalid = true;
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
if (true !== block.open || true !== block.close) {
|
|
515
|
+
block.invalid = true;
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
return false;
|
|
519
|
+
};
|
|
520
|
+
exports.isOpenOrClose = (node)=>{
|
|
521
|
+
if ('open' === node.type || 'close' === node.type) return true;
|
|
522
|
+
return true === node.open || true === node.close;
|
|
523
|
+
};
|
|
524
|
+
exports.reduce = (nodes)=>nodes.reduce((acc, node)=>{
|
|
525
|
+
if ('text' === node.type) acc.push(node.value);
|
|
526
|
+
if ('range' === node.type) node.type = 'text';
|
|
527
|
+
return acc;
|
|
528
|
+
}, []);
|
|
529
|
+
exports.flatten = (...args)=>{
|
|
530
|
+
const result = [];
|
|
531
|
+
const flat = (arr)=>{
|
|
532
|
+
for(let i = 0; i < arr.length; i++){
|
|
533
|
+
const ele = arr[i];
|
|
534
|
+
if (Array.isArray(ele)) {
|
|
535
|
+
flat(ele);
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
if (void 0 !== ele) result.push(ele);
|
|
539
|
+
}
|
|
540
|
+
return result;
|
|
541
|
+
};
|
|
542
|
+
flat(args);
|
|
543
|
+
return result;
|
|
544
|
+
};
|
|
545
|
+
},
|
|
546
|
+
"./node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js" (module) {
|
|
547
|
+
var has = Object.prototype.hasOwnProperty, prefix = '~';
|
|
548
|
+
function Events() {}
|
|
549
|
+
if (Object.create) {
|
|
550
|
+
Events.prototype = Object.create(null);
|
|
551
|
+
if (!new Events().__proto__) prefix = false;
|
|
552
|
+
}
|
|
553
|
+
function EE(fn, context, once) {
|
|
554
|
+
this.fn = fn;
|
|
555
|
+
this.context = context;
|
|
556
|
+
this.once = once || false;
|
|
557
|
+
}
|
|
558
|
+
function addListener(emitter, event, fn, context, once) {
|
|
559
|
+
if ('function' != typeof fn) throw new TypeError('The listener must be a function');
|
|
560
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
561
|
+
if (emitter._events[evt]) if (emitter._events[evt].fn) emitter._events[evt] = [
|
|
562
|
+
emitter._events[evt],
|
|
563
|
+
listener
|
|
564
|
+
];
|
|
565
|
+
else emitter._events[evt].push(listener);
|
|
566
|
+
else emitter._events[evt] = listener, emitter._eventsCount++;
|
|
567
|
+
return emitter;
|
|
568
|
+
}
|
|
569
|
+
function clearEvent(emitter, evt) {
|
|
570
|
+
if (0 === --emitter._eventsCount) emitter._events = new Events();
|
|
571
|
+
else delete emitter._events[evt];
|
|
572
|
+
}
|
|
573
|
+
function EventEmitter() {
|
|
574
|
+
this._events = new Events();
|
|
575
|
+
this._eventsCount = 0;
|
|
576
|
+
}
|
|
577
|
+
EventEmitter.prototype.eventNames = function() {
|
|
578
|
+
var names = [], events, name;
|
|
579
|
+
if (0 === this._eventsCount) return names;
|
|
580
|
+
for(name in events = this._events)if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
581
|
+
if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));
|
|
582
|
+
return names;
|
|
583
|
+
};
|
|
584
|
+
EventEmitter.prototype.listeners = function(event) {
|
|
585
|
+
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
586
|
+
if (!handlers) return [];
|
|
587
|
+
if (handlers.fn) return [
|
|
588
|
+
handlers.fn
|
|
589
|
+
];
|
|
590
|
+
for(var i = 0, l = handlers.length, ee = new Array(l); i < l; i++)ee[i] = handlers[i].fn;
|
|
591
|
+
return ee;
|
|
592
|
+
};
|
|
593
|
+
EventEmitter.prototype.listenerCount = function(event) {
|
|
594
|
+
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
595
|
+
if (!listeners) return 0;
|
|
596
|
+
if (listeners.fn) return 1;
|
|
597
|
+
return listeners.length;
|
|
598
|
+
};
|
|
599
|
+
EventEmitter.prototype.emit = function(event, a1, a2, a3, a4, a5) {
|
|
600
|
+
var evt = prefix ? prefix + event : event;
|
|
601
|
+
if (!this._events[evt]) return false;
|
|
602
|
+
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
603
|
+
if (listeners.fn) {
|
|
604
|
+
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
605
|
+
switch(len){
|
|
606
|
+
case 1:
|
|
607
|
+
return listeners.fn.call(listeners.context), true;
|
|
608
|
+
case 2:
|
|
609
|
+
return listeners.fn.call(listeners.context, a1), true;
|
|
610
|
+
case 3:
|
|
611
|
+
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
612
|
+
case 4:
|
|
613
|
+
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
614
|
+
case 5:
|
|
615
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
616
|
+
case 6:
|
|
617
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
618
|
+
}
|
|
619
|
+
for(i = 1, args = new Array(len - 1); i < len; i++)args[i - 1] = arguments[i];
|
|
620
|
+
listeners.fn.apply(listeners.context, args);
|
|
621
|
+
} else {
|
|
622
|
+
var length = listeners.length, j;
|
|
623
|
+
for(i = 0; i < length; i++){
|
|
624
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
625
|
+
switch(len){
|
|
626
|
+
case 1:
|
|
627
|
+
listeners[i].fn.call(listeners[i].context);
|
|
628
|
+
break;
|
|
629
|
+
case 2:
|
|
630
|
+
listeners[i].fn.call(listeners[i].context, a1);
|
|
631
|
+
break;
|
|
632
|
+
case 3:
|
|
633
|
+
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
634
|
+
break;
|
|
635
|
+
case 4:
|
|
636
|
+
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
637
|
+
break;
|
|
638
|
+
default:
|
|
639
|
+
if (!args) for(j = 1, args = new Array(len - 1); j < len; j++)args[j - 1] = arguments[j];
|
|
640
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return true;
|
|
645
|
+
};
|
|
646
|
+
EventEmitter.prototype.on = function(event, fn, context) {
|
|
647
|
+
return addListener(this, event, fn, context, false);
|
|
648
|
+
};
|
|
649
|
+
EventEmitter.prototype.once = function(event, fn, context) {
|
|
650
|
+
return addListener(this, event, fn, context, true);
|
|
651
|
+
};
|
|
652
|
+
EventEmitter.prototype.removeListener = function(event, fn, context, once) {
|
|
653
|
+
var evt = prefix ? prefix + event : event;
|
|
654
|
+
if (!this._events[evt]) return this;
|
|
655
|
+
if (!fn) {
|
|
656
|
+
clearEvent(this, evt);
|
|
657
|
+
return this;
|
|
658
|
+
}
|
|
659
|
+
var listeners = this._events[evt];
|
|
660
|
+
if (listeners.fn) {
|
|
661
|
+
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) clearEvent(this, evt);
|
|
662
|
+
} else {
|
|
663
|
+
for(var i = 0, events = [], length = listeners.length; i < length; i++)if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);
|
|
664
|
+
if (events.length) this._events[evt] = 1 === events.length ? events[0] : events;
|
|
665
|
+
else clearEvent(this, evt);
|
|
666
|
+
}
|
|
667
|
+
return this;
|
|
668
|
+
};
|
|
669
|
+
EventEmitter.prototype.removeAllListeners = function(event) {
|
|
670
|
+
var evt;
|
|
671
|
+
if (event) {
|
|
672
|
+
evt = prefix ? prefix + event : event;
|
|
673
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
674
|
+
} else {
|
|
675
|
+
this._events = new Events();
|
|
676
|
+
this._eventsCount = 0;
|
|
677
|
+
}
|
|
678
|
+
return this;
|
|
679
|
+
};
|
|
680
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
681
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
682
|
+
EventEmitter.prefixed = prefix;
|
|
683
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
684
|
+
module.exports = EventEmitter;
|
|
685
|
+
},
|
|
686
|
+
"./node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
687
|
+
/*!
|
|
688
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
689
|
+
*
|
|
690
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
691
|
+
* Licensed under the MIT License.
|
|
692
|
+
*/ const util = __webpack_require__("util");
|
|
693
|
+
const toRegexRange = __webpack_require__("./node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js");
|
|
694
|
+
const isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
|
|
695
|
+
const transform = (toNumber)=>(value)=>true === toNumber ? Number(value) : String(value);
|
|
696
|
+
const isValidValue = (value)=>'number' == typeof value || 'string' == typeof value && '' !== value;
|
|
697
|
+
const isNumber = (num)=>Number.isInteger(+num);
|
|
698
|
+
const zeros = (input)=>{
|
|
699
|
+
let value = `${input}`;
|
|
700
|
+
let index = -1;
|
|
701
|
+
if ('-' === value[0]) value = value.slice(1);
|
|
702
|
+
if ('0' === value) return false;
|
|
703
|
+
while('0' === value[++index]);
|
|
704
|
+
return index > 0;
|
|
705
|
+
};
|
|
706
|
+
const stringify = (start, end, options)=>{
|
|
707
|
+
if ('string' == typeof start || 'string' == typeof end) return true;
|
|
708
|
+
return true === options.stringify;
|
|
709
|
+
};
|
|
710
|
+
const pad = (input, maxLength, toNumber)=>{
|
|
711
|
+
if (maxLength > 0) {
|
|
712
|
+
let dash = '-' === input[0] ? '-' : '';
|
|
713
|
+
if (dash) input = input.slice(1);
|
|
714
|
+
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, '0');
|
|
715
|
+
}
|
|
716
|
+
if (false === toNumber) return String(input);
|
|
717
|
+
return input;
|
|
718
|
+
};
|
|
719
|
+
const toMaxLen = (input, maxLength)=>{
|
|
720
|
+
let negative = '-' === input[0] ? '-' : '';
|
|
721
|
+
if (negative) {
|
|
722
|
+
input = input.slice(1);
|
|
723
|
+
maxLength--;
|
|
724
|
+
}
|
|
725
|
+
while(input.length < maxLength)input = '0' + input;
|
|
726
|
+
return negative ? '-' + input : input;
|
|
727
|
+
};
|
|
728
|
+
const toSequence = (parts, options, maxLen)=>{
|
|
729
|
+
parts.negatives.sort((a, b)=>a < b ? -1 : a > b ? 1 : 0);
|
|
730
|
+
parts.positives.sort((a, b)=>a < b ? -1 : a > b ? 1 : 0);
|
|
731
|
+
let prefix = options.capture ? '' : '?:';
|
|
732
|
+
let positives = '';
|
|
733
|
+
let negatives = '';
|
|
734
|
+
let result;
|
|
735
|
+
if (parts.positives.length) positives = parts.positives.map((v)=>toMaxLen(String(v), maxLen)).join('|');
|
|
736
|
+
if (parts.negatives.length) negatives = `-(${prefix}${parts.negatives.map((v)=>toMaxLen(String(v), maxLen)).join('|')})`;
|
|
737
|
+
result = positives && negatives ? `${positives}|${negatives}` : positives || negatives;
|
|
738
|
+
if (options.wrap) return `(${prefix}${result})`;
|
|
739
|
+
return result;
|
|
740
|
+
};
|
|
741
|
+
const toRange = (a, b, isNumbers, options)=>{
|
|
742
|
+
if (isNumbers) return toRegexRange(a, b, {
|
|
743
|
+
wrap: false,
|
|
744
|
+
...options
|
|
745
|
+
});
|
|
746
|
+
let start = String.fromCharCode(a);
|
|
747
|
+
if (a === b) return start;
|
|
748
|
+
let stop = String.fromCharCode(b);
|
|
749
|
+
return `[${start}-${stop}]`;
|
|
750
|
+
};
|
|
751
|
+
const toRegex = (start, end, options)=>{
|
|
752
|
+
if (Array.isArray(start)) {
|
|
753
|
+
let wrap = true === options.wrap;
|
|
754
|
+
let prefix = options.capture ? '' : '?:';
|
|
755
|
+
return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
|
|
756
|
+
}
|
|
757
|
+
return toRegexRange(start, end, options);
|
|
758
|
+
};
|
|
759
|
+
const rangeError = (...args)=>new RangeError('Invalid range arguments: ' + util.inspect(...args));
|
|
760
|
+
const invalidRange = (start, end, options)=>{
|
|
761
|
+
if (true === options.strictRanges) throw rangeError([
|
|
762
|
+
start,
|
|
763
|
+
end
|
|
764
|
+
]);
|
|
765
|
+
return [];
|
|
766
|
+
};
|
|
767
|
+
const invalidStep = (step, options)=>{
|
|
768
|
+
if (true === options.strictRanges) throw new TypeError(`Expected step "${step}" to be a number`);
|
|
769
|
+
return [];
|
|
770
|
+
};
|
|
771
|
+
const fillNumbers = (start, end, step = 1, options = {})=>{
|
|
772
|
+
let a = Number(start);
|
|
773
|
+
let b = Number(end);
|
|
774
|
+
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
775
|
+
if (true === options.strictRanges) throw rangeError([
|
|
776
|
+
start,
|
|
777
|
+
end
|
|
778
|
+
]);
|
|
779
|
+
return [];
|
|
780
|
+
}
|
|
781
|
+
if (0 === a) a = 0;
|
|
782
|
+
if (0 === b) b = 0;
|
|
783
|
+
let descending = a > b;
|
|
784
|
+
let startString = String(start);
|
|
785
|
+
let endString = String(end);
|
|
786
|
+
let stepString = String(step);
|
|
787
|
+
step = Math.max(Math.abs(step), 1);
|
|
788
|
+
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
789
|
+
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
790
|
+
let toNumber = false === padded && false === stringify(start, end, options);
|
|
791
|
+
let format = options.transform || transform(toNumber);
|
|
792
|
+
if (options.toRegex && 1 === step) return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
|
793
|
+
let parts = {
|
|
794
|
+
negatives: [],
|
|
795
|
+
positives: []
|
|
796
|
+
};
|
|
797
|
+
let push = (num)=>parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
|
|
798
|
+
let range = [];
|
|
799
|
+
let index = 0;
|
|
800
|
+
while(descending ? a >= b : a <= b){
|
|
801
|
+
if (true === options.toRegex && step > 1) push(a);
|
|
802
|
+
else range.push(pad(format(a, index), maxLen, toNumber));
|
|
803
|
+
a = descending ? a - step : a + step;
|
|
804
|
+
index++;
|
|
805
|
+
}
|
|
806
|
+
if (true === options.toRegex) return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, {
|
|
807
|
+
wrap: false,
|
|
808
|
+
...options
|
|
809
|
+
});
|
|
810
|
+
return range;
|
|
811
|
+
};
|
|
812
|
+
const fillLetters = (start, end, step = 1, options = {})=>{
|
|
813
|
+
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) return invalidRange(start, end, options);
|
|
814
|
+
let format = options.transform || ((val)=>String.fromCharCode(val));
|
|
815
|
+
let a = `${start}`.charCodeAt(0);
|
|
816
|
+
let b = `${end}`.charCodeAt(0);
|
|
817
|
+
let descending = a > b;
|
|
818
|
+
let min = Math.min(a, b);
|
|
819
|
+
let max = Math.max(a, b);
|
|
820
|
+
if (options.toRegex && 1 === step) return toRange(min, max, false, options);
|
|
821
|
+
let range = [];
|
|
822
|
+
let index = 0;
|
|
823
|
+
while(descending ? a >= b : a <= b){
|
|
824
|
+
range.push(format(a, index));
|
|
825
|
+
a = descending ? a - step : a + step;
|
|
826
|
+
index++;
|
|
827
|
+
}
|
|
828
|
+
if (true === options.toRegex) return toRegex(range, null, {
|
|
829
|
+
wrap: false,
|
|
830
|
+
options
|
|
831
|
+
});
|
|
832
|
+
return range;
|
|
833
|
+
};
|
|
834
|
+
const fill = (start, end, step, options = {})=>{
|
|
835
|
+
if (null == end && isValidValue(start)) return [
|
|
836
|
+
start
|
|
837
|
+
];
|
|
838
|
+
if (!isValidValue(start) || !isValidValue(end)) return invalidRange(start, end, options);
|
|
839
|
+
if ('function' == typeof step) return fill(start, end, 1, {
|
|
840
|
+
transform: step
|
|
841
|
+
});
|
|
842
|
+
if (isObject(step)) return fill(start, end, 0, step);
|
|
843
|
+
let opts = {
|
|
844
|
+
...options
|
|
845
|
+
};
|
|
846
|
+
if (true === opts.capture) opts.wrap = true;
|
|
847
|
+
step = step || opts.step || 1;
|
|
848
|
+
if (!isNumber(step)) {
|
|
849
|
+
if (null != step && !isObject(step)) return invalidStep(step, opts);
|
|
850
|
+
return fill(start, end, 1, step);
|
|
851
|
+
}
|
|
852
|
+
if (isNumber(start) && isNumber(end)) return fillNumbers(start, end, step, opts);
|
|
853
|
+
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
|
854
|
+
};
|
|
855
|
+
module.exports = fill;
|
|
856
|
+
},
|
|
857
|
+
"./node_modules/.pnpm/follow-redirects@1.15.9_debug@4.4.3/node_modules/follow-redirects/debug.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
858
|
+
var debug;
|
|
859
|
+
module.exports = function() {
|
|
860
|
+
if (!debug) {
|
|
861
|
+
try {
|
|
862
|
+
debug = __webpack_require__("./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")("follow-redirects");
|
|
863
|
+
} catch (error) {}
|
|
864
|
+
if ("function" != typeof debug) debug = function() {};
|
|
865
|
+
}
|
|
866
|
+
debug.apply(null, arguments);
|
|
867
|
+
};
|
|
868
|
+
},
|
|
869
|
+
"./node_modules/.pnpm/follow-redirects@1.15.9_debug@4.4.3/node_modules/follow-redirects/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
870
|
+
var url = __webpack_require__("url");
|
|
871
|
+
var URL = url.URL;
|
|
872
|
+
var http = __webpack_require__("http");
|
|
873
|
+
var https = __webpack_require__("https");
|
|
874
|
+
var Writable = __webpack_require__("stream").Writable;
|
|
875
|
+
var assert = __webpack_require__("assert");
|
|
876
|
+
var debug = __webpack_require__("./node_modules/.pnpm/follow-redirects@1.15.9_debug@4.4.3/node_modules/follow-redirects/debug.js");
|
|
877
|
+
(function() {
|
|
878
|
+
var looksLikeNode = "u" > typeof process;
|
|
879
|
+
var looksLikeBrowser = "u" > typeof window && "u" > typeof document;
|
|
880
|
+
var looksLikeV8 = isFunction(Error.captureStackTrace);
|
|
881
|
+
if (!looksLikeNode && (looksLikeBrowser || !looksLikeV8)) console.warn("The follow-redirects package should be excluded from browser builds.");
|
|
882
|
+
})();
|
|
883
|
+
var useNativeURL = false;
|
|
884
|
+
try {
|
|
885
|
+
assert(new URL(""));
|
|
886
|
+
} catch (error) {
|
|
887
|
+
useNativeURL = "ERR_INVALID_URL" === error.code;
|
|
888
|
+
}
|
|
889
|
+
var preservedUrlFields = [
|
|
890
|
+
"auth",
|
|
891
|
+
"host",
|
|
892
|
+
"hostname",
|
|
893
|
+
"href",
|
|
894
|
+
"path",
|
|
895
|
+
"pathname",
|
|
896
|
+
"port",
|
|
897
|
+
"protocol",
|
|
898
|
+
"query",
|
|
899
|
+
"search",
|
|
900
|
+
"hash"
|
|
901
|
+
];
|
|
902
|
+
var events = [
|
|
903
|
+
"abort",
|
|
904
|
+
"aborted",
|
|
905
|
+
"connect",
|
|
906
|
+
"error",
|
|
907
|
+
"socket",
|
|
908
|
+
"timeout"
|
|
909
|
+
];
|
|
910
|
+
var eventHandlers = Object.create(null);
|
|
911
|
+
events.forEach(function(event) {
|
|
912
|
+
eventHandlers[event] = function(arg1, arg2, arg3) {
|
|
913
|
+
this._redirectable.emit(event, arg1, arg2, arg3);
|
|
914
|
+
};
|
|
915
|
+
});
|
|
916
|
+
var InvalidUrlError = createErrorType("ERR_INVALID_URL", "Invalid URL", TypeError);
|
|
917
|
+
var RedirectionError = createErrorType("ERR_FR_REDIRECTION_FAILURE", "Redirected request failed");
|
|
918
|
+
var TooManyRedirectsError = createErrorType("ERR_FR_TOO_MANY_REDIRECTS", "Maximum number of redirects exceeded", RedirectionError);
|
|
919
|
+
var MaxBodyLengthExceededError = createErrorType("ERR_FR_MAX_BODY_LENGTH_EXCEEDED", "Request body larger than maxBodyLength limit");
|
|
920
|
+
var WriteAfterEndError = createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
|
|
921
|
+
var destroy = Writable.prototype.destroy || noop;
|
|
922
|
+
function RedirectableRequest(options, responseCallback) {
|
|
923
|
+
Writable.call(this);
|
|
924
|
+
this._sanitizeOptions(options);
|
|
925
|
+
this._options = options;
|
|
926
|
+
this._ended = false;
|
|
927
|
+
this._ending = false;
|
|
928
|
+
this._redirectCount = 0;
|
|
929
|
+
this._redirects = [];
|
|
930
|
+
this._requestBodyLength = 0;
|
|
931
|
+
this._requestBodyBuffers = [];
|
|
932
|
+
if (responseCallback) this.on("response", responseCallback);
|
|
933
|
+
var self = this;
|
|
934
|
+
this._onNativeResponse = function(response) {
|
|
935
|
+
try {
|
|
936
|
+
self._processResponse(response);
|
|
937
|
+
} catch (cause) {
|
|
938
|
+
self.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({
|
|
939
|
+
cause: cause
|
|
940
|
+
}));
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
this._performRequest();
|
|
944
|
+
}
|
|
945
|
+
RedirectableRequest.prototype = Object.create(Writable.prototype);
|
|
946
|
+
RedirectableRequest.prototype.abort = function() {
|
|
947
|
+
destroyRequest(this._currentRequest);
|
|
948
|
+
this._currentRequest.abort();
|
|
949
|
+
this.emit("abort");
|
|
950
|
+
};
|
|
951
|
+
RedirectableRequest.prototype.destroy = function(error) {
|
|
952
|
+
destroyRequest(this._currentRequest, error);
|
|
953
|
+
destroy.call(this, error);
|
|
954
|
+
return this;
|
|
955
|
+
};
|
|
956
|
+
RedirectableRequest.prototype.write = function(data, encoding, callback) {
|
|
957
|
+
if (this._ending) throw new WriteAfterEndError();
|
|
958
|
+
if (!isString(data) && !isBuffer(data)) throw new TypeError("data should be a string, Buffer or Uint8Array");
|
|
959
|
+
if (isFunction(encoding)) {
|
|
960
|
+
callback = encoding;
|
|
961
|
+
encoding = null;
|
|
962
|
+
}
|
|
963
|
+
if (0 === data.length) {
|
|
964
|
+
if (callback) callback();
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
|
|
968
|
+
this._requestBodyLength += data.length;
|
|
969
|
+
this._requestBodyBuffers.push({
|
|
970
|
+
data: data,
|
|
971
|
+
encoding: encoding
|
|
972
|
+
});
|
|
973
|
+
this._currentRequest.write(data, encoding, callback);
|
|
974
|
+
} else {
|
|
975
|
+
this.emit("error", new MaxBodyLengthExceededError());
|
|
976
|
+
this.abort();
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
RedirectableRequest.prototype.end = function(data, encoding, callback) {
|
|
980
|
+
if (isFunction(data)) {
|
|
981
|
+
callback = data;
|
|
982
|
+
data = encoding = null;
|
|
983
|
+
} else if (isFunction(encoding)) {
|
|
984
|
+
callback = encoding;
|
|
985
|
+
encoding = null;
|
|
986
|
+
}
|
|
987
|
+
if (data) {
|
|
988
|
+
var self = this;
|
|
989
|
+
var currentRequest = this._currentRequest;
|
|
990
|
+
this.write(data, encoding, function() {
|
|
991
|
+
self._ended = true;
|
|
992
|
+
currentRequest.end(null, null, callback);
|
|
993
|
+
});
|
|
994
|
+
this._ending = true;
|
|
995
|
+
} else {
|
|
996
|
+
this._ended = this._ending = true;
|
|
997
|
+
this._currentRequest.end(null, null, callback);
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
RedirectableRequest.prototype.setHeader = function(name, value) {
|
|
1001
|
+
this._options.headers[name] = value;
|
|
1002
|
+
this._currentRequest.setHeader(name, value);
|
|
1003
|
+
};
|
|
1004
|
+
RedirectableRequest.prototype.removeHeader = function(name) {
|
|
1005
|
+
delete this._options.headers[name];
|
|
1006
|
+
this._currentRequest.removeHeader(name);
|
|
1007
|
+
};
|
|
1008
|
+
RedirectableRequest.prototype.setTimeout = function(msecs, callback) {
|
|
1009
|
+
var self = this;
|
|
1010
|
+
function destroyOnTimeout(socket) {
|
|
1011
|
+
socket.setTimeout(msecs);
|
|
1012
|
+
socket.removeListener("timeout", socket.destroy);
|
|
1013
|
+
socket.addListener("timeout", socket.destroy);
|
|
1014
|
+
}
|
|
1015
|
+
function startTimer(socket) {
|
|
1016
|
+
if (self._timeout) clearTimeout(self._timeout);
|
|
1017
|
+
self._timeout = setTimeout(function() {
|
|
1018
|
+
self.emit("timeout");
|
|
1019
|
+
clearTimer();
|
|
1020
|
+
}, msecs);
|
|
1021
|
+
destroyOnTimeout(socket);
|
|
1022
|
+
}
|
|
1023
|
+
function clearTimer() {
|
|
1024
|
+
if (self._timeout) {
|
|
1025
|
+
clearTimeout(self._timeout);
|
|
1026
|
+
self._timeout = null;
|
|
1027
|
+
}
|
|
1028
|
+
self.removeListener("abort", clearTimer);
|
|
1029
|
+
self.removeListener("error", clearTimer);
|
|
1030
|
+
self.removeListener("response", clearTimer);
|
|
1031
|
+
self.removeListener("close", clearTimer);
|
|
1032
|
+
if (callback) self.removeListener("timeout", callback);
|
|
1033
|
+
if (!self.socket) self._currentRequest.removeListener("socket", startTimer);
|
|
1034
|
+
}
|
|
1035
|
+
if (callback) this.on("timeout", callback);
|
|
1036
|
+
if (this.socket) startTimer(this.socket);
|
|
1037
|
+
else this._currentRequest.once("socket", startTimer);
|
|
1038
|
+
this.on("socket", destroyOnTimeout);
|
|
1039
|
+
this.on("abort", clearTimer);
|
|
1040
|
+
this.on("error", clearTimer);
|
|
1041
|
+
this.on("response", clearTimer);
|
|
1042
|
+
this.on("close", clearTimer);
|
|
1043
|
+
return this;
|
|
1044
|
+
};
|
|
1045
|
+
[
|
|
1046
|
+
"flushHeaders",
|
|
1047
|
+
"getHeader",
|
|
1048
|
+
"setNoDelay",
|
|
1049
|
+
"setSocketKeepAlive"
|
|
1050
|
+
].forEach(function(method) {
|
|
1051
|
+
RedirectableRequest.prototype[method] = function(a, b) {
|
|
1052
|
+
return this._currentRequest[method](a, b);
|
|
1053
|
+
};
|
|
1054
|
+
});
|
|
1055
|
+
[
|
|
1056
|
+
"aborted",
|
|
1057
|
+
"connection",
|
|
1058
|
+
"socket"
|
|
1059
|
+
].forEach(function(property) {
|
|
1060
|
+
Object.defineProperty(RedirectableRequest.prototype, property, {
|
|
1061
|
+
get: function() {
|
|
1062
|
+
return this._currentRequest[property];
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
});
|
|
1066
|
+
RedirectableRequest.prototype._sanitizeOptions = function(options) {
|
|
1067
|
+
if (!options.headers) options.headers = {};
|
|
1068
|
+
if (options.host) {
|
|
1069
|
+
if (!options.hostname) options.hostname = options.host;
|
|
1070
|
+
delete options.host;
|
|
1071
|
+
}
|
|
1072
|
+
if (!options.pathname && options.path) {
|
|
1073
|
+
var searchPos = options.path.indexOf("?");
|
|
1074
|
+
if (searchPos < 0) options.pathname = options.path;
|
|
1075
|
+
else {
|
|
1076
|
+
options.pathname = options.path.substring(0, searchPos);
|
|
1077
|
+
options.search = options.path.substring(searchPos);
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
RedirectableRequest.prototype._performRequest = function() {
|
|
1082
|
+
var protocol = this._options.protocol;
|
|
1083
|
+
var nativeProtocol = this._options.nativeProtocols[protocol];
|
|
1084
|
+
if (!nativeProtocol) throw new TypeError("Unsupported protocol " + protocol);
|
|
1085
|
+
if (this._options.agents) {
|
|
1086
|
+
var scheme = protocol.slice(0, -1);
|
|
1087
|
+
this._options.agent = this._options.agents[scheme];
|
|
1088
|
+
}
|
|
1089
|
+
var request = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse);
|
|
1090
|
+
request._redirectable = this;
|
|
1091
|
+
for (var event of events)request.on(event, eventHandlers[event]);
|
|
1092
|
+
this._currentUrl = /^\//.test(this._options.path) ? url.format(this._options) : this._options.path;
|
|
1093
|
+
if (this._isRedirect) {
|
|
1094
|
+
var i = 0;
|
|
1095
|
+
var self = this;
|
|
1096
|
+
var buffers = this._requestBodyBuffers;
|
|
1097
|
+
(function writeNext(error) {
|
|
1098
|
+
if (request === self._currentRequest) {
|
|
1099
|
+
if (error) self.emit("error", error);
|
|
1100
|
+
else if (i < buffers.length) {
|
|
1101
|
+
var buffer = buffers[i++];
|
|
1102
|
+
if (!request.finished) request.write(buffer.data, buffer.encoding, writeNext);
|
|
1103
|
+
} else if (self._ended) request.end();
|
|
1104
|
+
}
|
|
1105
|
+
})();
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
RedirectableRequest.prototype._processResponse = function(response) {
|
|
1109
|
+
var statusCode = response.statusCode;
|
|
1110
|
+
if (this._options.trackRedirects) this._redirects.push({
|
|
1111
|
+
url: this._currentUrl,
|
|
1112
|
+
headers: response.headers,
|
|
1113
|
+
statusCode: statusCode
|
|
1114
|
+
});
|
|
1115
|
+
var location = response.headers.location;
|
|
1116
|
+
if (!location || false === this._options.followRedirects || statusCode < 300 || statusCode >= 400) {
|
|
1117
|
+
response.responseUrl = this._currentUrl;
|
|
1118
|
+
response.redirects = this._redirects;
|
|
1119
|
+
this.emit("response", response);
|
|
1120
|
+
this._requestBodyBuffers = [];
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
destroyRequest(this._currentRequest);
|
|
1124
|
+
response.destroy();
|
|
1125
|
+
if (++this._redirectCount > this._options.maxRedirects) throw new TooManyRedirectsError();
|
|
1126
|
+
var requestHeaders;
|
|
1127
|
+
var beforeRedirect = this._options.beforeRedirect;
|
|
1128
|
+
if (beforeRedirect) requestHeaders = Object.assign({
|
|
1129
|
+
Host: response.req.getHeader("host")
|
|
1130
|
+
}, this._options.headers);
|
|
1131
|
+
var method = this._options.method;
|
|
1132
|
+
if ((301 === statusCode || 302 === statusCode) && "POST" === this._options.method || 303 === statusCode && !/^(?:GET|HEAD)$/.test(this._options.method)) {
|
|
1133
|
+
this._options.method = "GET";
|
|
1134
|
+
this._requestBodyBuffers = [];
|
|
1135
|
+
removeMatchingHeaders(/^content-/i, this._options.headers);
|
|
1136
|
+
}
|
|
1137
|
+
var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
|
|
1138
|
+
var currentUrlParts = parseUrl(this._currentUrl);
|
|
1139
|
+
var currentHost = currentHostHeader || currentUrlParts.host;
|
|
1140
|
+
var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url.format(Object.assign(currentUrlParts, {
|
|
1141
|
+
host: currentHost
|
|
1142
|
+
}));
|
|
1143
|
+
var redirectUrl = resolveUrl(location, currentUrl);
|
|
1144
|
+
debug("redirecting to", redirectUrl.href);
|
|
1145
|
+
this._isRedirect = true;
|
|
1146
|
+
spreadUrlObject(redirectUrl, this._options);
|
|
1147
|
+
if (redirectUrl.protocol !== currentUrlParts.protocol && "https:" !== redirectUrl.protocol || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
|
|
1148
|
+
if (isFunction(beforeRedirect)) {
|
|
1149
|
+
var responseDetails = {
|
|
1150
|
+
headers: response.headers,
|
|
1151
|
+
statusCode: statusCode
|
|
1152
|
+
};
|
|
1153
|
+
var requestDetails = {
|
|
1154
|
+
url: currentUrl,
|
|
1155
|
+
method: method,
|
|
1156
|
+
headers: requestHeaders
|
|
1157
|
+
};
|
|
1158
|
+
beforeRedirect(this._options, responseDetails, requestDetails);
|
|
1159
|
+
this._sanitizeOptions(this._options);
|
|
1160
|
+
}
|
|
1161
|
+
this._performRequest();
|
|
1162
|
+
};
|
|
1163
|
+
function wrap(protocols) {
|
|
1164
|
+
var exports = {
|
|
1165
|
+
maxRedirects: 21,
|
|
1166
|
+
maxBodyLength: 10485760
|
|
1167
|
+
};
|
|
1168
|
+
var nativeProtocols = {};
|
|
1169
|
+
Object.keys(protocols).forEach(function(scheme) {
|
|
1170
|
+
var protocol = scheme + ":";
|
|
1171
|
+
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
|
|
1172
|
+
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
|
|
1173
|
+
function request(input, options, callback) {
|
|
1174
|
+
if (isURL(input)) input = spreadUrlObject(input);
|
|
1175
|
+
else if (isString(input)) input = spreadUrlObject(parseUrl(input));
|
|
1176
|
+
else {
|
|
1177
|
+
callback = options;
|
|
1178
|
+
options = validateUrl(input);
|
|
1179
|
+
input = {
|
|
1180
|
+
protocol: protocol
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
if (isFunction(options)) {
|
|
1184
|
+
callback = options;
|
|
1185
|
+
options = null;
|
|
1186
|
+
}
|
|
1187
|
+
options = Object.assign({
|
|
1188
|
+
maxRedirects: exports.maxRedirects,
|
|
1189
|
+
maxBodyLength: exports.maxBodyLength
|
|
1190
|
+
}, input, options);
|
|
1191
|
+
options.nativeProtocols = nativeProtocols;
|
|
1192
|
+
if (!isString(options.host) && !isString(options.hostname)) options.hostname = "::1";
|
|
1193
|
+
assert.equal(options.protocol, protocol, "protocol mismatch");
|
|
1194
|
+
debug("options", options);
|
|
1195
|
+
return new RedirectableRequest(options, callback);
|
|
1196
|
+
}
|
|
1197
|
+
function get(input, options, callback) {
|
|
1198
|
+
var wrappedRequest = wrappedProtocol.request(input, options, callback);
|
|
1199
|
+
wrappedRequest.end();
|
|
1200
|
+
return wrappedRequest;
|
|
1201
|
+
}
|
|
1202
|
+
Object.defineProperties(wrappedProtocol, {
|
|
1203
|
+
request: {
|
|
1204
|
+
value: request,
|
|
1205
|
+
configurable: true,
|
|
1206
|
+
enumerable: true,
|
|
1207
|
+
writable: true
|
|
1208
|
+
},
|
|
1209
|
+
get: {
|
|
1210
|
+
value: get,
|
|
1211
|
+
configurable: true,
|
|
1212
|
+
enumerable: true,
|
|
1213
|
+
writable: true
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
});
|
|
1217
|
+
return exports;
|
|
1218
|
+
}
|
|
1219
|
+
function noop() {}
|
|
1220
|
+
function parseUrl(input) {
|
|
1221
|
+
var parsed;
|
|
1222
|
+
if (useNativeURL) parsed = new URL(input);
|
|
1223
|
+
else {
|
|
1224
|
+
parsed = validateUrl(url.parse(input));
|
|
1225
|
+
if (!isString(parsed.protocol)) throw new InvalidUrlError({
|
|
1226
|
+
input
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
return parsed;
|
|
1230
|
+
}
|
|
1231
|
+
function resolveUrl(relative, base) {
|
|
1232
|
+
return useNativeURL ? new URL(relative, base) : parseUrl(url.resolve(base, relative));
|
|
1233
|
+
}
|
|
1234
|
+
function validateUrl(input) {
|
|
1235
|
+
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) throw new InvalidUrlError({
|
|
1236
|
+
input: input.href || input
|
|
1237
|
+
});
|
|
1238
|
+
if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) throw new InvalidUrlError({
|
|
1239
|
+
input: input.href || input
|
|
1240
|
+
});
|
|
1241
|
+
return input;
|
|
1242
|
+
}
|
|
1243
|
+
function spreadUrlObject(urlObject, target) {
|
|
1244
|
+
var spread = target || {};
|
|
1245
|
+
for (var key of preservedUrlFields)spread[key] = urlObject[key];
|
|
1246
|
+
if (spread.hostname.startsWith("[")) spread.hostname = spread.hostname.slice(1, -1);
|
|
1247
|
+
if ("" !== spread.port) spread.port = Number(spread.port);
|
|
1248
|
+
spread.path = spread.search ? spread.pathname + spread.search : spread.pathname;
|
|
1249
|
+
return spread;
|
|
1250
|
+
}
|
|
1251
|
+
function removeMatchingHeaders(regex, headers) {
|
|
1252
|
+
var lastValue;
|
|
1253
|
+
for(var header in headers)if (regex.test(header)) {
|
|
1254
|
+
lastValue = headers[header];
|
|
1255
|
+
delete headers[header];
|
|
1256
|
+
}
|
|
1257
|
+
return null == lastValue ? void 0 : String(lastValue).trim();
|
|
1258
|
+
}
|
|
1259
|
+
function createErrorType(code, message, baseClass) {
|
|
1260
|
+
function CustomError(properties) {
|
|
1261
|
+
if (isFunction(Error.captureStackTrace)) Error.captureStackTrace(this, this.constructor);
|
|
1262
|
+
Object.assign(this, properties || {});
|
|
1263
|
+
this.code = code;
|
|
1264
|
+
this.message = this.cause ? message + ": " + this.cause.message : message;
|
|
1265
|
+
}
|
|
1266
|
+
CustomError.prototype = new (baseClass || Error)();
|
|
1267
|
+
Object.defineProperties(CustomError.prototype, {
|
|
1268
|
+
constructor: {
|
|
1269
|
+
value: CustomError,
|
|
1270
|
+
enumerable: false
|
|
1271
|
+
},
|
|
1272
|
+
name: {
|
|
1273
|
+
value: "Error [" + code + "]",
|
|
1274
|
+
enumerable: false
|
|
1275
|
+
}
|
|
1276
|
+
});
|
|
1277
|
+
return CustomError;
|
|
1278
|
+
}
|
|
1279
|
+
function destroyRequest(request, error) {
|
|
1280
|
+
for (var event of events)request.removeListener(event, eventHandlers[event]);
|
|
1281
|
+
request.on("error", noop);
|
|
1282
|
+
request.destroy(error);
|
|
1283
|
+
}
|
|
1284
|
+
function isSubdomain(subdomain, domain) {
|
|
1285
|
+
assert(isString(subdomain) && isString(domain));
|
|
1286
|
+
var dot = subdomain.length - domain.length - 1;
|
|
1287
|
+
return dot > 0 && "." === subdomain[dot] && subdomain.endsWith(domain);
|
|
1288
|
+
}
|
|
1289
|
+
function isString(value) {
|
|
1290
|
+
return "string" == typeof value || value instanceof String;
|
|
1291
|
+
}
|
|
1292
|
+
function isFunction(value) {
|
|
1293
|
+
return "function" == typeof value;
|
|
1294
|
+
}
|
|
1295
|
+
function isBuffer(value) {
|
|
1296
|
+
return "object" == typeof value && "length" in value;
|
|
1297
|
+
}
|
|
1298
|
+
function isURL(value) {
|
|
1299
|
+
return URL && value instanceof URL;
|
|
1300
|
+
}
|
|
1301
|
+
module.exports = wrap({
|
|
1302
|
+
http: http,
|
|
1303
|
+
https: https
|
|
1304
|
+
});
|
|
1305
|
+
module.exports.wrap = wrap;
|
|
1306
|
+
},
|
|
1307
|
+
"./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1308
|
+
/*!
|
|
1309
|
+
* Caron dimonio, con occhi di bragia
|
|
1310
|
+
* loro accennando, tutte le raccoglie;
|
|
1311
|
+
* batte col remo qualunque s’adagia
|
|
1312
|
+
*
|
|
1313
|
+
* Charon the demon, with the eyes of glede,
|
|
1314
|
+
* Beckoning to them, collects them all together,
|
|
1315
|
+
* Beats with his oar whoever lags behind
|
|
1316
|
+
*
|
|
1317
|
+
* Dante - The Divine Comedy (Canto III)
|
|
1318
|
+
*/ module.exports = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy.js");
|
|
1319
|
+
},
|
|
1320
|
+
"./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1321
|
+
var ProxyServer = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/index.js").Server;
|
|
1322
|
+
function createProxyServer(options) {
|
|
1323
|
+
return new ProxyServer(options);
|
|
1324
|
+
}
|
|
1325
|
+
ProxyServer.createProxyServer = createProxyServer;
|
|
1326
|
+
ProxyServer.createServer = createProxyServer;
|
|
1327
|
+
ProxyServer.createProxy = createProxyServer;
|
|
1328
|
+
module.exports = ProxyServer;
|
|
1329
|
+
},
|
|
1330
|
+
"./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/common.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1331
|
+
var common = exports, url = __webpack_require__("url"), extend = __webpack_require__("util")._extend, required = __webpack_require__("./node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js");
|
|
1332
|
+
var upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i, isSSL = /^https|wss/;
|
|
1333
|
+
common.isSSL = isSSL;
|
|
1334
|
+
common.setupOutgoing = function(outgoing, options, req, forward) {
|
|
1335
|
+
outgoing.port = options[forward || 'target'].port || (isSSL.test(options[forward || 'target'].protocol) ? 443 : 80);
|
|
1336
|
+
[
|
|
1337
|
+
'host',
|
|
1338
|
+
'hostname',
|
|
1339
|
+
'socketPath',
|
|
1340
|
+
'pfx',
|
|
1341
|
+
'key',
|
|
1342
|
+
'passphrase',
|
|
1343
|
+
'cert',
|
|
1344
|
+
'ca',
|
|
1345
|
+
'ciphers',
|
|
1346
|
+
'secureProtocol'
|
|
1347
|
+
].forEach(function(e) {
|
|
1348
|
+
outgoing[e] = options[forward || 'target'][e];
|
|
1349
|
+
});
|
|
1350
|
+
outgoing.method = options.method || req.method;
|
|
1351
|
+
outgoing.headers = extend({}, req.headers);
|
|
1352
|
+
if (options.headers) extend(outgoing.headers, options.headers);
|
|
1353
|
+
if (options.auth) outgoing.auth = options.auth;
|
|
1354
|
+
if (options.ca) outgoing.ca = options.ca;
|
|
1355
|
+
if (isSSL.test(options[forward || 'target'].protocol)) outgoing.rejectUnauthorized = void 0 === options.secure ? true : options.secure;
|
|
1356
|
+
outgoing.agent = options.agent || false;
|
|
1357
|
+
outgoing.localAddress = options.localAddress;
|
|
1358
|
+
if (!outgoing.agent) {
|
|
1359
|
+
outgoing.headers = outgoing.headers || {};
|
|
1360
|
+
if ('string' != typeof outgoing.headers.connection || !upgradeHeader.test(outgoing.headers.connection)) outgoing.headers.connection = 'close';
|
|
1361
|
+
}
|
|
1362
|
+
var target = options[forward || 'target'];
|
|
1363
|
+
var targetPath = target && false !== options.prependPath ? target.path || '' : '';
|
|
1364
|
+
var outgoingPath = options.toProxy ? req.url : url.parse(req.url).path || '';
|
|
1365
|
+
outgoingPath = options.ignorePath ? '' : outgoingPath;
|
|
1366
|
+
outgoing.path = common.urlJoin(targetPath, outgoingPath);
|
|
1367
|
+
if (options.changeOrigin) outgoing.headers.host = required(outgoing.port, options[forward || 'target'].protocol) && !hasPort(outgoing.host) ? outgoing.host + ':' + outgoing.port : outgoing.host;
|
|
1368
|
+
return outgoing;
|
|
1369
|
+
};
|
|
1370
|
+
common.setupSocket = function(socket) {
|
|
1371
|
+
socket.setTimeout(0);
|
|
1372
|
+
socket.setNoDelay(true);
|
|
1373
|
+
socket.setKeepAlive(true, 0);
|
|
1374
|
+
return socket;
|
|
1375
|
+
};
|
|
1376
|
+
common.getPort = function(req) {
|
|
1377
|
+
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : '';
|
|
1378
|
+
return res ? res[1] : common.hasEncryptedConnection(req) ? '443' : '80';
|
|
1379
|
+
};
|
|
1380
|
+
common.hasEncryptedConnection = function(req) {
|
|
1381
|
+
return Boolean(req.connection.encrypted || req.connection.pair);
|
|
1382
|
+
};
|
|
1383
|
+
common.urlJoin = function() {
|
|
1384
|
+
var args = Array.prototype.slice.call(arguments), lastIndex = args.length - 1, last = args[lastIndex], lastSegs = last.split('?'), retSegs;
|
|
1385
|
+
args[lastIndex] = lastSegs.shift();
|
|
1386
|
+
retSegs = [
|
|
1387
|
+
args.filter(Boolean).join('/').replace(/\/+/g, '/').replace('http:/', 'http://').replace('https:/', 'https://')
|
|
1388
|
+
];
|
|
1389
|
+
retSegs.push.apply(retSegs, lastSegs);
|
|
1390
|
+
return retSegs.join('?');
|
|
1391
|
+
};
|
|
1392
|
+
common.rewriteCookieProperty = function rewriteCookieProperty(header, config, property) {
|
|
1393
|
+
if (Array.isArray(header)) return header.map(function(headerElement) {
|
|
1394
|
+
return rewriteCookieProperty(headerElement, config, property);
|
|
1395
|
+
});
|
|
1396
|
+
return header.replace(new RegExp("(;\\s*" + property + "=)([^;]+)", 'i'), function(match, prefix, previousValue) {
|
|
1397
|
+
var newValue;
|
|
1398
|
+
if (previousValue in config) newValue = config[previousValue];
|
|
1399
|
+
else {
|
|
1400
|
+
if (!('*' in config)) return match;
|
|
1401
|
+
newValue = config['*'];
|
|
1402
|
+
}
|
|
1403
|
+
if (newValue) return prefix + newValue;
|
|
1404
|
+
return '';
|
|
1405
|
+
});
|
|
1406
|
+
};
|
|
1407
|
+
function hasPort(host) {
|
|
1408
|
+
return !!~host.indexOf(':');
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
"./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1412
|
+
var httpProxy = module.exports, extend = __webpack_require__("util")._extend, parse_url = __webpack_require__("url").parse, EE3 = __webpack_require__("./node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js"), http = __webpack_require__("http"), https = __webpack_require__("https"), web = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js"), ws = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/passes/ws-incoming.js");
|
|
1413
|
+
httpProxy.Server = ProxyServer;
|
|
1414
|
+
function createRightProxy(type) {
|
|
1415
|
+
return function(options) {
|
|
1416
|
+
return function(req, res) {
|
|
1417
|
+
var passes = 'ws' === type ? this.wsPasses : this.webPasses, args = [].slice.call(arguments), cntr = args.length - 1, head, cbl;
|
|
1418
|
+
if ('function' == typeof args[cntr]) {
|
|
1419
|
+
cbl = args[cntr];
|
|
1420
|
+
cntr--;
|
|
1421
|
+
}
|
|
1422
|
+
var requestOptions = options;
|
|
1423
|
+
if (!(args[cntr] instanceof Buffer) && args[cntr] !== res) {
|
|
1424
|
+
requestOptions = extend({}, options);
|
|
1425
|
+
extend(requestOptions, args[cntr]);
|
|
1426
|
+
cntr--;
|
|
1427
|
+
}
|
|
1428
|
+
if (args[cntr] instanceof Buffer) head = args[cntr];
|
|
1429
|
+
[
|
|
1430
|
+
'target',
|
|
1431
|
+
'forward'
|
|
1432
|
+
].forEach(function(e) {
|
|
1433
|
+
if ('string' == typeof requestOptions[e]) requestOptions[e] = parse_url(requestOptions[e]);
|
|
1434
|
+
});
|
|
1435
|
+
if (!requestOptions.target && !requestOptions.forward) return this.emit('error', new Error('Must provide a proper URL as target'));
|
|
1436
|
+
for(var i = 0; i < passes.length && !passes[i](req, res, requestOptions, head, this, cbl); i++);
|
|
1437
|
+
};
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
httpProxy.createRightProxy = createRightProxy;
|
|
1441
|
+
function ProxyServer(options) {
|
|
1442
|
+
EE3.call(this);
|
|
1443
|
+
options = options || {};
|
|
1444
|
+
options.prependPath = false !== options.prependPath;
|
|
1445
|
+
this.web = this.proxyRequest = createRightProxy('web')(options);
|
|
1446
|
+
this.ws = this.proxyWebsocketRequest = createRightProxy('ws')(options);
|
|
1447
|
+
this.options = options;
|
|
1448
|
+
this.webPasses = Object.keys(web).map(function(pass) {
|
|
1449
|
+
return web[pass];
|
|
1450
|
+
});
|
|
1451
|
+
this.wsPasses = Object.keys(ws).map(function(pass) {
|
|
1452
|
+
return ws[pass];
|
|
1453
|
+
});
|
|
1454
|
+
this.on('error', this.onError, this);
|
|
1455
|
+
}
|
|
1456
|
+
__webpack_require__("util").inherits(ProxyServer, EE3);
|
|
1457
|
+
ProxyServer.prototype.onError = function(err) {
|
|
1458
|
+
if (1 === this.listeners('error').length) throw err;
|
|
1459
|
+
};
|
|
1460
|
+
ProxyServer.prototype.listen = function(port, hostname) {
|
|
1461
|
+
var self = this, closure = function(req, res) {
|
|
1462
|
+
self.web(req, res);
|
|
1463
|
+
};
|
|
1464
|
+
this._server = this.options.ssl ? https.createServer(this.options.ssl, closure) : http.createServer(closure);
|
|
1465
|
+
if (this.options.ws) this._server.on('upgrade', function(req, socket, head) {
|
|
1466
|
+
self.ws(req, socket, head);
|
|
1467
|
+
});
|
|
1468
|
+
this._server.listen(port, hostname);
|
|
1469
|
+
return this;
|
|
1470
|
+
};
|
|
1471
|
+
ProxyServer.prototype.close = function(callback) {
|
|
1472
|
+
var self = this;
|
|
1473
|
+
if (this._server) this._server.close(done);
|
|
1474
|
+
function done() {
|
|
1475
|
+
self._server = null;
|
|
1476
|
+
if (callback) callback.apply(null, arguments);
|
|
1477
|
+
}
|
|
1478
|
+
};
|
|
1479
|
+
ProxyServer.prototype.before = function(type, passName, callback) {
|
|
1480
|
+
if ('ws' !== type && 'web' !== type) throw new Error('type must be `web` or `ws`');
|
|
1481
|
+
var passes = 'ws' === type ? this.wsPasses : this.webPasses, i = false;
|
|
1482
|
+
passes.forEach(function(v, idx) {
|
|
1483
|
+
if (v.name === passName) i = idx;
|
|
1484
|
+
});
|
|
1485
|
+
if (false === i) throw new Error('No such pass');
|
|
1486
|
+
passes.splice(i, 0, callback);
|
|
1487
|
+
};
|
|
1488
|
+
ProxyServer.prototype.after = function(type, passName, callback) {
|
|
1489
|
+
if ('ws' !== type && 'web' !== type) throw new Error('type must be `web` or `ws`');
|
|
1490
|
+
var passes = 'ws' === type ? this.wsPasses : this.webPasses, i = false;
|
|
1491
|
+
passes.forEach(function(v, idx) {
|
|
1492
|
+
if (v.name === passName) i = idx;
|
|
1493
|
+
});
|
|
1494
|
+
if (false === i) throw new Error('No such pass');
|
|
1495
|
+
passes.splice(i++, 0, callback);
|
|
1496
|
+
};
|
|
1497
|
+
},
|
|
1498
|
+
"./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1499
|
+
var httpNative = __webpack_require__("http"), httpsNative = __webpack_require__("https"), web_o = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js"), common = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/common.js"), followRedirects = __webpack_require__("./node_modules/.pnpm/follow-redirects@1.15.9_debug@4.4.3/node_modules/follow-redirects/index.js");
|
|
1500
|
+
web_o = Object.keys(web_o).map(function(pass) {
|
|
1501
|
+
return web_o[pass];
|
|
1502
|
+
});
|
|
1503
|
+
var nativeAgents = {
|
|
1504
|
+
http: httpNative,
|
|
1505
|
+
https: httpsNative
|
|
1506
|
+
};
|
|
1507
|
+
/*!
|
|
1508
|
+
* Array of passes.
|
|
1509
|
+
*
|
|
1510
|
+
* A `pass` is just a function that is executed on `req, res, options`
|
|
1511
|
+
* so that you can easily add new checks while still keeping the base
|
|
1512
|
+
* flexible.
|
|
1513
|
+
*/ module.exports = {
|
|
1514
|
+
deleteLength: function(req, res, options) {
|
|
1515
|
+
if (('DELETE' === req.method || 'OPTIONS' === req.method) && !req.headers['content-length']) {
|
|
1516
|
+
req.headers['content-length'] = '0';
|
|
1517
|
+
delete req.headers['transfer-encoding'];
|
|
1518
|
+
}
|
|
1519
|
+
},
|
|
1520
|
+
timeout: function(req, res, options) {
|
|
1521
|
+
if (options.timeout) req.socket.setTimeout(options.timeout);
|
|
1522
|
+
},
|
|
1523
|
+
XHeaders: function(req, res, options) {
|
|
1524
|
+
if (!options.xfwd) return;
|
|
1525
|
+
var encrypted = req.isSpdy || common.hasEncryptedConnection(req);
|
|
1526
|
+
var values = {
|
|
1527
|
+
for: req.connection.remoteAddress || req.socket.remoteAddress,
|
|
1528
|
+
port: common.getPort(req),
|
|
1529
|
+
proto: encrypted ? 'https' : 'http'
|
|
1530
|
+
};
|
|
1531
|
+
[
|
|
1532
|
+
'for',
|
|
1533
|
+
'port',
|
|
1534
|
+
'proto'
|
|
1535
|
+
].forEach(function(header) {
|
|
1536
|
+
req.headers['x-forwarded-' + header] = (req.headers['x-forwarded-' + header] || '') + (req.headers['x-forwarded-' + header] ? ',' : '') + values[header];
|
|
1537
|
+
});
|
|
1538
|
+
req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers['host'] || '';
|
|
1539
|
+
},
|
|
1540
|
+
stream: function(req, res, options, _, server, clb) {
|
|
1541
|
+
server.emit('start', req, res, options.target || options.forward);
|
|
1542
|
+
var agents = options.followRedirects ? followRedirects : nativeAgents;
|
|
1543
|
+
var http = agents.http;
|
|
1544
|
+
var https = agents.https;
|
|
1545
|
+
if (options.forward) {
|
|
1546
|
+
var forwardReq = ('https:' === options.forward.protocol ? https : http).request(common.setupOutgoing(options.ssl || {}, options, req, 'forward'));
|
|
1547
|
+
var forwardError = createErrorHandler(forwardReq, options.forward);
|
|
1548
|
+
req.on('error', forwardError);
|
|
1549
|
+
forwardReq.on('error', forwardError);
|
|
1550
|
+
(options.buffer || req).pipe(forwardReq);
|
|
1551
|
+
if (!options.target) return res.end();
|
|
1552
|
+
}
|
|
1553
|
+
var proxyReq = ('https:' === options.target.protocol ? https : http).request(common.setupOutgoing(options.ssl || {}, options, req));
|
|
1554
|
+
proxyReq.on('socket', function(socket) {
|
|
1555
|
+
if (server && !proxyReq.getHeader('expect')) server.emit('proxyReq', proxyReq, req, res, options);
|
|
1556
|
+
});
|
|
1557
|
+
if (options.proxyTimeout) proxyReq.setTimeout(options.proxyTimeout, function() {
|
|
1558
|
+
proxyReq.abort();
|
|
1559
|
+
});
|
|
1560
|
+
req.on('aborted', function() {
|
|
1561
|
+
proxyReq.abort();
|
|
1562
|
+
});
|
|
1563
|
+
var proxyError = createErrorHandler(proxyReq, options.target);
|
|
1564
|
+
req.on('error', proxyError);
|
|
1565
|
+
proxyReq.on('error', proxyError);
|
|
1566
|
+
function createErrorHandler(proxyReq, url) {
|
|
1567
|
+
return function(err) {
|
|
1568
|
+
if (req.socket.destroyed && 'ECONNRESET' === err.code) {
|
|
1569
|
+
server.emit('econnreset', err, req, res, url);
|
|
1570
|
+
return proxyReq.abort();
|
|
1571
|
+
}
|
|
1572
|
+
if (clb) clb(err, req, res, url);
|
|
1573
|
+
else server.emit('error', err, req, res, url);
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
(options.buffer || req).pipe(proxyReq);
|
|
1577
|
+
proxyReq.on('response', function(proxyRes) {
|
|
1578
|
+
if (server) server.emit('proxyRes', proxyRes, req, res);
|
|
1579
|
+
if (!res.headersSent && !options.selfHandleResponse) for(var i = 0; i < web_o.length && !web_o[i](req, res, proxyRes, options); i++);
|
|
1580
|
+
if (res.finished) {
|
|
1581
|
+
if (server) server.emit('end', req, res, proxyRes);
|
|
1582
|
+
} else {
|
|
1583
|
+
proxyRes.on('end', function() {
|
|
1584
|
+
if (server) server.emit('end', req, res, proxyRes);
|
|
1585
|
+
});
|
|
1586
|
+
if (!options.selfHandleResponse) proxyRes.pipe(res);
|
|
1587
|
+
}
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
},
|
|
1592
|
+
"./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1593
|
+
var url = __webpack_require__("url"), common = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/common.js");
|
|
1594
|
+
var redirectRegex = /^201|30(1|2|7|8)$/;
|
|
1595
|
+
/*!
|
|
1596
|
+
* Array of passes.
|
|
1597
|
+
*
|
|
1598
|
+
* A `pass` is just a function that is executed on `req, res, options`
|
|
1599
|
+
* so that you can easily add new checks while still keeping the base
|
|
1600
|
+
* flexible.
|
|
1601
|
+
*/ module.exports = {
|
|
1602
|
+
removeChunked: function(req, res, proxyRes) {
|
|
1603
|
+
if ('1.0' === req.httpVersion) delete proxyRes.headers['transfer-encoding'];
|
|
1604
|
+
},
|
|
1605
|
+
setConnection: function(req, res, proxyRes) {
|
|
1606
|
+
if ('1.0' === req.httpVersion) proxyRes.headers.connection = req.headers.connection || 'close';
|
|
1607
|
+
else if ('2.0' !== req.httpVersion && !proxyRes.headers.connection) proxyRes.headers.connection = req.headers.connection || 'keep-alive';
|
|
1608
|
+
},
|
|
1609
|
+
setRedirectHostRewrite: function(req, res, proxyRes, options) {
|
|
1610
|
+
if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite) && proxyRes.headers['location'] && redirectRegex.test(proxyRes.statusCode)) {
|
|
1611
|
+
var target = url.parse(options.target);
|
|
1612
|
+
var u = url.parse(proxyRes.headers['location']);
|
|
1613
|
+
if (target.host != u.host) return;
|
|
1614
|
+
if (options.hostRewrite) u.host = options.hostRewrite;
|
|
1615
|
+
else if (options.autoRewrite) u.host = req.headers['host'];
|
|
1616
|
+
if (options.protocolRewrite) u.protocol = options.protocolRewrite;
|
|
1617
|
+
proxyRes.headers['location'] = u.format();
|
|
1618
|
+
}
|
|
1619
|
+
},
|
|
1620
|
+
writeHeaders: function(req, res, proxyRes, options) {
|
|
1621
|
+
var rewriteCookieDomainConfig = options.cookieDomainRewrite, rewriteCookiePathConfig = options.cookiePathRewrite, preserveHeaderKeyCase = options.preserveHeaderKeyCase, rawHeaderKeyMap, setHeader = function(key, header) {
|
|
1622
|
+
if (void 0 == header) return;
|
|
1623
|
+
if (rewriteCookieDomainConfig && 'set-cookie' === key.toLowerCase()) header = common.rewriteCookieProperty(header, rewriteCookieDomainConfig, 'domain');
|
|
1624
|
+
if (rewriteCookiePathConfig && 'set-cookie' === key.toLowerCase()) header = common.rewriteCookieProperty(header, rewriteCookiePathConfig, 'path');
|
|
1625
|
+
res.setHeader(String(key).trim(), header);
|
|
1626
|
+
};
|
|
1627
|
+
if ('string' == typeof rewriteCookieDomainConfig) rewriteCookieDomainConfig = {
|
|
1628
|
+
'*': rewriteCookieDomainConfig
|
|
1629
|
+
};
|
|
1630
|
+
if ('string' == typeof rewriteCookiePathConfig) rewriteCookiePathConfig = {
|
|
1631
|
+
'*': rewriteCookiePathConfig
|
|
1632
|
+
};
|
|
1633
|
+
if (preserveHeaderKeyCase && void 0 != proxyRes.rawHeaders) {
|
|
1634
|
+
rawHeaderKeyMap = {};
|
|
1635
|
+
for(var i = 0; i < proxyRes.rawHeaders.length; i += 2){
|
|
1636
|
+
var key = proxyRes.rawHeaders[i];
|
|
1637
|
+
rawHeaderKeyMap[key.toLowerCase()] = key;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
Object.keys(proxyRes.headers).forEach(function(key) {
|
|
1641
|
+
var header = proxyRes.headers[key];
|
|
1642
|
+
if (preserveHeaderKeyCase && rawHeaderKeyMap) key = rawHeaderKeyMap[key] || key;
|
|
1643
|
+
setHeader(key, header);
|
|
1644
|
+
});
|
|
1645
|
+
},
|
|
1646
|
+
writeStatusCode: function(req, res, proxyRes) {
|
|
1647
|
+
if (proxyRes.statusMessage) {
|
|
1648
|
+
res.statusCode = proxyRes.statusCode;
|
|
1649
|
+
res.statusMessage = proxyRes.statusMessage;
|
|
1650
|
+
} else res.statusCode = proxyRes.statusCode;
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
},
|
|
1654
|
+
"./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/passes/ws-incoming.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1655
|
+
var http = __webpack_require__("http"), https = __webpack_require__("https"), common = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/lib/http-proxy/common.js");
|
|
1656
|
+
/*!
|
|
1657
|
+
* Array of passes.
|
|
1658
|
+
*
|
|
1659
|
+
* A `pass` is just a function that is executed on `req, socket, options`
|
|
1660
|
+
* so that you can easily add new checks while still keeping the base
|
|
1661
|
+
* flexible.
|
|
1662
|
+
*/ module.exports = {
|
|
1663
|
+
checkMethodAndHeader: function(req, socket) {
|
|
1664
|
+
if ('GET' !== req.method || !req.headers.upgrade) {
|
|
1665
|
+
socket.destroy();
|
|
1666
|
+
return true;
|
|
1667
|
+
}
|
|
1668
|
+
if ('websocket' !== req.headers.upgrade.toLowerCase()) {
|
|
1669
|
+
socket.destroy();
|
|
1670
|
+
return true;
|
|
1671
|
+
}
|
|
1672
|
+
},
|
|
1673
|
+
XHeaders: function(req, socket, options) {
|
|
1674
|
+
if (!options.xfwd) return;
|
|
1675
|
+
var values = {
|
|
1676
|
+
for: req.connection.remoteAddress || req.socket.remoteAddress,
|
|
1677
|
+
port: common.getPort(req),
|
|
1678
|
+
proto: common.hasEncryptedConnection(req) ? 'wss' : 'ws'
|
|
1679
|
+
};
|
|
1680
|
+
[
|
|
1681
|
+
'for',
|
|
1682
|
+
'port',
|
|
1683
|
+
'proto'
|
|
1684
|
+
].forEach(function(header) {
|
|
1685
|
+
req.headers['x-forwarded-' + header] = (req.headers['x-forwarded-' + header] || '') + (req.headers['x-forwarded-' + header] ? ',' : '') + values[header];
|
|
1686
|
+
});
|
|
1687
|
+
},
|
|
1688
|
+
stream: function(req, socket, options, head, server, clb) {
|
|
1689
|
+
var createHttpHeader = function(line, headers) {
|
|
1690
|
+
return Object.keys(headers).reduce(function(head, key) {
|
|
1691
|
+
var value = headers[key];
|
|
1692
|
+
if (!Array.isArray(value)) {
|
|
1693
|
+
head.push(key + ': ' + value);
|
|
1694
|
+
return head;
|
|
1695
|
+
}
|
|
1696
|
+
for(var i = 0; i < value.length; i++)head.push(key + ': ' + value[i]);
|
|
1697
|
+
return head;
|
|
1698
|
+
}, [
|
|
1699
|
+
line
|
|
1700
|
+
]).join('\r\n') + '\r\n\r\n';
|
|
1701
|
+
};
|
|
1702
|
+
common.setupSocket(socket);
|
|
1703
|
+
if (head && head.length) socket.unshift(head);
|
|
1704
|
+
var proxyReq = (common.isSSL.test(options.target.protocol) ? https : http).request(common.setupOutgoing(options.ssl || {}, options, req));
|
|
1705
|
+
if (server) server.emit('proxyReqWs', proxyReq, req, socket, options, head);
|
|
1706
|
+
proxyReq.on('error', onOutgoingError);
|
|
1707
|
+
proxyReq.on('response', function(res) {
|
|
1708
|
+
if (!res.upgrade) {
|
|
1709
|
+
socket.write(createHttpHeader('HTTP/' + res.httpVersion + ' ' + res.statusCode + ' ' + res.statusMessage, res.headers));
|
|
1710
|
+
res.pipe(socket);
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
|
|
1714
|
+
proxySocket.on('error', onOutgoingError);
|
|
1715
|
+
proxySocket.on('end', function() {
|
|
1716
|
+
server.emit('close', proxyRes, proxySocket, proxyHead);
|
|
1717
|
+
});
|
|
1718
|
+
socket.on('error', function() {
|
|
1719
|
+
proxySocket.end();
|
|
1720
|
+
});
|
|
1721
|
+
common.setupSocket(proxySocket);
|
|
1722
|
+
if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead);
|
|
1723
|
+
socket.write(createHttpHeader('HTTP/1.1 101 Switching Protocols', proxyRes.headers));
|
|
1724
|
+
proxySocket.pipe(socket).pipe(proxySocket);
|
|
1725
|
+
server.emit('open', proxySocket);
|
|
1726
|
+
server.emit('proxySocket', proxySocket);
|
|
1727
|
+
});
|
|
1728
|
+
return proxyReq.end();
|
|
1729
|
+
function onOutgoingError(err) {
|
|
1730
|
+
if (clb) clb(err, req, socket);
|
|
1731
|
+
else server.emit('error', err, req, socket);
|
|
1732
|
+
socket.end();
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
},
|
|
1737
|
+
"./node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js" (module) {
|
|
1738
|
+
/*!
|
|
1739
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
1740
|
+
*
|
|
1741
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
1742
|
+
* Licensed under the MIT License.
|
|
1743
|
+
*/ module.exports = function(str) {
|
|
1744
|
+
if ('string' != typeof str || '' === str) return false;
|
|
1745
|
+
var match;
|
|
1746
|
+
while(match = /(\\).|([@?!+*]\(.*\))/g.exec(str)){
|
|
1747
|
+
if (match[2]) return true;
|
|
1748
|
+
str = str.slice(match.index + match[0].length);
|
|
1749
|
+
}
|
|
1750
|
+
return false;
|
|
1751
|
+
};
|
|
1752
|
+
},
|
|
1753
|
+
"./node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1754
|
+
/*!
|
|
1755
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
1756
|
+
*
|
|
1757
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
1758
|
+
* Released under the MIT License.
|
|
1759
|
+
*/ var isExtglob = __webpack_require__("./node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js");
|
|
1760
|
+
var chars = {
|
|
1761
|
+
'{': '}',
|
|
1762
|
+
'(': ')',
|
|
1763
|
+
'[': ']'
|
|
1764
|
+
};
|
|
1765
|
+
var strictCheck = function(str) {
|
|
1766
|
+
if ('!' === str[0]) return true;
|
|
1767
|
+
var index = 0;
|
|
1768
|
+
var pipeIndex = -2;
|
|
1769
|
+
var closeSquareIndex = -2;
|
|
1770
|
+
var closeCurlyIndex = -2;
|
|
1771
|
+
var closeParenIndex = -2;
|
|
1772
|
+
var backSlashIndex = -2;
|
|
1773
|
+
while(index < str.length){
|
|
1774
|
+
if ('*' === str[index]) return true;
|
|
1775
|
+
if ('?' === str[index + 1] && /[\].+)]/.test(str[index])) return true;
|
|
1776
|
+
if (-1 !== closeSquareIndex && '[' === str[index] && ']' !== str[index + 1]) {
|
|
1777
|
+
if (closeSquareIndex < index) closeSquareIndex = str.indexOf(']', index);
|
|
1778
|
+
if (closeSquareIndex > index) {
|
|
1779
|
+
if (-1 === backSlashIndex || backSlashIndex > closeSquareIndex) return true;
|
|
1780
|
+
backSlashIndex = str.indexOf('\\', index);
|
|
1781
|
+
if (-1 === backSlashIndex || backSlashIndex > closeSquareIndex) return true;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
if (-1 !== closeCurlyIndex && '{' === str[index] && '}' !== str[index + 1]) {
|
|
1785
|
+
closeCurlyIndex = str.indexOf('}', index);
|
|
1786
|
+
if (closeCurlyIndex > index) {
|
|
1787
|
+
backSlashIndex = str.indexOf('\\', index);
|
|
1788
|
+
if (-1 === backSlashIndex || backSlashIndex > closeCurlyIndex) return true;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
if (-1 !== closeParenIndex && '(' === str[index] && '?' === str[index + 1] && /[:!=]/.test(str[index + 2]) && ')' !== str[index + 3]) {
|
|
1792
|
+
closeParenIndex = str.indexOf(')', index);
|
|
1793
|
+
if (closeParenIndex > index) {
|
|
1794
|
+
backSlashIndex = str.indexOf('\\', index);
|
|
1795
|
+
if (-1 === backSlashIndex || backSlashIndex > closeParenIndex) return true;
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
if (-1 !== pipeIndex && '(' === str[index] && '|' !== str[index + 1]) {
|
|
1799
|
+
if (pipeIndex < index) pipeIndex = str.indexOf('|', index);
|
|
1800
|
+
if (-1 !== pipeIndex && ')' !== str[pipeIndex + 1]) {
|
|
1801
|
+
closeParenIndex = str.indexOf(')', pipeIndex);
|
|
1802
|
+
if (closeParenIndex > pipeIndex) {
|
|
1803
|
+
backSlashIndex = str.indexOf('\\', pipeIndex);
|
|
1804
|
+
if (-1 === backSlashIndex || backSlashIndex > closeParenIndex) return true;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
if ('\\' === str[index]) {
|
|
1809
|
+
var open = str[index + 1];
|
|
1810
|
+
index += 2;
|
|
1811
|
+
var close = chars[open];
|
|
1812
|
+
if (close) {
|
|
1813
|
+
var n = str.indexOf(close, index);
|
|
1814
|
+
if (-1 !== n) index = n + 1;
|
|
1815
|
+
}
|
|
1816
|
+
if ('!' === str[index]) return true;
|
|
1817
|
+
} else index++;
|
|
1818
|
+
}
|
|
1819
|
+
return false;
|
|
1820
|
+
};
|
|
1821
|
+
var relaxedCheck = function(str) {
|
|
1822
|
+
if ('!' === str[0]) return true;
|
|
1823
|
+
var index = 0;
|
|
1824
|
+
while(index < str.length){
|
|
1825
|
+
if (/[*?{}()[\]]/.test(str[index])) return true;
|
|
1826
|
+
if ('\\' === str[index]) {
|
|
1827
|
+
var open = str[index + 1];
|
|
1828
|
+
index += 2;
|
|
1829
|
+
var close = chars[open];
|
|
1830
|
+
if (close) {
|
|
1831
|
+
var n = str.indexOf(close, index);
|
|
1832
|
+
if (-1 !== n) index = n + 1;
|
|
1833
|
+
}
|
|
1834
|
+
if ('!' === str[index]) return true;
|
|
1835
|
+
} else index++;
|
|
1836
|
+
}
|
|
1837
|
+
return false;
|
|
1838
|
+
};
|
|
1839
|
+
module.exports = function(str, options) {
|
|
1840
|
+
if ('string' != typeof str || '' === str) return false;
|
|
1841
|
+
if (isExtglob(str)) return true;
|
|
1842
|
+
var check = strictCheck;
|
|
1843
|
+
if (options && false === options.strict) check = relaxedCheck;
|
|
1844
|
+
return check(str);
|
|
1845
|
+
};
|
|
1846
|
+
},
|
|
1847
|
+
"./node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js" (module) {
|
|
1848
|
+
/*!
|
|
1849
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
1850
|
+
*
|
|
1851
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
1852
|
+
* Released under the MIT License.
|
|
1853
|
+
*/ module.exports = function(num) {
|
|
1854
|
+
if ('number' == typeof num) return num - num === 0;
|
|
1855
|
+
if ('string' == typeof num && '' !== num.trim()) return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
|
1856
|
+
return false;
|
|
1857
|
+
};
|
|
1858
|
+
},
|
|
1859
|
+
"./node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.js" (__unused_rspack_module, exports) {
|
|
1860
|
+
/*!
|
|
1861
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
1862
|
+
*
|
|
1863
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
1864
|
+
* Released under the MIT License.
|
|
1865
|
+
*/ function isObject(o) {
|
|
1866
|
+
return '[object Object]' === Object.prototype.toString.call(o);
|
|
1867
|
+
}
|
|
1868
|
+
function isPlainObject(o) {
|
|
1869
|
+
var ctor, prot;
|
|
1870
|
+
if (false === isObject(o)) return false;
|
|
1871
|
+
ctor = o.constructor;
|
|
1872
|
+
if (void 0 === ctor) return true;
|
|
1873
|
+
prot = ctor.prototype;
|
|
1874
|
+
if (false === isObject(prot)) return false;
|
|
1875
|
+
if (false === prot.hasOwnProperty('isPrototypeOf')) return false;
|
|
1876
|
+
return true;
|
|
1877
|
+
}
|
|
1878
|
+
exports.isPlainObject = isPlainObject;
|
|
1879
|
+
},
|
|
1880
|
+
"./node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1881
|
+
const util = __webpack_require__("util");
|
|
1882
|
+
const braces = __webpack_require__("./node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js");
|
|
1883
|
+
const picomatch = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js");
|
|
1884
|
+
const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js");
|
|
1885
|
+
const isEmptyString = (v)=>'' === v || './' === v;
|
|
1886
|
+
const hasBraces = (v)=>{
|
|
1887
|
+
const index = v.indexOf('{');
|
|
1888
|
+
return index > -1 && v.indexOf('}', index) > -1;
|
|
1889
|
+
};
|
|
1890
|
+
const micromatch = (list, patterns, options)=>{
|
|
1891
|
+
patterns = [].concat(patterns);
|
|
1892
|
+
list = [].concat(list);
|
|
1893
|
+
let omit = new Set();
|
|
1894
|
+
let keep = new Set();
|
|
1895
|
+
let items = new Set();
|
|
1896
|
+
let negatives = 0;
|
|
1897
|
+
let onResult = (state)=>{
|
|
1898
|
+
items.add(state.output);
|
|
1899
|
+
if (options && options.onResult) options.onResult(state);
|
|
1900
|
+
};
|
|
1901
|
+
for(let i = 0; i < patterns.length; i++){
|
|
1902
|
+
let isMatch = picomatch(String(patterns[i]), {
|
|
1903
|
+
...options,
|
|
1904
|
+
onResult
|
|
1905
|
+
}, true);
|
|
1906
|
+
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
1907
|
+
if (negated) negatives++;
|
|
1908
|
+
for (let item of list){
|
|
1909
|
+
let matched = isMatch(item, true);
|
|
1910
|
+
let match = negated ? !matched.isMatch : matched.isMatch;
|
|
1911
|
+
if (match) if (negated) omit.add(matched.output);
|
|
1912
|
+
else {
|
|
1913
|
+
omit.delete(matched.output);
|
|
1914
|
+
keep.add(matched.output);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
let result = negatives === patterns.length ? [
|
|
1919
|
+
...items
|
|
1920
|
+
] : [
|
|
1921
|
+
...keep
|
|
1922
|
+
];
|
|
1923
|
+
let matches = result.filter((item)=>!omit.has(item));
|
|
1924
|
+
if (options && 0 === matches.length) {
|
|
1925
|
+
if (true === options.failglob) throw new Error(`No matches found for "${patterns.join(', ')}"`);
|
|
1926
|
+
if (true === options.nonull || true === options.nullglob) return options.unescape ? patterns.map((p)=>p.replace(/\\/g, '')) : patterns;
|
|
1927
|
+
}
|
|
1928
|
+
return matches;
|
|
1929
|
+
};
|
|
1930
|
+
micromatch.match = micromatch;
|
|
1931
|
+
micromatch.matcher = (pattern, options)=>picomatch(pattern, options);
|
|
1932
|
+
micromatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
|
|
1933
|
+
micromatch.any = micromatch.isMatch;
|
|
1934
|
+
micromatch.not = (list, patterns, options = {})=>{
|
|
1935
|
+
patterns = [].concat(patterns).map(String);
|
|
1936
|
+
let result = new Set();
|
|
1937
|
+
let items = [];
|
|
1938
|
+
let onResult = (state)=>{
|
|
1939
|
+
if (options.onResult) options.onResult(state);
|
|
1940
|
+
items.push(state.output);
|
|
1941
|
+
};
|
|
1942
|
+
let matches = new Set(micromatch(list, patterns, {
|
|
1943
|
+
...options,
|
|
1944
|
+
onResult
|
|
1945
|
+
}));
|
|
1946
|
+
for (let item of items)if (!matches.has(item)) result.add(item);
|
|
1947
|
+
return [
|
|
1948
|
+
...result
|
|
1949
|
+
];
|
|
1950
|
+
};
|
|
1951
|
+
micromatch.contains = (str, pattern, options)=>{
|
|
1952
|
+
if ('string' != typeof str) throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
1953
|
+
if (Array.isArray(pattern)) return pattern.some((p)=>micromatch.contains(str, p, options));
|
|
1954
|
+
if ('string' == typeof pattern) {
|
|
1955
|
+
if (isEmptyString(str) || isEmptyString(pattern)) return false;
|
|
1956
|
+
if (str.includes(pattern) || str.startsWith('./') && str.slice(2).includes(pattern)) return true;
|
|
1957
|
+
}
|
|
1958
|
+
return micromatch.isMatch(str, pattern, {
|
|
1959
|
+
...options,
|
|
1960
|
+
contains: true
|
|
1961
|
+
});
|
|
1962
|
+
};
|
|
1963
|
+
micromatch.matchKeys = (obj, patterns, options)=>{
|
|
1964
|
+
if (!utils.isObject(obj)) throw new TypeError('Expected the first argument to be an object');
|
|
1965
|
+
let keys = micromatch(Object.keys(obj), patterns, options);
|
|
1966
|
+
let res = {};
|
|
1967
|
+
for (let key of keys)res[key] = obj[key];
|
|
1968
|
+
return res;
|
|
1969
|
+
};
|
|
1970
|
+
micromatch.some = (list, patterns, options)=>{
|
|
1971
|
+
let items = [].concat(list);
|
|
1972
|
+
for (let pattern of [].concat(patterns)){
|
|
1973
|
+
let isMatch = picomatch(String(pattern), options);
|
|
1974
|
+
if (items.some((item)=>isMatch(item))) return true;
|
|
1975
|
+
}
|
|
1976
|
+
return false;
|
|
1977
|
+
};
|
|
1978
|
+
micromatch.every = (list, patterns, options)=>{
|
|
1979
|
+
let items = [].concat(list);
|
|
1980
|
+
for (let pattern of [].concat(patterns)){
|
|
1981
|
+
let isMatch = picomatch(String(pattern), options);
|
|
1982
|
+
if (!items.every((item)=>isMatch(item))) return false;
|
|
1983
|
+
}
|
|
1984
|
+
return true;
|
|
1985
|
+
};
|
|
1986
|
+
micromatch.all = (str, patterns, options)=>{
|
|
1987
|
+
if ('string' != typeof str) throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
1988
|
+
return [].concat(patterns).every((p)=>picomatch(p, options)(str));
|
|
1989
|
+
};
|
|
1990
|
+
micromatch.capture = (glob, input, options)=>{
|
|
1991
|
+
let posix = utils.isWindows(options);
|
|
1992
|
+
let regex = picomatch.makeRe(String(glob), {
|
|
1993
|
+
...options,
|
|
1994
|
+
capture: true
|
|
1995
|
+
});
|
|
1996
|
+
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
|
1997
|
+
if (match) return match.slice(1).map((v)=>void 0 === v ? '' : v);
|
|
1998
|
+
};
|
|
1999
|
+
micromatch.makeRe = (...args)=>picomatch.makeRe(...args);
|
|
2000
|
+
micromatch.scan = (...args)=>picomatch.scan(...args);
|
|
2001
|
+
micromatch.parse = (patterns, options)=>{
|
|
2002
|
+
let res = [];
|
|
2003
|
+
for (let pattern of [].concat(patterns || []))for (let str of braces(String(pattern), options))res.push(picomatch.parse(str, options));
|
|
2004
|
+
return res;
|
|
2005
|
+
};
|
|
2006
|
+
micromatch.braces = (pattern, options)=>{
|
|
2007
|
+
if ('string' != typeof pattern) throw new TypeError('Expected a string');
|
|
2008
|
+
if (options && true === options.nobrace || !hasBraces(pattern)) return [
|
|
2009
|
+
pattern
|
|
2010
|
+
];
|
|
2011
|
+
return braces(pattern, options);
|
|
2012
|
+
};
|
|
2013
|
+
micromatch.braceExpand = (pattern, options)=>{
|
|
2014
|
+
if ('string' != typeof pattern) throw new TypeError('Expected a string');
|
|
2015
|
+
return micromatch.braces(pattern, {
|
|
2016
|
+
...options,
|
|
2017
|
+
expand: true
|
|
2018
|
+
});
|
|
2019
|
+
};
|
|
2020
|
+
micromatch.hasBraces = hasBraces;
|
|
2021
|
+
module.exports = micromatch;
|
|
2022
|
+
},
|
|
2023
|
+
"./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
2024
|
+
module.exports = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js");
|
|
2025
|
+
},
|
|
2026
|
+
"./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
2027
|
+
const path = __webpack_require__("path");
|
|
2028
|
+
const WIN_SLASH = '\\\\/';
|
|
2029
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
2030
|
+
const DOT_LITERAL = '\\.';
|
|
2031
|
+
const PLUS_LITERAL = '\\+';
|
|
2032
|
+
const QMARK_LITERAL = '\\?';
|
|
2033
|
+
const SLASH_LITERAL = '\\/';
|
|
2034
|
+
const ONE_CHAR = '(?=.)';
|
|
2035
|
+
const QMARK = '[^/]';
|
|
2036
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
2037
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
2038
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
2039
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
2040
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
2041
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
2042
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
2043
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
2044
|
+
const STAR = `${QMARK}*?`;
|
|
2045
|
+
const POSIX_CHARS = {
|
|
2046
|
+
DOT_LITERAL,
|
|
2047
|
+
PLUS_LITERAL,
|
|
2048
|
+
QMARK_LITERAL,
|
|
2049
|
+
SLASH_LITERAL,
|
|
2050
|
+
ONE_CHAR,
|
|
2051
|
+
QMARK,
|
|
2052
|
+
END_ANCHOR,
|
|
2053
|
+
DOTS_SLASH,
|
|
2054
|
+
NO_DOT,
|
|
2055
|
+
NO_DOTS,
|
|
2056
|
+
NO_DOT_SLASH,
|
|
2057
|
+
NO_DOTS_SLASH,
|
|
2058
|
+
QMARK_NO_DOT,
|
|
2059
|
+
STAR,
|
|
2060
|
+
START_ANCHOR
|
|
2061
|
+
};
|
|
2062
|
+
const WINDOWS_CHARS = {
|
|
2063
|
+
...POSIX_CHARS,
|
|
2064
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
2065
|
+
QMARK: WIN_NO_SLASH,
|
|
2066
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
2067
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
2068
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
2069
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2070
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
2071
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2072
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
2073
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
2074
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
2075
|
+
};
|
|
2076
|
+
const POSIX_REGEX_SOURCE = {
|
|
2077
|
+
alnum: 'a-zA-Z0-9',
|
|
2078
|
+
alpha: 'a-zA-Z',
|
|
2079
|
+
ascii: '\\x00-\\x7F',
|
|
2080
|
+
blank: ' \\t',
|
|
2081
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
2082
|
+
digit: '0-9',
|
|
2083
|
+
graph: '\\x21-\\x7E',
|
|
2084
|
+
lower: 'a-z',
|
|
2085
|
+
print: '\\x20-\\x7E ',
|
|
2086
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
2087
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
2088
|
+
upper: 'A-Z',
|
|
2089
|
+
word: 'A-Za-z0-9_',
|
|
2090
|
+
xdigit: 'A-Fa-f0-9'
|
|
2091
|
+
};
|
|
2092
|
+
module.exports = {
|
|
2093
|
+
MAX_LENGTH: 65536,
|
|
2094
|
+
POSIX_REGEX_SOURCE,
|
|
2095
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
2096
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
2097
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
2098
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
2099
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
2100
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
2101
|
+
REPLACEMENTS: {
|
|
2102
|
+
'***': '*',
|
|
2103
|
+
'**/**': '**',
|
|
2104
|
+
'**/**/**': '**'
|
|
2105
|
+
},
|
|
2106
|
+
CHAR_0: 48,
|
|
2107
|
+
CHAR_9: 57,
|
|
2108
|
+
CHAR_UPPERCASE_A: 65,
|
|
2109
|
+
CHAR_LOWERCASE_A: 97,
|
|
2110
|
+
CHAR_UPPERCASE_Z: 90,
|
|
2111
|
+
CHAR_LOWERCASE_Z: 122,
|
|
2112
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
2113
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
2114
|
+
CHAR_ASTERISK: 42,
|
|
2115
|
+
CHAR_AMPERSAND: 38,
|
|
2116
|
+
CHAR_AT: 64,
|
|
2117
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
2118
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
2119
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
2120
|
+
CHAR_COLON: 58,
|
|
2121
|
+
CHAR_COMMA: 44,
|
|
2122
|
+
CHAR_DOT: 46,
|
|
2123
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
2124
|
+
CHAR_EQUAL: 61,
|
|
2125
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
2126
|
+
CHAR_FORM_FEED: 12,
|
|
2127
|
+
CHAR_FORWARD_SLASH: 47,
|
|
2128
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
2129
|
+
CHAR_HASH: 35,
|
|
2130
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
2131
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
2132
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
2133
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
2134
|
+
CHAR_LINE_FEED: 10,
|
|
2135
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
2136
|
+
CHAR_PERCENT: 37,
|
|
2137
|
+
CHAR_PLUS: 43,
|
|
2138
|
+
CHAR_QUESTION_MARK: 63,
|
|
2139
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
2140
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
2141
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
2142
|
+
CHAR_SEMICOLON: 59,
|
|
2143
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
2144
|
+
CHAR_SPACE: 32,
|
|
2145
|
+
CHAR_TAB: 9,
|
|
2146
|
+
CHAR_UNDERSCORE: 95,
|
|
2147
|
+
CHAR_VERTICAL_LINE: 124,
|
|
2148
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
2149
|
+
SEP: path.sep,
|
|
2150
|
+
extglobChars (chars) {
|
|
2151
|
+
return {
|
|
2152
|
+
'!': {
|
|
2153
|
+
type: 'negate',
|
|
2154
|
+
open: '(?:(?!(?:',
|
|
2155
|
+
close: `))${chars.STAR})`
|
|
2156
|
+
},
|
|
2157
|
+
'?': {
|
|
2158
|
+
type: 'qmark',
|
|
2159
|
+
open: '(?:',
|
|
2160
|
+
close: ')?'
|
|
2161
|
+
},
|
|
2162
|
+
'+': {
|
|
2163
|
+
type: 'plus',
|
|
2164
|
+
open: '(?:',
|
|
2165
|
+
close: ')+'
|
|
2166
|
+
},
|
|
2167
|
+
'*': {
|
|
2168
|
+
type: 'star',
|
|
2169
|
+
open: '(?:',
|
|
2170
|
+
close: ')*'
|
|
2171
|
+
},
|
|
2172
|
+
'@': {
|
|
2173
|
+
type: 'at',
|
|
2174
|
+
open: '(?:',
|
|
2175
|
+
close: ')'
|
|
2176
|
+
}
|
|
2177
|
+
};
|
|
2178
|
+
},
|
|
2179
|
+
globChars (win32) {
|
|
2180
|
+
return true === win32 ? WINDOWS_CHARS : POSIX_CHARS;
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
},
|
|
2184
|
+
"./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
2185
|
+
const constants = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js");
|
|
2186
|
+
const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js");
|
|
2187
|
+
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
|
|
2188
|
+
const expandRange = (args, options)=>{
|
|
2189
|
+
if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
|
|
2190
|
+
args.sort();
|
|
2191
|
+
const value = `[${args.join('-')}]`;
|
|
2192
|
+
try {
|
|
2193
|
+
new RegExp(value);
|
|
2194
|
+
} catch (ex) {
|
|
2195
|
+
return args.map((v)=>utils.escapeRegex(v)).join('..');
|
|
2196
|
+
}
|
|
2197
|
+
return value;
|
|
2198
|
+
};
|
|
2199
|
+
const syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
2200
|
+
const parse = (input, options)=>{
|
|
2201
|
+
if ('string' != typeof input) throw new TypeError('Expected a string');
|
|
2202
|
+
input = REPLACEMENTS[input] || input;
|
|
2203
|
+
const opts = {
|
|
2204
|
+
...options
|
|
2205
|
+
};
|
|
2206
|
+
const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2207
|
+
let len = input.length;
|
|
2208
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
2209
|
+
const bos = {
|
|
2210
|
+
type: 'bos',
|
|
2211
|
+
value: '',
|
|
2212
|
+
output: opts.prepend || ''
|
|
2213
|
+
};
|
|
2214
|
+
const tokens = [
|
|
2215
|
+
bos
|
|
2216
|
+
];
|
|
2217
|
+
const capture = opts.capture ? '' : '?:';
|
|
2218
|
+
const win32 = utils.isWindows(options);
|
|
2219
|
+
const PLATFORM_CHARS = constants.globChars(win32);
|
|
2220
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
2221
|
+
const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
|
|
2222
|
+
const globstar = (opts)=>`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
2223
|
+
const nodot = opts.dot ? '' : NO_DOT;
|
|
2224
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
2225
|
+
let star = true === opts.bash ? globstar(opts) : STAR;
|
|
2226
|
+
if (opts.capture) star = `(${star})`;
|
|
2227
|
+
if ('boolean' == typeof opts.noext) opts.noextglob = opts.noext;
|
|
2228
|
+
const state = {
|
|
2229
|
+
input,
|
|
2230
|
+
index: -1,
|
|
2231
|
+
start: 0,
|
|
2232
|
+
dot: true === opts.dot,
|
|
2233
|
+
consumed: '',
|
|
2234
|
+
output: '',
|
|
2235
|
+
prefix: '',
|
|
2236
|
+
backtrack: false,
|
|
2237
|
+
negated: false,
|
|
2238
|
+
brackets: 0,
|
|
2239
|
+
braces: 0,
|
|
2240
|
+
parens: 0,
|
|
2241
|
+
quotes: 0,
|
|
2242
|
+
globstar: false,
|
|
2243
|
+
tokens
|
|
2244
|
+
};
|
|
2245
|
+
input = utils.removePrefix(input, state);
|
|
2246
|
+
len = input.length;
|
|
2247
|
+
const extglobs = [];
|
|
2248
|
+
const braces = [];
|
|
2249
|
+
const stack = [];
|
|
2250
|
+
let prev = bos;
|
|
2251
|
+
let value;
|
|
2252
|
+
const eos = ()=>state.index === len - 1;
|
|
2253
|
+
const peek = state.peek = (n = 1)=>input[state.index + n];
|
|
2254
|
+
const advance = state.advance = ()=>input[++state.index] || '';
|
|
2255
|
+
const remaining = ()=>input.slice(state.index + 1);
|
|
2256
|
+
const consume = (value = '', num = 0)=>{
|
|
2257
|
+
state.consumed += value;
|
|
2258
|
+
state.index += num;
|
|
2259
|
+
};
|
|
2260
|
+
const append = (token)=>{
|
|
2261
|
+
state.output += null != token.output ? token.output : token.value;
|
|
2262
|
+
consume(token.value);
|
|
2263
|
+
};
|
|
2264
|
+
const negate = ()=>{
|
|
2265
|
+
let count = 1;
|
|
2266
|
+
while('!' === peek() && ('(' !== peek(2) || '?' === peek(3))){
|
|
2267
|
+
advance();
|
|
2268
|
+
state.start++;
|
|
2269
|
+
count++;
|
|
2270
|
+
}
|
|
2271
|
+
if (count % 2 === 0) return false;
|
|
2272
|
+
state.negated = true;
|
|
2273
|
+
state.start++;
|
|
2274
|
+
return true;
|
|
2275
|
+
};
|
|
2276
|
+
const increment = (type)=>{
|
|
2277
|
+
state[type]++;
|
|
2278
|
+
stack.push(type);
|
|
2279
|
+
};
|
|
2280
|
+
const decrement = (type)=>{
|
|
2281
|
+
state[type]--;
|
|
2282
|
+
stack.pop();
|
|
2283
|
+
};
|
|
2284
|
+
const push = (tok)=>{
|
|
2285
|
+
if ('globstar' === prev.type) {
|
|
2286
|
+
const isBrace = state.braces > 0 && ('comma' === tok.type || 'brace' === tok.type);
|
|
2287
|
+
const isExtglob = true === tok.extglob || extglobs.length && ('pipe' === tok.type || 'paren' === tok.type);
|
|
2288
|
+
if ('slash' !== tok.type && 'paren' !== tok.type && !isBrace && !isExtglob) {
|
|
2289
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
2290
|
+
prev.type = 'star';
|
|
2291
|
+
prev.value = '*';
|
|
2292
|
+
prev.output = star;
|
|
2293
|
+
state.output += prev.output;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
if (extglobs.length && 'paren' !== tok.type) extglobs[extglobs.length - 1].inner += tok.value;
|
|
2297
|
+
if (tok.value || tok.output) append(tok);
|
|
2298
|
+
if (prev && 'text' === prev.type && 'text' === tok.type) {
|
|
2299
|
+
prev.value += tok.value;
|
|
2300
|
+
prev.output = (prev.output || '') + tok.value;
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
tok.prev = prev;
|
|
2304
|
+
tokens.push(tok);
|
|
2305
|
+
prev = tok;
|
|
2306
|
+
};
|
|
2307
|
+
const extglobOpen = (type, value)=>{
|
|
2308
|
+
const token = {
|
|
2309
|
+
...EXTGLOB_CHARS[value],
|
|
2310
|
+
conditions: 1,
|
|
2311
|
+
inner: ''
|
|
2312
|
+
};
|
|
2313
|
+
token.prev = prev;
|
|
2314
|
+
token.parens = state.parens;
|
|
2315
|
+
token.output = state.output;
|
|
2316
|
+
const output = (opts.capture ? '(' : '') + token.open;
|
|
2317
|
+
increment('parens');
|
|
2318
|
+
push({
|
|
2319
|
+
type,
|
|
2320
|
+
value,
|
|
2321
|
+
output: state.output ? '' : ONE_CHAR
|
|
2322
|
+
});
|
|
2323
|
+
push({
|
|
2324
|
+
type: 'paren',
|
|
2325
|
+
extglob: true,
|
|
2326
|
+
value: advance(),
|
|
2327
|
+
output
|
|
2328
|
+
});
|
|
2329
|
+
extglobs.push(token);
|
|
2330
|
+
};
|
|
2331
|
+
const extglobClose = (token)=>{
|
|
2332
|
+
let output = token.close + (opts.capture ? ')' : '');
|
|
2333
|
+
let rest;
|
|
2334
|
+
if ('negate' === token.type) {
|
|
2335
|
+
let extglobStar = star;
|
|
2336
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) extglobStar = globstar(opts);
|
|
2337
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
2338
|
+
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
2339
|
+
const expression = parse(rest, {
|
|
2340
|
+
...options,
|
|
2341
|
+
fastpaths: false
|
|
2342
|
+
}).output;
|
|
2343
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
2344
|
+
}
|
|
2345
|
+
if ('bos' === token.prev.type) state.negatedExtglob = true;
|
|
2346
|
+
}
|
|
2347
|
+
push({
|
|
2348
|
+
type: 'paren',
|
|
2349
|
+
extglob: true,
|
|
2350
|
+
value,
|
|
2351
|
+
output
|
|
2352
|
+
});
|
|
2353
|
+
decrement('parens');
|
|
2354
|
+
};
|
|
2355
|
+
if (false !== opts.fastpaths && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
2356
|
+
let backslashes = false;
|
|
2357
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index)=>{
|
|
2358
|
+
if ('\\' === first) {
|
|
2359
|
+
backslashes = true;
|
|
2360
|
+
return m;
|
|
2361
|
+
}
|
|
2362
|
+
if ('?' === first) {
|
|
2363
|
+
if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
2364
|
+
if (0 === index) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
2365
|
+
return QMARK.repeat(chars.length);
|
|
2366
|
+
}
|
|
2367
|
+
if ('.' === first) return DOT_LITERAL.repeat(chars.length);
|
|
2368
|
+
if ('*' === first) {
|
|
2369
|
+
if (esc) return esc + first + (rest ? star : '');
|
|
2370
|
+
return star;
|
|
2371
|
+
}
|
|
2372
|
+
return esc ? m : `\\${m}`;
|
|
2373
|
+
});
|
|
2374
|
+
if (true === backslashes) output = true === opts.unescape ? output.replace(/\\/g, '') : output.replace(/\\+/g, (m)=>m.length % 2 === 0 ? '\\\\' : m ? '\\' : '');
|
|
2375
|
+
if (output === input && true === opts.contains) {
|
|
2376
|
+
state.output = input;
|
|
2377
|
+
return state;
|
|
2378
|
+
}
|
|
2379
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
2380
|
+
return state;
|
|
2381
|
+
}
|
|
2382
|
+
while(!eos()){
|
|
2383
|
+
value = advance();
|
|
2384
|
+
if ('\u0000' === value) continue;
|
|
2385
|
+
if ('\\' === value) {
|
|
2386
|
+
const next = peek();
|
|
2387
|
+
if ('/' === next && true !== opts.bash) continue;
|
|
2388
|
+
if ('.' === next || ';' === next) continue;
|
|
2389
|
+
if (!next) {
|
|
2390
|
+
value += '\\';
|
|
2391
|
+
push({
|
|
2392
|
+
type: 'text',
|
|
2393
|
+
value
|
|
2394
|
+
});
|
|
2395
|
+
continue;
|
|
2396
|
+
}
|
|
2397
|
+
const match = /^\\+/.exec(remaining());
|
|
2398
|
+
let slashes = 0;
|
|
2399
|
+
if (match && match[0].length > 2) {
|
|
2400
|
+
slashes = match[0].length;
|
|
2401
|
+
state.index += slashes;
|
|
2402
|
+
if (slashes % 2 !== 0) value += '\\';
|
|
2403
|
+
}
|
|
2404
|
+
if (true === opts.unescape) value = advance();
|
|
2405
|
+
else value += advance();
|
|
2406
|
+
if (0 === state.brackets) {
|
|
2407
|
+
push({
|
|
2408
|
+
type: 'text',
|
|
2409
|
+
value
|
|
2410
|
+
});
|
|
2411
|
+
continue;
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
if (state.brackets > 0 && (']' !== value || '[' === prev.value || '[^' === prev.value)) {
|
|
2415
|
+
if (false !== opts.posix && ':' === value) {
|
|
2416
|
+
const inner = prev.value.slice(1);
|
|
2417
|
+
if (inner.includes('[')) {
|
|
2418
|
+
prev.posix = true;
|
|
2419
|
+
if (inner.includes(':')) {
|
|
2420
|
+
const idx = prev.value.lastIndexOf('[');
|
|
2421
|
+
const pre = prev.value.slice(0, idx);
|
|
2422
|
+
const rest = prev.value.slice(idx + 2);
|
|
2423
|
+
const posix = POSIX_REGEX_SOURCE[rest];
|
|
2424
|
+
if (posix) {
|
|
2425
|
+
prev.value = pre + posix;
|
|
2426
|
+
state.backtrack = true;
|
|
2427
|
+
advance();
|
|
2428
|
+
if (!bos.output && 1 === tokens.indexOf(prev)) bos.output = ONE_CHAR;
|
|
2429
|
+
continue;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
if ('[' === value && ':' !== peek() || '-' === value && ']' === peek()) value = `\\${value}`;
|
|
2435
|
+
if (']' === value && ('[' === prev.value || '[^' === prev.value)) value = `\\${value}`;
|
|
2436
|
+
if (true === opts.posix && '!' === value && '[' === prev.value) value = '^';
|
|
2437
|
+
prev.value += value;
|
|
2438
|
+
append({
|
|
2439
|
+
value
|
|
2440
|
+
});
|
|
2441
|
+
continue;
|
|
2442
|
+
}
|
|
2443
|
+
if (1 === state.quotes && '"' !== value) {
|
|
2444
|
+
value = utils.escapeRegex(value);
|
|
2445
|
+
prev.value += value;
|
|
2446
|
+
append({
|
|
2447
|
+
value
|
|
2448
|
+
});
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
if ('"' === value) {
|
|
2452
|
+
state.quotes = 1 === state.quotes ? 0 : 1;
|
|
2453
|
+
if (true === opts.keepQuotes) push({
|
|
2454
|
+
type: 'text',
|
|
2455
|
+
value
|
|
2456
|
+
});
|
|
2457
|
+
continue;
|
|
2458
|
+
}
|
|
2459
|
+
if ('(' === value) {
|
|
2460
|
+
increment('parens');
|
|
2461
|
+
push({
|
|
2462
|
+
type: 'paren',
|
|
2463
|
+
value
|
|
2464
|
+
});
|
|
2465
|
+
continue;
|
|
2466
|
+
}
|
|
2467
|
+
if (')' === value) {
|
|
2468
|
+
if (0 === state.parens && true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '('));
|
|
2469
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
2470
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
2471
|
+
extglobClose(extglobs.pop());
|
|
2472
|
+
continue;
|
|
2473
|
+
}
|
|
2474
|
+
push({
|
|
2475
|
+
type: 'paren',
|
|
2476
|
+
value,
|
|
2477
|
+
output: state.parens ? ')' : '\\)'
|
|
2478
|
+
});
|
|
2479
|
+
decrement('parens');
|
|
2480
|
+
continue;
|
|
2481
|
+
}
|
|
2482
|
+
if ('[' === value) {
|
|
2483
|
+
if (true !== opts.nobracket && remaining().includes(']')) increment('brackets');
|
|
2484
|
+
else {
|
|
2485
|
+
if (true !== opts.nobracket && true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
|
|
2486
|
+
value = `\\${value}`;
|
|
2487
|
+
}
|
|
2488
|
+
push({
|
|
2489
|
+
type: 'bracket',
|
|
2490
|
+
value
|
|
2491
|
+
});
|
|
2492
|
+
continue;
|
|
2493
|
+
}
|
|
2494
|
+
if (']' === value) {
|
|
2495
|
+
if (true === opts.nobracket || prev && 'bracket' === prev.type && 1 === prev.value.length) {
|
|
2496
|
+
push({
|
|
2497
|
+
type: 'text',
|
|
2498
|
+
value,
|
|
2499
|
+
output: `\\${value}`
|
|
2500
|
+
});
|
|
2501
|
+
continue;
|
|
2502
|
+
}
|
|
2503
|
+
if (0 === state.brackets) {
|
|
2504
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '['));
|
|
2505
|
+
push({
|
|
2506
|
+
type: 'text',
|
|
2507
|
+
value,
|
|
2508
|
+
output: `\\${value}`
|
|
2509
|
+
});
|
|
2510
|
+
continue;
|
|
2511
|
+
}
|
|
2512
|
+
decrement('brackets');
|
|
2513
|
+
const prevValue = prev.value.slice(1);
|
|
2514
|
+
if (true !== prev.posix && '^' === prevValue[0] && !prevValue.includes('/')) value = `/${value}`;
|
|
2515
|
+
prev.value += value;
|
|
2516
|
+
append({
|
|
2517
|
+
value
|
|
2518
|
+
});
|
|
2519
|
+
if (false === opts.literalBrackets || utils.hasRegexChars(prevValue)) continue;
|
|
2520
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
2521
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
2522
|
+
if (true === opts.literalBrackets) {
|
|
2523
|
+
state.output += escaped;
|
|
2524
|
+
prev.value = escaped;
|
|
2525
|
+
continue;
|
|
2526
|
+
}
|
|
2527
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
2528
|
+
state.output += prev.value;
|
|
2529
|
+
continue;
|
|
2530
|
+
}
|
|
2531
|
+
if ('{' === value && true !== opts.nobrace) {
|
|
2532
|
+
increment('braces');
|
|
2533
|
+
const open = {
|
|
2534
|
+
type: 'brace',
|
|
2535
|
+
value,
|
|
2536
|
+
output: '(',
|
|
2537
|
+
outputIndex: state.output.length,
|
|
2538
|
+
tokensIndex: state.tokens.length
|
|
2539
|
+
};
|
|
2540
|
+
braces.push(open);
|
|
2541
|
+
push(open);
|
|
2542
|
+
continue;
|
|
2543
|
+
}
|
|
2544
|
+
if ('}' === value) {
|
|
2545
|
+
const brace = braces[braces.length - 1];
|
|
2546
|
+
if (true === opts.nobrace || !brace) {
|
|
2547
|
+
push({
|
|
2548
|
+
type: 'text',
|
|
2549
|
+
value,
|
|
2550
|
+
output: value
|
|
2551
|
+
});
|
|
2552
|
+
continue;
|
|
2553
|
+
}
|
|
2554
|
+
let output = ')';
|
|
2555
|
+
if (true === brace.dots) {
|
|
2556
|
+
const arr = tokens.slice();
|
|
2557
|
+
const range = [];
|
|
2558
|
+
for(let i = arr.length - 1; i >= 0; i--){
|
|
2559
|
+
tokens.pop();
|
|
2560
|
+
if ('brace' === arr[i].type) break;
|
|
2561
|
+
if ('dots' !== arr[i].type) range.unshift(arr[i].value);
|
|
2562
|
+
}
|
|
2563
|
+
output = expandRange(range, opts);
|
|
2564
|
+
state.backtrack = true;
|
|
2565
|
+
}
|
|
2566
|
+
if (true !== brace.comma && true !== brace.dots) {
|
|
2567
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
2568
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
2569
|
+
brace.value = brace.output = '\\{';
|
|
2570
|
+
value = output = '\\}';
|
|
2571
|
+
state.output = out;
|
|
2572
|
+
for (const t of toks)state.output += t.output || t.value;
|
|
2573
|
+
}
|
|
2574
|
+
push({
|
|
2575
|
+
type: 'brace',
|
|
2576
|
+
value,
|
|
2577
|
+
output
|
|
2578
|
+
});
|
|
2579
|
+
decrement('braces');
|
|
2580
|
+
braces.pop();
|
|
2581
|
+
continue;
|
|
2582
|
+
}
|
|
2583
|
+
if ('|' === value) {
|
|
2584
|
+
if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
|
|
2585
|
+
push({
|
|
2586
|
+
type: 'text',
|
|
2587
|
+
value
|
|
2588
|
+
});
|
|
2589
|
+
continue;
|
|
2590
|
+
}
|
|
2591
|
+
if (',' === value) {
|
|
2592
|
+
let output = value;
|
|
2593
|
+
const brace = braces[braces.length - 1];
|
|
2594
|
+
if (brace && 'braces' === stack[stack.length - 1]) {
|
|
2595
|
+
brace.comma = true;
|
|
2596
|
+
output = '|';
|
|
2597
|
+
}
|
|
2598
|
+
push({
|
|
2599
|
+
type: 'comma',
|
|
2600
|
+
value,
|
|
2601
|
+
output
|
|
2602
|
+
});
|
|
2603
|
+
continue;
|
|
2604
|
+
}
|
|
2605
|
+
if ('/' === value) {
|
|
2606
|
+
if ('dot' === prev.type && state.index === state.start + 1) {
|
|
2607
|
+
state.start = state.index + 1;
|
|
2608
|
+
state.consumed = '';
|
|
2609
|
+
state.output = '';
|
|
2610
|
+
tokens.pop();
|
|
2611
|
+
prev = bos;
|
|
2612
|
+
continue;
|
|
2613
|
+
}
|
|
2614
|
+
push({
|
|
2615
|
+
type: 'slash',
|
|
2616
|
+
value,
|
|
2617
|
+
output: SLASH_LITERAL
|
|
2618
|
+
});
|
|
2619
|
+
continue;
|
|
2620
|
+
}
|
|
2621
|
+
if ('.' === value) {
|
|
2622
|
+
if (state.braces > 0 && 'dot' === prev.type) {
|
|
2623
|
+
if ('.' === prev.value) prev.output = DOT_LITERAL;
|
|
2624
|
+
const brace = braces[braces.length - 1];
|
|
2625
|
+
prev.type = 'dots';
|
|
2626
|
+
prev.output += value;
|
|
2627
|
+
prev.value += value;
|
|
2628
|
+
brace.dots = true;
|
|
2629
|
+
continue;
|
|
2630
|
+
}
|
|
2631
|
+
if (state.braces + state.parens === 0 && 'bos' !== prev.type && 'slash' !== prev.type) {
|
|
2632
|
+
push({
|
|
2633
|
+
type: 'text',
|
|
2634
|
+
value,
|
|
2635
|
+
output: DOT_LITERAL
|
|
2636
|
+
});
|
|
2637
|
+
continue;
|
|
2638
|
+
}
|
|
2639
|
+
push({
|
|
2640
|
+
type: 'dot',
|
|
2641
|
+
value,
|
|
2642
|
+
output: DOT_LITERAL
|
|
2643
|
+
});
|
|
2644
|
+
continue;
|
|
2645
|
+
}
|
|
2646
|
+
if ('?' === value) {
|
|
2647
|
+
const isGroup = prev && '(' === prev.value;
|
|
2648
|
+
if (!isGroup && true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
2649
|
+
extglobOpen('qmark', value);
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
if (prev && 'paren' === prev.type) {
|
|
2653
|
+
const next = peek();
|
|
2654
|
+
let output = value;
|
|
2655
|
+
if ('<' === next && !utils.supportsLookbehinds()) throw new Error('Node.js v10 or higher is required for regex lookbehinds');
|
|
2656
|
+
if ('(' === prev.value && !/[!=<:]/.test(next) || '<' === next && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
|
|
2657
|
+
push({
|
|
2658
|
+
type: 'text',
|
|
2659
|
+
value,
|
|
2660
|
+
output
|
|
2661
|
+
});
|
|
2662
|
+
continue;
|
|
2663
|
+
}
|
|
2664
|
+
if (true !== opts.dot && ('slash' === prev.type || 'bos' === prev.type)) {
|
|
2665
|
+
push({
|
|
2666
|
+
type: 'qmark',
|
|
2667
|
+
value,
|
|
2668
|
+
output: QMARK_NO_DOT
|
|
2669
|
+
});
|
|
2670
|
+
continue;
|
|
2671
|
+
}
|
|
2672
|
+
push({
|
|
2673
|
+
type: 'qmark',
|
|
2674
|
+
value,
|
|
2675
|
+
output: QMARK
|
|
2676
|
+
});
|
|
2677
|
+
continue;
|
|
2678
|
+
}
|
|
2679
|
+
if ('!' === value) {
|
|
2680
|
+
if (true !== opts.noextglob && '(' === peek()) {
|
|
2681
|
+
if ('?' !== peek(2) || !/[!=<:]/.test(peek(3))) {
|
|
2682
|
+
extglobOpen('negate', value);
|
|
2683
|
+
continue;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
if (true !== opts.nonegate && 0 === state.index) {
|
|
2687
|
+
negate();
|
|
2688
|
+
continue;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
if ('+' === value) {
|
|
2692
|
+
if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
2693
|
+
extglobOpen('plus', value);
|
|
2694
|
+
continue;
|
|
2695
|
+
}
|
|
2696
|
+
if (prev && '(' === prev.value || false === opts.regex) {
|
|
2697
|
+
push({
|
|
2698
|
+
type: 'plus',
|
|
2699
|
+
value,
|
|
2700
|
+
output: PLUS_LITERAL
|
|
2701
|
+
});
|
|
2702
|
+
continue;
|
|
2703
|
+
}
|
|
2704
|
+
if (prev && ('bracket' === prev.type || 'paren' === prev.type || 'brace' === prev.type) || state.parens > 0) {
|
|
2705
|
+
push({
|
|
2706
|
+
type: 'plus',
|
|
2707
|
+
value
|
|
2708
|
+
});
|
|
2709
|
+
continue;
|
|
2710
|
+
}
|
|
2711
|
+
push({
|
|
2712
|
+
type: 'plus',
|
|
2713
|
+
value: PLUS_LITERAL
|
|
2714
|
+
});
|
|
2715
|
+
continue;
|
|
2716
|
+
}
|
|
2717
|
+
if ('@' === value) {
|
|
2718
|
+
if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
2719
|
+
push({
|
|
2720
|
+
type: 'at',
|
|
2721
|
+
extglob: true,
|
|
2722
|
+
value,
|
|
2723
|
+
output: ''
|
|
2724
|
+
});
|
|
2725
|
+
continue;
|
|
2726
|
+
}
|
|
2727
|
+
push({
|
|
2728
|
+
type: 'text',
|
|
2729
|
+
value
|
|
2730
|
+
});
|
|
2731
|
+
continue;
|
|
2732
|
+
}
|
|
2733
|
+
if ('*' !== value) {
|
|
2734
|
+
if ('$' === value || '^' === value) value = `\\${value}`;
|
|
2735
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
2736
|
+
if (match) {
|
|
2737
|
+
value += match[0];
|
|
2738
|
+
state.index += match[0].length;
|
|
2739
|
+
}
|
|
2740
|
+
push({
|
|
2741
|
+
type: 'text',
|
|
2742
|
+
value
|
|
2743
|
+
});
|
|
2744
|
+
continue;
|
|
2745
|
+
}
|
|
2746
|
+
if (prev && ('globstar' === prev.type || true === prev.star)) {
|
|
2747
|
+
prev.type = 'star';
|
|
2748
|
+
prev.star = true;
|
|
2749
|
+
prev.value += value;
|
|
2750
|
+
prev.output = star;
|
|
2751
|
+
state.backtrack = true;
|
|
2752
|
+
state.globstar = true;
|
|
2753
|
+
consume(value);
|
|
2754
|
+
continue;
|
|
2755
|
+
}
|
|
2756
|
+
let rest = remaining();
|
|
2757
|
+
if (true !== opts.noextglob && /^\([^?]/.test(rest)) {
|
|
2758
|
+
extglobOpen('star', value);
|
|
2759
|
+
continue;
|
|
2760
|
+
}
|
|
2761
|
+
if ('star' === prev.type) {
|
|
2762
|
+
if (true === opts.noglobstar) {
|
|
2763
|
+
consume(value);
|
|
2764
|
+
continue;
|
|
2765
|
+
}
|
|
2766
|
+
const prior = prev.prev;
|
|
2767
|
+
const before = prior.prev;
|
|
2768
|
+
const isStart = 'slash' === prior.type || 'bos' === prior.type;
|
|
2769
|
+
const afterStar = before && ('star' === before.type || 'globstar' === before.type);
|
|
2770
|
+
if (true === opts.bash && (!isStart || rest[0] && '/' !== rest[0])) {
|
|
2771
|
+
push({
|
|
2772
|
+
type: 'star',
|
|
2773
|
+
value,
|
|
2774
|
+
output: ''
|
|
2775
|
+
});
|
|
2776
|
+
continue;
|
|
2777
|
+
}
|
|
2778
|
+
const isBrace = state.braces > 0 && ('comma' === prior.type || 'brace' === prior.type);
|
|
2779
|
+
const isExtglob = extglobs.length && ('pipe' === prior.type || 'paren' === prior.type);
|
|
2780
|
+
if (!isStart && 'paren' !== prior.type && !isBrace && !isExtglob) {
|
|
2781
|
+
push({
|
|
2782
|
+
type: 'star',
|
|
2783
|
+
value,
|
|
2784
|
+
output: ''
|
|
2785
|
+
});
|
|
2786
|
+
continue;
|
|
2787
|
+
}
|
|
2788
|
+
while('/**' === rest.slice(0, 3)){
|
|
2789
|
+
const after = input[state.index + 4];
|
|
2790
|
+
if (after && '/' !== after) break;
|
|
2791
|
+
rest = rest.slice(3);
|
|
2792
|
+
consume('/**', 3);
|
|
2793
|
+
}
|
|
2794
|
+
if ('bos' === prior.type && eos()) {
|
|
2795
|
+
prev.type = 'globstar';
|
|
2796
|
+
prev.value += value;
|
|
2797
|
+
prev.output = globstar(opts);
|
|
2798
|
+
state.output = prev.output;
|
|
2799
|
+
state.globstar = true;
|
|
2800
|
+
consume(value);
|
|
2801
|
+
continue;
|
|
2802
|
+
}
|
|
2803
|
+
if ('slash' === prior.type && 'bos' !== prior.prev.type && !afterStar && eos()) {
|
|
2804
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2805
|
+
prior.output = `(?:${prior.output}`;
|
|
2806
|
+
prev.type = 'globstar';
|
|
2807
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
2808
|
+
prev.value += value;
|
|
2809
|
+
state.globstar = true;
|
|
2810
|
+
state.output += prior.output + prev.output;
|
|
2811
|
+
consume(value);
|
|
2812
|
+
continue;
|
|
2813
|
+
}
|
|
2814
|
+
if ('slash' === prior.type && 'bos' !== prior.prev.type && '/' === rest[0]) {
|
|
2815
|
+
const end = void 0 !== rest[1] ? '|$' : '';
|
|
2816
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2817
|
+
prior.output = `(?:${prior.output}`;
|
|
2818
|
+
prev.type = 'globstar';
|
|
2819
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
2820
|
+
prev.value += value;
|
|
2821
|
+
state.output += prior.output + prev.output;
|
|
2822
|
+
state.globstar = true;
|
|
2823
|
+
consume(value + advance());
|
|
2824
|
+
push({
|
|
2825
|
+
type: 'slash',
|
|
2826
|
+
value: '/',
|
|
2827
|
+
output: ''
|
|
2828
|
+
});
|
|
2829
|
+
continue;
|
|
2830
|
+
}
|
|
2831
|
+
if ('bos' === prior.type && '/' === rest[0]) {
|
|
2832
|
+
prev.type = 'globstar';
|
|
2833
|
+
prev.value += value;
|
|
2834
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
2835
|
+
state.output = prev.output;
|
|
2836
|
+
state.globstar = true;
|
|
2837
|
+
consume(value + advance());
|
|
2838
|
+
push({
|
|
2839
|
+
type: 'slash',
|
|
2840
|
+
value: '/',
|
|
2841
|
+
output: ''
|
|
2842
|
+
});
|
|
2843
|
+
continue;
|
|
2844
|
+
}
|
|
2845
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
2846
|
+
prev.type = 'globstar';
|
|
2847
|
+
prev.output = globstar(opts);
|
|
2848
|
+
prev.value += value;
|
|
2849
|
+
state.output += prev.output;
|
|
2850
|
+
state.globstar = true;
|
|
2851
|
+
consume(value);
|
|
2852
|
+
continue;
|
|
2853
|
+
}
|
|
2854
|
+
const token = {
|
|
2855
|
+
type: 'star',
|
|
2856
|
+
value,
|
|
2857
|
+
output: star
|
|
2858
|
+
};
|
|
2859
|
+
if (true === opts.bash) {
|
|
2860
|
+
token.output = '.*?';
|
|
2861
|
+
if ('bos' === prev.type || 'slash' === prev.type) token.output = nodot + token.output;
|
|
2862
|
+
push(token);
|
|
2863
|
+
continue;
|
|
2864
|
+
}
|
|
2865
|
+
if (prev && ('bracket' === prev.type || 'paren' === prev.type) && true === opts.regex) {
|
|
2866
|
+
token.output = value;
|
|
2867
|
+
push(token);
|
|
2868
|
+
continue;
|
|
2869
|
+
}
|
|
2870
|
+
if (state.index === state.start || 'slash' === prev.type || 'dot' === prev.type) {
|
|
2871
|
+
if ('dot' === prev.type) {
|
|
2872
|
+
state.output += NO_DOT_SLASH;
|
|
2873
|
+
prev.output += NO_DOT_SLASH;
|
|
2874
|
+
} else if (true === opts.dot) {
|
|
2875
|
+
state.output += NO_DOTS_SLASH;
|
|
2876
|
+
prev.output += NO_DOTS_SLASH;
|
|
2877
|
+
} else {
|
|
2878
|
+
state.output += nodot;
|
|
2879
|
+
prev.output += nodot;
|
|
2880
|
+
}
|
|
2881
|
+
if ('*' !== peek()) {
|
|
2882
|
+
state.output += ONE_CHAR;
|
|
2883
|
+
prev.output += ONE_CHAR;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
push(token);
|
|
2887
|
+
}
|
|
2888
|
+
while(state.brackets > 0){
|
|
2889
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
|
|
2890
|
+
state.output = utils.escapeLast(state.output, '[');
|
|
2891
|
+
decrement('brackets');
|
|
2892
|
+
}
|
|
2893
|
+
while(state.parens > 0){
|
|
2894
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ')'));
|
|
2895
|
+
state.output = utils.escapeLast(state.output, '(');
|
|
2896
|
+
decrement('parens');
|
|
2897
|
+
}
|
|
2898
|
+
while(state.braces > 0){
|
|
2899
|
+
if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', '}'));
|
|
2900
|
+
state.output = utils.escapeLast(state.output, '{');
|
|
2901
|
+
decrement('braces');
|
|
2902
|
+
}
|
|
2903
|
+
if (true !== opts.strictSlashes && ('star' === prev.type || 'bracket' === prev.type)) push({
|
|
2904
|
+
type: 'maybe_slash',
|
|
2905
|
+
value: '',
|
|
2906
|
+
output: `${SLASH_LITERAL}?`
|
|
2907
|
+
});
|
|
2908
|
+
if (true === state.backtrack) {
|
|
2909
|
+
state.output = '';
|
|
2910
|
+
for (const token of state.tokens){
|
|
2911
|
+
state.output += null != token.output ? token.output : token.value;
|
|
2912
|
+
if (token.suffix) state.output += token.suffix;
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
return state;
|
|
2916
|
+
};
|
|
2917
|
+
parse.fastpaths = (input, options)=>{
|
|
2918
|
+
const opts = {
|
|
2919
|
+
...options
|
|
2920
|
+
};
|
|
2921
|
+
const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2922
|
+
const len = input.length;
|
|
2923
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
2924
|
+
input = REPLACEMENTS[input] || input;
|
|
2925
|
+
const win32 = utils.isWindows(options);
|
|
2926
|
+
const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(win32);
|
|
2927
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
2928
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
2929
|
+
const capture = opts.capture ? '' : '?:';
|
|
2930
|
+
const state = {
|
|
2931
|
+
negated: false,
|
|
2932
|
+
prefix: ''
|
|
2933
|
+
};
|
|
2934
|
+
let star = true === opts.bash ? '.*?' : STAR;
|
|
2935
|
+
if (opts.capture) star = `(${star})`;
|
|
2936
|
+
const globstar = (opts)=>{
|
|
2937
|
+
if (true === opts.noglobstar) return star;
|
|
2938
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
2939
|
+
};
|
|
2940
|
+
const create = (str)=>{
|
|
2941
|
+
switch(str){
|
|
2942
|
+
case '*':
|
|
2943
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
2944
|
+
case '.*':
|
|
2945
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2946
|
+
case '*.*':
|
|
2947
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2948
|
+
case '*/*':
|
|
2949
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
2950
|
+
case '**':
|
|
2951
|
+
return nodot + globstar(opts);
|
|
2952
|
+
case '**/*':
|
|
2953
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
2954
|
+
case '**/*.*':
|
|
2955
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2956
|
+
case '**/.*':
|
|
2957
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2958
|
+
default:
|
|
2959
|
+
{
|
|
2960
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
2961
|
+
if (!match) return;
|
|
2962
|
+
const source = create(match[1]);
|
|
2963
|
+
if (!source) return;
|
|
2964
|
+
return source + DOT_LITERAL + match[2];
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
};
|
|
2968
|
+
const output = utils.removePrefix(input, state);
|
|
2969
|
+
let source = create(output);
|
|
2970
|
+
if (source && true !== opts.strictSlashes) source += `${SLASH_LITERAL}?`;
|
|
2971
|
+
return source;
|
|
2972
|
+
};
|
|
2973
|
+
module.exports = parse;
|
|
2974
|
+
},
|
|
2975
|
+
"./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
2976
|
+
const path = __webpack_require__("path");
|
|
2977
|
+
const scan = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js");
|
|
2978
|
+
const parse = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js");
|
|
2979
|
+
const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js");
|
|
2980
|
+
const constants = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js");
|
|
2981
|
+
const isObject = (val)=>val && 'object' == typeof val && !Array.isArray(val);
|
|
2982
|
+
const picomatch = (glob, options, returnState = false)=>{
|
|
2983
|
+
if (Array.isArray(glob)) {
|
|
2984
|
+
const fns = glob.map((input)=>picomatch(input, options, returnState));
|
|
2985
|
+
const arrayMatcher = (str)=>{
|
|
2986
|
+
for (const isMatch of fns){
|
|
2987
|
+
const state = isMatch(str);
|
|
2988
|
+
if (state) return state;
|
|
2989
|
+
}
|
|
2990
|
+
return false;
|
|
2991
|
+
};
|
|
2992
|
+
return arrayMatcher;
|
|
2993
|
+
}
|
|
2994
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
2995
|
+
if ('' === glob || 'string' != typeof glob && !isState) throw new TypeError('Expected pattern to be a non-empty string');
|
|
2996
|
+
const opts = options || {};
|
|
2997
|
+
const posix = utils.isWindows(options);
|
|
2998
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
2999
|
+
const state = regex.state;
|
|
3000
|
+
delete regex.state;
|
|
3001
|
+
let isIgnored = ()=>false;
|
|
3002
|
+
if (opts.ignore) {
|
|
3003
|
+
const ignoreOpts = {
|
|
3004
|
+
...options,
|
|
3005
|
+
ignore: null,
|
|
3006
|
+
onMatch: null,
|
|
3007
|
+
onResult: null
|
|
3008
|
+
};
|
|
3009
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
3010
|
+
}
|
|
3011
|
+
const matcher = (input, returnObject = false)=>{
|
|
3012
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, {
|
|
3013
|
+
glob,
|
|
3014
|
+
posix
|
|
3015
|
+
});
|
|
3016
|
+
const result = {
|
|
3017
|
+
glob,
|
|
3018
|
+
state,
|
|
3019
|
+
regex,
|
|
3020
|
+
posix,
|
|
3021
|
+
input,
|
|
3022
|
+
output,
|
|
3023
|
+
match,
|
|
3024
|
+
isMatch
|
|
3025
|
+
};
|
|
3026
|
+
if ('function' == typeof opts.onResult) opts.onResult(result);
|
|
3027
|
+
if (false === isMatch) {
|
|
3028
|
+
result.isMatch = false;
|
|
3029
|
+
return returnObject ? result : false;
|
|
3030
|
+
}
|
|
3031
|
+
if (isIgnored(input)) {
|
|
3032
|
+
if ('function' == typeof opts.onIgnore) opts.onIgnore(result);
|
|
3033
|
+
result.isMatch = false;
|
|
3034
|
+
return returnObject ? result : false;
|
|
3035
|
+
}
|
|
3036
|
+
if ('function' == typeof opts.onMatch) opts.onMatch(result);
|
|
3037
|
+
return returnObject ? result : true;
|
|
3038
|
+
};
|
|
3039
|
+
if (returnState) matcher.state = state;
|
|
3040
|
+
return matcher;
|
|
3041
|
+
};
|
|
3042
|
+
picomatch.test = (input, regex, options, { glob, posix } = {})=>{
|
|
3043
|
+
if ('string' != typeof input) throw new TypeError('Expected input to be a string');
|
|
3044
|
+
if ('' === input) return {
|
|
3045
|
+
isMatch: false,
|
|
3046
|
+
output: ''
|
|
3047
|
+
};
|
|
3048
|
+
const opts = options || {};
|
|
3049
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
3050
|
+
let match = input === glob;
|
|
3051
|
+
let output = match && format ? format(input) : input;
|
|
3052
|
+
if (false === match) {
|
|
3053
|
+
output = format ? format(input) : input;
|
|
3054
|
+
match = output === glob;
|
|
3055
|
+
}
|
|
3056
|
+
if (false === match || true === opts.capture) match = true === opts.matchBase || true === opts.basename ? picomatch.matchBase(input, regex, options, posix) : regex.exec(output);
|
|
3057
|
+
return {
|
|
3058
|
+
isMatch: Boolean(match),
|
|
3059
|
+
match,
|
|
3060
|
+
output
|
|
3061
|
+
};
|
|
3062
|
+
};
|
|
3063
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options))=>{
|
|
3064
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
3065
|
+
return regex.test(path.basename(input));
|
|
3066
|
+
};
|
|
3067
|
+
picomatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
|
|
3068
|
+
picomatch.parse = (pattern, options)=>{
|
|
3069
|
+
if (Array.isArray(pattern)) return pattern.map((p)=>picomatch.parse(p, options));
|
|
3070
|
+
return parse(pattern, {
|
|
3071
|
+
...options,
|
|
3072
|
+
fastpaths: false
|
|
3073
|
+
});
|
|
3074
|
+
};
|
|
3075
|
+
picomatch.scan = (input, options)=>scan(input, options);
|
|
3076
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false)=>{
|
|
3077
|
+
if (true === returnOutput) return state.output;
|
|
3078
|
+
const opts = options || {};
|
|
3079
|
+
const prepend = opts.contains ? '' : '^';
|
|
3080
|
+
const append = opts.contains ? '' : '$';
|
|
3081
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
3082
|
+
if (state && true === state.negated) source = `^(?!${source}).*$`;
|
|
3083
|
+
const regex = picomatch.toRegex(source, options);
|
|
3084
|
+
if (true === returnState) regex.state = state;
|
|
3085
|
+
return regex;
|
|
3086
|
+
};
|
|
3087
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false)=>{
|
|
3088
|
+
if (!input || 'string' != typeof input) throw new TypeError('Expected a non-empty string');
|
|
3089
|
+
let parsed = {
|
|
3090
|
+
negated: false,
|
|
3091
|
+
fastpaths: true
|
|
3092
|
+
};
|
|
3093
|
+
if (false !== options.fastpaths && ('.' === input[0] || '*' === input[0])) parsed.output = parse.fastpaths(input, options);
|
|
3094
|
+
if (!parsed.output) parsed = parse(input, options);
|
|
3095
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
3096
|
+
};
|
|
3097
|
+
picomatch.toRegex = (source, options)=>{
|
|
3098
|
+
try {
|
|
3099
|
+
const opts = options || {};
|
|
3100
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
3101
|
+
} catch (err) {
|
|
3102
|
+
if (options && true === options.debug) throw err;
|
|
3103
|
+
return /$^/;
|
|
3104
|
+
}
|
|
3105
|
+
};
|
|
3106
|
+
picomatch.constants = constants;
|
|
3107
|
+
module.exports = picomatch;
|
|
3108
|
+
},
|
|
3109
|
+
"./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
3110
|
+
const utils = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js");
|
|
3111
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js");
|
|
3112
|
+
const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
3113
|
+
const depth = (token)=>{
|
|
3114
|
+
if (true !== token.isPrefix) token.depth = token.isGlobstar ? 1 / 0 : 1;
|
|
3115
|
+
};
|
|
3116
|
+
const scan = (input, options)=>{
|
|
3117
|
+
const opts = options || {};
|
|
3118
|
+
const length = input.length - 1;
|
|
3119
|
+
const scanToEnd = true === opts.parts || true === opts.scanToEnd;
|
|
3120
|
+
const slashes = [];
|
|
3121
|
+
const tokens = [];
|
|
3122
|
+
const parts = [];
|
|
3123
|
+
let str = input;
|
|
3124
|
+
let index = -1;
|
|
3125
|
+
let start = 0;
|
|
3126
|
+
let lastIndex = 0;
|
|
3127
|
+
let isBrace = false;
|
|
3128
|
+
let isBracket = false;
|
|
3129
|
+
let isGlob = false;
|
|
3130
|
+
let isExtglob = false;
|
|
3131
|
+
let isGlobstar = false;
|
|
3132
|
+
let braceEscaped = false;
|
|
3133
|
+
let backslashes = false;
|
|
3134
|
+
let negated = false;
|
|
3135
|
+
let negatedExtglob = false;
|
|
3136
|
+
let finished = false;
|
|
3137
|
+
let braces = 0;
|
|
3138
|
+
let prev;
|
|
3139
|
+
let code;
|
|
3140
|
+
let token = {
|
|
3141
|
+
value: '',
|
|
3142
|
+
depth: 0,
|
|
3143
|
+
isGlob: false
|
|
3144
|
+
};
|
|
3145
|
+
const eos = ()=>index >= length;
|
|
3146
|
+
const peek = ()=>str.charCodeAt(index + 1);
|
|
3147
|
+
const advance = ()=>{
|
|
3148
|
+
prev = code;
|
|
3149
|
+
return str.charCodeAt(++index);
|
|
3150
|
+
};
|
|
3151
|
+
while(index < length){
|
|
3152
|
+
code = advance();
|
|
3153
|
+
let next;
|
|
3154
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
3155
|
+
backslashes = token.backslashes = true;
|
|
3156
|
+
code = advance();
|
|
3157
|
+
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
3158
|
+
continue;
|
|
3159
|
+
}
|
|
3160
|
+
if (true === braceEscaped || code === CHAR_LEFT_CURLY_BRACE) {
|
|
3161
|
+
braces++;
|
|
3162
|
+
while(true !== eos() && (code = advance())){
|
|
3163
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
3164
|
+
backslashes = token.backslashes = true;
|
|
3165
|
+
advance();
|
|
3166
|
+
continue;
|
|
3167
|
+
}
|
|
3168
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
3169
|
+
braces++;
|
|
3170
|
+
continue;
|
|
3171
|
+
}
|
|
3172
|
+
if (true !== braceEscaped && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
3173
|
+
isBrace = token.isBrace = true;
|
|
3174
|
+
isGlob = token.isGlob = true;
|
|
3175
|
+
finished = true;
|
|
3176
|
+
if (true === scanToEnd) continue;
|
|
3177
|
+
break;
|
|
3178
|
+
}
|
|
3179
|
+
if (true !== braceEscaped && code === CHAR_COMMA) {
|
|
3180
|
+
isBrace = token.isBrace = true;
|
|
3181
|
+
isGlob = token.isGlob = true;
|
|
3182
|
+
finished = true;
|
|
3183
|
+
if (true === scanToEnd) continue;
|
|
3184
|
+
break;
|
|
3185
|
+
}
|
|
3186
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
3187
|
+
braces--;
|
|
3188
|
+
if (0 === braces) {
|
|
3189
|
+
braceEscaped = false;
|
|
3190
|
+
isBrace = token.isBrace = true;
|
|
3191
|
+
finished = true;
|
|
3192
|
+
break;
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
if (true === scanToEnd) continue;
|
|
3197
|
+
break;
|
|
3198
|
+
}
|
|
3199
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
3200
|
+
slashes.push(index);
|
|
3201
|
+
tokens.push(token);
|
|
3202
|
+
token = {
|
|
3203
|
+
value: '',
|
|
3204
|
+
depth: 0,
|
|
3205
|
+
isGlob: false
|
|
3206
|
+
};
|
|
3207
|
+
if (true === finished) continue;
|
|
3208
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
3209
|
+
start += 2;
|
|
3210
|
+
continue;
|
|
3211
|
+
}
|
|
3212
|
+
lastIndex = index + 1;
|
|
3213
|
+
continue;
|
|
3214
|
+
}
|
|
3215
|
+
if (true !== opts.noext) {
|
|
3216
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
3217
|
+
if (true === isExtglobChar && peek() === CHAR_LEFT_PARENTHESES) {
|
|
3218
|
+
isGlob = token.isGlob = true;
|
|
3219
|
+
isExtglob = token.isExtglob = true;
|
|
3220
|
+
finished = true;
|
|
3221
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
3222
|
+
if (true === scanToEnd) {
|
|
3223
|
+
while(true !== eos() && (code = advance())){
|
|
3224
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
3225
|
+
backslashes = token.backslashes = true;
|
|
3226
|
+
code = advance();
|
|
3227
|
+
continue;
|
|
3228
|
+
}
|
|
3229
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
3230
|
+
isGlob = token.isGlob = true;
|
|
3231
|
+
finished = true;
|
|
3232
|
+
break;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
continue;
|
|
3236
|
+
}
|
|
3237
|
+
break;
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
if (code === CHAR_ASTERISK) {
|
|
3241
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
3242
|
+
isGlob = token.isGlob = true;
|
|
3243
|
+
finished = true;
|
|
3244
|
+
if (true === scanToEnd) continue;
|
|
3245
|
+
break;
|
|
3246
|
+
}
|
|
3247
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
3248
|
+
isGlob = token.isGlob = true;
|
|
3249
|
+
finished = true;
|
|
3250
|
+
if (true === scanToEnd) continue;
|
|
3251
|
+
break;
|
|
3252
|
+
}
|
|
3253
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
3254
|
+
while(true !== eos() && (next = advance())){
|
|
3255
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
3256
|
+
backslashes = token.backslashes = true;
|
|
3257
|
+
advance();
|
|
3258
|
+
continue;
|
|
3259
|
+
}
|
|
3260
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
3261
|
+
isBracket = token.isBracket = true;
|
|
3262
|
+
isGlob = token.isGlob = true;
|
|
3263
|
+
finished = true;
|
|
3264
|
+
break;
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
if (true === scanToEnd) continue;
|
|
3268
|
+
break;
|
|
3269
|
+
}
|
|
3270
|
+
if (true !== opts.nonegate && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
3271
|
+
negated = token.negated = true;
|
|
3272
|
+
start++;
|
|
3273
|
+
continue;
|
|
3274
|
+
}
|
|
3275
|
+
if (true !== opts.noparen && code === CHAR_LEFT_PARENTHESES) {
|
|
3276
|
+
isGlob = token.isGlob = true;
|
|
3277
|
+
if (true === scanToEnd) {
|
|
3278
|
+
while(true !== eos() && (code = advance())){
|
|
3279
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
3280
|
+
backslashes = token.backslashes = true;
|
|
3281
|
+
code = advance();
|
|
3282
|
+
continue;
|
|
3283
|
+
}
|
|
3284
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
3285
|
+
finished = true;
|
|
3286
|
+
break;
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
continue;
|
|
3290
|
+
}
|
|
3291
|
+
break;
|
|
3292
|
+
}
|
|
3293
|
+
if (true === isGlob) {
|
|
3294
|
+
finished = true;
|
|
3295
|
+
if (true === scanToEnd) continue;
|
|
3296
|
+
break;
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
if (true === opts.noext) {
|
|
3300
|
+
isExtglob = false;
|
|
3301
|
+
isGlob = false;
|
|
3302
|
+
}
|
|
3303
|
+
let base = str;
|
|
3304
|
+
let prefix = '';
|
|
3305
|
+
let glob = '';
|
|
3306
|
+
if (start > 0) {
|
|
3307
|
+
prefix = str.slice(0, start);
|
|
3308
|
+
str = str.slice(start);
|
|
3309
|
+
lastIndex -= start;
|
|
3310
|
+
}
|
|
3311
|
+
if (base && true === isGlob && lastIndex > 0) {
|
|
3312
|
+
base = str.slice(0, lastIndex);
|
|
3313
|
+
glob = str.slice(lastIndex);
|
|
3314
|
+
} else if (true === isGlob) {
|
|
3315
|
+
base = '';
|
|
3316
|
+
glob = str;
|
|
3317
|
+
} else base = str;
|
|
3318
|
+
if (base && '' !== base && '/' !== base && base !== str) {
|
|
3319
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
3320
|
+
}
|
|
3321
|
+
if (true === opts.unescape) {
|
|
3322
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
3323
|
+
if (base && true === backslashes) base = utils.removeBackslashes(base);
|
|
3324
|
+
}
|
|
3325
|
+
const state = {
|
|
3326
|
+
prefix,
|
|
3327
|
+
input,
|
|
3328
|
+
start,
|
|
3329
|
+
base,
|
|
3330
|
+
glob,
|
|
3331
|
+
isBrace,
|
|
3332
|
+
isBracket,
|
|
3333
|
+
isGlob,
|
|
3334
|
+
isExtglob,
|
|
3335
|
+
isGlobstar,
|
|
3336
|
+
negated,
|
|
3337
|
+
negatedExtglob
|
|
3338
|
+
};
|
|
3339
|
+
if (true === opts.tokens) {
|
|
3340
|
+
state.maxDepth = 0;
|
|
3341
|
+
if (!isPathSeparator(code)) tokens.push(token);
|
|
3342
|
+
state.tokens = tokens;
|
|
3343
|
+
}
|
|
3344
|
+
if (true === opts.parts || true === opts.tokens) {
|
|
3345
|
+
let prevIndex;
|
|
3346
|
+
for(let idx = 0; idx < slashes.length; idx++){
|
|
3347
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
3348
|
+
const i = slashes[idx];
|
|
3349
|
+
const value = input.slice(n, i);
|
|
3350
|
+
if (opts.tokens) {
|
|
3351
|
+
if (0 === idx && 0 !== start) {
|
|
3352
|
+
tokens[idx].isPrefix = true;
|
|
3353
|
+
tokens[idx].value = prefix;
|
|
3354
|
+
} else tokens[idx].value = value;
|
|
3355
|
+
depth(tokens[idx]);
|
|
3356
|
+
state.maxDepth += tokens[idx].depth;
|
|
3357
|
+
}
|
|
3358
|
+
if (0 !== idx || '' !== value) parts.push(value);
|
|
3359
|
+
prevIndex = i;
|
|
3360
|
+
}
|
|
3361
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3362
|
+
const value = input.slice(prevIndex + 1);
|
|
3363
|
+
parts.push(value);
|
|
3364
|
+
if (opts.tokens) {
|
|
3365
|
+
tokens[tokens.length - 1].value = value;
|
|
3366
|
+
depth(tokens[tokens.length - 1]);
|
|
3367
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
state.slashes = slashes;
|
|
3371
|
+
state.parts = parts;
|
|
3372
|
+
}
|
|
3373
|
+
return state;
|
|
3374
|
+
};
|
|
3375
|
+
module.exports = scan;
|
|
3376
|
+
},
|
|
3377
|
+
"./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3378
|
+
const path = __webpack_require__("path");
|
|
3379
|
+
const win32 = 'win32' === process.platform;
|
|
3380
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("./node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js");
|
|
3381
|
+
exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
|
|
3382
|
+
exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
|
|
3383
|
+
exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str);
|
|
3384
|
+
exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
3385
|
+
exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/');
|
|
3386
|
+
exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match);
|
|
3387
|
+
exports.supportsLookbehinds = ()=>{
|
|
3388
|
+
const segs = process.version.slice(1).split('.').map(Number);
|
|
3389
|
+
if (3 === segs.length && segs[0] >= 9 || 8 === segs[0] && segs[1] >= 10) return true;
|
|
3390
|
+
return false;
|
|
3391
|
+
};
|
|
3392
|
+
exports.isWindows = (options)=>{
|
|
3393
|
+
if (options && 'boolean' == typeof options.windows) return options.windows;
|
|
3394
|
+
return true === win32 || '\\' === path.sep;
|
|
3395
|
+
};
|
|
3396
|
+
exports.escapeLast = (input, char, lastIdx)=>{
|
|
3397
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
3398
|
+
if (-1 === idx) return input;
|
|
3399
|
+
if ('\\' === input[idx - 1]) return exports.escapeLast(input, char, idx - 1);
|
|
3400
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
3401
|
+
};
|
|
3402
|
+
exports.removePrefix = (input, state = {})=>{
|
|
3403
|
+
let output = input;
|
|
3404
|
+
if (output.startsWith('./')) {
|
|
3405
|
+
output = output.slice(2);
|
|
3406
|
+
state.prefix = './';
|
|
3407
|
+
}
|
|
3408
|
+
return output;
|
|
3409
|
+
};
|
|
3410
|
+
exports.wrapOutput = (input, state = {}, options = {})=>{
|
|
3411
|
+
const prepend = options.contains ? '' : '^';
|
|
3412
|
+
const append = options.contains ? '' : '$';
|
|
3413
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
3414
|
+
if (true === state.negated) output = `(?:^(?!${output}).*$)`;
|
|
3415
|
+
return output;
|
|
3416
|
+
};
|
|
3417
|
+
},
|
|
3418
|
+
"./node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js" (module) {
|
|
3419
|
+
module.exports = function(port, protocol) {
|
|
3420
|
+
protocol = protocol.split(':')[0];
|
|
3421
|
+
port *= 1;
|
|
3422
|
+
if (!port) return false;
|
|
3423
|
+
switch(protocol){
|
|
3424
|
+
case 'http':
|
|
3425
|
+
case 'ws':
|
|
3426
|
+
return 80 !== port;
|
|
3427
|
+
case 'https':
|
|
3428
|
+
case 'wss':
|
|
3429
|
+
return 443 !== port;
|
|
3430
|
+
case 'ftp':
|
|
3431
|
+
return 21 !== port;
|
|
3432
|
+
case 'gopher':
|
|
3433
|
+
return 70 !== port;
|
|
3434
|
+
case 'file':
|
|
3435
|
+
return false;
|
|
3436
|
+
}
|
|
3437
|
+
return 0 !== port;
|
|
3438
|
+
};
|
|
3439
|
+
},
|
|
3440
|
+
"./node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
3441
|
+
/*!
|
|
3442
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
3443
|
+
*
|
|
3444
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
3445
|
+
* Released under the MIT License.
|
|
3446
|
+
*/ const isNumber = __webpack_require__("./node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js");
|
|
3447
|
+
const toRegexRange = (min, max, options)=>{
|
|
3448
|
+
if (false === isNumber(min)) throw new TypeError('toRegexRange: expected the first argument to be a number');
|
|
3449
|
+
if (void 0 === max || min === max) return String(min);
|
|
3450
|
+
if (false === isNumber(max)) throw new TypeError('toRegexRange: expected the second argument to be a number.');
|
|
3451
|
+
let opts = {
|
|
3452
|
+
relaxZeros: true,
|
|
3453
|
+
...options
|
|
3454
|
+
};
|
|
3455
|
+
if ('boolean' == typeof opts.strictZeros) opts.relaxZeros = false === opts.strictZeros;
|
|
3456
|
+
let relax = String(opts.relaxZeros);
|
|
3457
|
+
let shorthand = String(opts.shorthand);
|
|
3458
|
+
let capture = String(opts.capture);
|
|
3459
|
+
let wrap = String(opts.wrap);
|
|
3460
|
+
let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
|
|
3461
|
+
if (toRegexRange.cache.hasOwnProperty(cacheKey)) return toRegexRange.cache[cacheKey].result;
|
|
3462
|
+
let a = Math.min(min, max);
|
|
3463
|
+
let b = Math.max(min, max);
|
|
3464
|
+
if (1 === Math.abs(a - b)) {
|
|
3465
|
+
let result = min + '|' + max;
|
|
3466
|
+
if (opts.capture) return `(${result})`;
|
|
3467
|
+
if (false === opts.wrap) return result;
|
|
3468
|
+
return `(?:${result})`;
|
|
3469
|
+
}
|
|
3470
|
+
let isPadded = hasPadding(min) || hasPadding(max);
|
|
3471
|
+
let state = {
|
|
3472
|
+
min,
|
|
3473
|
+
max,
|
|
3474
|
+
a,
|
|
3475
|
+
b
|
|
3476
|
+
};
|
|
3477
|
+
let positives = [];
|
|
3478
|
+
let negatives = [];
|
|
3479
|
+
if (isPadded) {
|
|
3480
|
+
state.isPadded = isPadded;
|
|
3481
|
+
state.maxLen = String(state.max).length;
|
|
3482
|
+
}
|
|
3483
|
+
if (a < 0) {
|
|
3484
|
+
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
3485
|
+
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
|
3486
|
+
a = state.a = 0;
|
|
3487
|
+
}
|
|
3488
|
+
if (b >= 0) positives = splitToPatterns(a, b, state, opts);
|
|
3489
|
+
state.negatives = negatives;
|
|
3490
|
+
state.positives = positives;
|
|
3491
|
+
state.result = collatePatterns(negatives, positives, opts);
|
|
3492
|
+
if (true === opts.capture) state.result = `(${state.result})`;
|
|
3493
|
+
else if (false !== opts.wrap && positives.length + negatives.length > 1) state.result = `(?:${state.result})`;
|
|
3494
|
+
toRegexRange.cache[cacheKey] = state;
|
|
3495
|
+
return state.result;
|
|
3496
|
+
};
|
|
3497
|
+
function collatePatterns(neg, pos, options) {
|
|
3498
|
+
let onlyNegative = filterPatterns(neg, pos, '-', false, options) || [];
|
|
3499
|
+
let onlyPositive = filterPatterns(pos, neg, '', false, options) || [];
|
|
3500
|
+
let intersected = filterPatterns(neg, pos, '-?', true, options) || [];
|
|
3501
|
+
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
|
3502
|
+
return subpatterns.join('|');
|
|
3503
|
+
}
|
|
3504
|
+
function splitToRanges(min, max) {
|
|
3505
|
+
let nines = 1;
|
|
3506
|
+
let zeros = 1;
|
|
3507
|
+
let stop = countNines(min, nines);
|
|
3508
|
+
let stops = new Set([
|
|
3509
|
+
max
|
|
3510
|
+
]);
|
|
3511
|
+
while(min <= stop && stop <= max){
|
|
3512
|
+
stops.add(stop);
|
|
3513
|
+
nines += 1;
|
|
3514
|
+
stop = countNines(min, nines);
|
|
3515
|
+
}
|
|
3516
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
3517
|
+
while(min < stop && stop <= max){
|
|
3518
|
+
stops.add(stop);
|
|
3519
|
+
zeros += 1;
|
|
3520
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
3521
|
+
}
|
|
3522
|
+
stops = [
|
|
3523
|
+
...stops
|
|
3524
|
+
];
|
|
3525
|
+
stops.sort(compare);
|
|
3526
|
+
return stops;
|
|
3527
|
+
}
|
|
3528
|
+
function rangeToPattern(start, stop, options) {
|
|
3529
|
+
if (start === stop) return {
|
|
3530
|
+
pattern: start,
|
|
3531
|
+
count: [],
|
|
3532
|
+
digits: 0
|
|
3533
|
+
};
|
|
3534
|
+
let zipped = zip(start, stop);
|
|
3535
|
+
let digits = zipped.length;
|
|
3536
|
+
let pattern = '';
|
|
3537
|
+
let count = 0;
|
|
3538
|
+
for(let i = 0; i < digits; i++){
|
|
3539
|
+
let [startDigit, stopDigit] = zipped[i];
|
|
3540
|
+
if (startDigit === stopDigit) pattern += startDigit;
|
|
3541
|
+
else if ('0' !== startDigit || '9' !== stopDigit) pattern += toCharacterClass(startDigit, stopDigit, options);
|
|
3542
|
+
else count++;
|
|
3543
|
+
}
|
|
3544
|
+
if (count) pattern += true === options.shorthand ? '\\d' : '[0-9]';
|
|
3545
|
+
return {
|
|
3546
|
+
pattern,
|
|
3547
|
+
count: [
|
|
3548
|
+
count
|
|
3549
|
+
],
|
|
3550
|
+
digits
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
function splitToPatterns(min, max, tok, options) {
|
|
3554
|
+
let ranges = splitToRanges(min, max);
|
|
3555
|
+
let tokens = [];
|
|
3556
|
+
let start = min;
|
|
3557
|
+
let prev;
|
|
3558
|
+
for(let i = 0; i < ranges.length; i++){
|
|
3559
|
+
let max = ranges[i];
|
|
3560
|
+
let obj = rangeToPattern(String(start), String(max), options);
|
|
3561
|
+
let zeros = '';
|
|
3562
|
+
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
3563
|
+
if (prev.count.length > 1) prev.count.pop();
|
|
3564
|
+
prev.count.push(obj.count[0]);
|
|
3565
|
+
prev.string = prev.pattern + toQuantifier(prev.count);
|
|
3566
|
+
start = max + 1;
|
|
3567
|
+
continue;
|
|
3568
|
+
}
|
|
3569
|
+
if (tok.isPadded) zeros = padZeros(max, tok, options);
|
|
3570
|
+
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
|
3571
|
+
tokens.push(obj);
|
|
3572
|
+
start = max + 1;
|
|
3573
|
+
prev = obj;
|
|
3574
|
+
}
|
|
3575
|
+
return tokens;
|
|
3576
|
+
}
|
|
3577
|
+
function filterPatterns(arr, comparison, prefix, intersection, options) {
|
|
3578
|
+
let result = [];
|
|
3579
|
+
for (let ele of arr){
|
|
3580
|
+
let { string } = ele;
|
|
3581
|
+
if (!intersection && !contains(comparison, 'string', string)) result.push(prefix + string);
|
|
3582
|
+
if (intersection && contains(comparison, 'string', string)) result.push(prefix + string);
|
|
3583
|
+
}
|
|
3584
|
+
return result;
|
|
3585
|
+
}
|
|
3586
|
+
function zip(a, b) {
|
|
3587
|
+
let arr = [];
|
|
3588
|
+
for(let i = 0; i < a.length; i++)arr.push([
|
|
3589
|
+
a[i],
|
|
3590
|
+
b[i]
|
|
3591
|
+
]);
|
|
3592
|
+
return arr;
|
|
3593
|
+
}
|
|
3594
|
+
function compare(a, b) {
|
|
3595
|
+
return a > b ? 1 : b > a ? -1 : 0;
|
|
3596
|
+
}
|
|
3597
|
+
function contains(arr, key, val) {
|
|
3598
|
+
return arr.some((ele)=>ele[key] === val);
|
|
3599
|
+
}
|
|
3600
|
+
function countNines(min, len) {
|
|
3601
|
+
return Number(String(min).slice(0, -len) + '9'.repeat(len));
|
|
3602
|
+
}
|
|
3603
|
+
function countZeros(integer, zeros) {
|
|
3604
|
+
return integer - integer % Math.pow(10, zeros);
|
|
3605
|
+
}
|
|
3606
|
+
function toQuantifier(digits) {
|
|
3607
|
+
let [start = 0, stop = ''] = digits;
|
|
3608
|
+
if (stop || start > 1) return `{${start + (stop ? ',' + stop : '')}}`;
|
|
3609
|
+
return '';
|
|
3610
|
+
}
|
|
3611
|
+
function toCharacterClass(a, b, options) {
|
|
3612
|
+
return `[${a}${b - a === 1 ? '' : '-'}${b}]`;
|
|
3613
|
+
}
|
|
3614
|
+
function hasPadding(str) {
|
|
3615
|
+
return /^-?(0+)\d/.test(str);
|
|
3616
|
+
}
|
|
3617
|
+
function padZeros(value, tok, options) {
|
|
3618
|
+
if (!tok.isPadded) return value;
|
|
3619
|
+
let diff = Math.abs(tok.maxLen - String(value).length);
|
|
3620
|
+
let relax = false !== options.relaxZeros;
|
|
3621
|
+
switch(diff){
|
|
3622
|
+
case 0:
|
|
3623
|
+
return '';
|
|
3624
|
+
case 1:
|
|
3625
|
+
return relax ? '0?' : '0';
|
|
3626
|
+
case 2:
|
|
3627
|
+
return relax ? '0{0,2}' : '00';
|
|
3628
|
+
default:
|
|
3629
|
+
return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
toRegexRange.cache = {};
|
|
3633
|
+
toRegexRange.clearCache = ()=>toRegexRange.cache = {};
|
|
3634
|
+
module.exports = toRegexRange;
|
|
3635
|
+
},
|
|
3636
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/configuration.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3637
|
+
exports.verifyConfig = verifyConfig;
|
|
3638
|
+
const errors_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/errors.js");
|
|
3639
|
+
function verifyConfig(options) {
|
|
3640
|
+
if (!options.target && !options.router) throw new Error(errors_1.ERRORS.ERR_CONFIG_FACTORY_TARGET_MISSING);
|
|
3641
|
+
}
|
|
3642
|
+
},
|
|
3643
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3644
|
+
exports.Debug = void 0;
|
|
3645
|
+
const createDebug = __webpack_require__("./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js");
|
|
3646
|
+
exports.Debug = createDebug('http-proxy-middleware');
|
|
3647
|
+
},
|
|
3648
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/errors.js" (__unused_rspack_module, exports) {
|
|
3649
|
+
exports.ERRORS = void 0;
|
|
3650
|
+
var ERRORS;
|
|
3651
|
+
(function(ERRORS) {
|
|
3652
|
+
ERRORS["ERR_CONFIG_FACTORY_TARGET_MISSING"] = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}";
|
|
3653
|
+
ERRORS["ERR_CONTEXT_MATCHER_GENERIC"] = "[HPM] Invalid pathFilter. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]";
|
|
3654
|
+
ERRORS["ERR_CONTEXT_MATCHER_INVALID_ARRAY"] = "[HPM] Invalid pathFilter. Plain paths (e.g. \"/api\") can not be mixed with globs (e.g. \"/api/**\"). Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"].";
|
|
3655
|
+
ERRORS["ERR_PATH_REWRITER_CONFIG"] = "[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function";
|
|
3656
|
+
})(ERRORS || (exports.ERRORS = ERRORS = {}));
|
|
3657
|
+
},
|
|
3658
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/factory.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3659
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3660
|
+
value: true
|
|
3661
|
+
});
|
|
3662
|
+
exports.createProxyMiddleware = createProxyMiddleware;
|
|
3663
|
+
const http_proxy_middleware_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/http-proxy-middleware.js");
|
|
3664
|
+
function createProxyMiddleware(options) {
|
|
3665
|
+
const { middleware } = new http_proxy_middleware_1.HttpProxyMiddleware(options);
|
|
3666
|
+
return middleware;
|
|
3667
|
+
}
|
|
3668
|
+
},
|
|
3669
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/get-plugins.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3670
|
+
exports.getPlugins = getPlugins;
|
|
3671
|
+
const default_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/index.js");
|
|
3672
|
+
function getPlugins(options) {
|
|
3673
|
+
const maybeErrorResponsePlugin = options.on?.error ? [] : [
|
|
3674
|
+
default_1.errorResponsePlugin
|
|
3675
|
+
];
|
|
3676
|
+
const defaultPlugins = options.ejectPlugins ? [] : [
|
|
3677
|
+
default_1.debugProxyErrorsPlugin,
|
|
3678
|
+
default_1.proxyEventsPlugin,
|
|
3679
|
+
default_1.loggerPlugin,
|
|
3680
|
+
...maybeErrorResponsePlugin
|
|
3681
|
+
];
|
|
3682
|
+
const userPlugins = options.plugins ?? [];
|
|
3683
|
+
return [
|
|
3684
|
+
...defaultPlugins,
|
|
3685
|
+
...userPlugins
|
|
3686
|
+
];
|
|
3687
|
+
}
|
|
3688
|
+
},
|
|
3689
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/fix-request-body.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3690
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3691
|
+
value: true
|
|
3692
|
+
});
|
|
3693
|
+
exports.fixRequestBody = fixRequestBody;
|
|
3694
|
+
const querystring = __webpack_require__("querystring");
|
|
3695
|
+
function fixRequestBody(proxyReq, req) {
|
|
3696
|
+
if (0 !== req.readableLength) return;
|
|
3697
|
+
const requestBody = req.body;
|
|
3698
|
+
if (!requestBody) return;
|
|
3699
|
+
const contentType = proxyReq.getHeader('Content-Type');
|
|
3700
|
+
if (!contentType) return;
|
|
3701
|
+
const writeBody = (bodyData)=>{
|
|
3702
|
+
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
|
|
3703
|
+
proxyReq.write(bodyData);
|
|
3704
|
+
};
|
|
3705
|
+
if (contentType.includes('application/json') || contentType.includes('+json')) writeBody(JSON.stringify(requestBody));
|
|
3706
|
+
else if (contentType.includes('application/x-www-form-urlencoded')) writeBody(querystring.stringify(requestBody));
|
|
3707
|
+
else if (contentType.includes('multipart/form-data')) writeBody(handlerFormDataBodyData(contentType, requestBody));
|
|
3708
|
+
}
|
|
3709
|
+
function handlerFormDataBodyData(contentType, data) {
|
|
3710
|
+
const boundary = contentType.replace(/^.*boundary=(.*)$/, '$1');
|
|
3711
|
+
let str = '';
|
|
3712
|
+
for (const [key, value] of Object.entries(data))str += `--${boundary}\r\nContent-Disposition: form-data; name="${key}"\r\n\r\n${value}\r\n`;
|
|
3713
|
+
return str;
|
|
3714
|
+
}
|
|
3715
|
+
},
|
|
3716
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3717
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3718
|
+
if (void 0 === k2) k2 = k;
|
|
3719
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3720
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
3721
|
+
enumerable: true,
|
|
3722
|
+
get: function() {
|
|
3723
|
+
return m[k];
|
|
3724
|
+
}
|
|
3725
|
+
};
|
|
3726
|
+
Object.defineProperty(o, k2, desc);
|
|
3727
|
+
} : function(o, m, k, k2) {
|
|
3728
|
+
if (void 0 === k2) k2 = k;
|
|
3729
|
+
o[k2] = m[k];
|
|
3730
|
+
});
|
|
3731
|
+
var __exportStar = this && this.__exportStar || function(m, exports) {
|
|
3732
|
+
for(var p in m)if ("default" !== p && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3733
|
+
};
|
|
3734
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3735
|
+
value: true
|
|
3736
|
+
});
|
|
3737
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/public.js"), exports);
|
|
3738
|
+
},
|
|
3739
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/public.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3740
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3741
|
+
value: true
|
|
3742
|
+
});
|
|
3743
|
+
exports.fixRequestBody = exports.responseInterceptor = void 0;
|
|
3744
|
+
var response_interceptor_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/response-interceptor.js");
|
|
3745
|
+
Object.defineProperty(exports, "responseInterceptor", {
|
|
3746
|
+
enumerable: true,
|
|
3747
|
+
get: function() {
|
|
3748
|
+
return response_interceptor_1.responseInterceptor;
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
var fix_request_body_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/fix-request-body.js");
|
|
3752
|
+
Object.defineProperty(exports, "fixRequestBody", {
|
|
3753
|
+
enumerable: true,
|
|
3754
|
+
get: function() {
|
|
3755
|
+
return fix_request_body_1.fixRequestBody;
|
|
3756
|
+
}
|
|
3757
|
+
});
|
|
3758
|
+
},
|
|
3759
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/response-interceptor.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3760
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3761
|
+
value: true
|
|
3762
|
+
});
|
|
3763
|
+
exports.responseInterceptor = responseInterceptor;
|
|
3764
|
+
const zlib = __webpack_require__("zlib");
|
|
3765
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
3766
|
+
const function_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/utils/function.js");
|
|
3767
|
+
const debug = debug_1.Debug.extend('response-interceptor');
|
|
3768
|
+
function responseInterceptor(interceptor) {
|
|
3769
|
+
return async function(proxyRes, req, res) {
|
|
3770
|
+
debug('intercept proxy response');
|
|
3771
|
+
const originalProxyRes = proxyRes;
|
|
3772
|
+
let buffer = Buffer.from('', 'utf8');
|
|
3773
|
+
const _proxyRes = decompress(proxyRes, proxyRes.headers['content-encoding']);
|
|
3774
|
+
_proxyRes.on('data', (chunk)=>buffer = Buffer.concat([
|
|
3775
|
+
buffer,
|
|
3776
|
+
chunk
|
|
3777
|
+
]));
|
|
3778
|
+
_proxyRes.on('end', async ()=>{
|
|
3779
|
+
copyHeaders(proxyRes, res);
|
|
3780
|
+
debug('call interceptor function: %s', (0, function_1.getFunctionName)(interceptor));
|
|
3781
|
+
const interceptedBuffer = Buffer.from(await interceptor(buffer, originalProxyRes, req, res));
|
|
3782
|
+
debug('set content-length: %s', Buffer.byteLength(interceptedBuffer, 'utf8'));
|
|
3783
|
+
res.setHeader('content-length', Buffer.byteLength(interceptedBuffer, 'utf8'));
|
|
3784
|
+
debug('write intercepted response');
|
|
3785
|
+
res.write(interceptedBuffer);
|
|
3786
|
+
res.end();
|
|
3787
|
+
});
|
|
3788
|
+
_proxyRes.on('error', (error)=>{
|
|
3789
|
+
res.end(`Error fetching proxied request: ${error.message}`);
|
|
3790
|
+
});
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
function decompress(proxyRes, contentEncoding) {
|
|
3794
|
+
let _proxyRes = proxyRes;
|
|
3795
|
+
let decompress;
|
|
3796
|
+
switch(contentEncoding){
|
|
3797
|
+
case 'gzip':
|
|
3798
|
+
decompress = zlib.createGunzip();
|
|
3799
|
+
break;
|
|
3800
|
+
case 'br':
|
|
3801
|
+
decompress = zlib.createBrotliDecompress();
|
|
3802
|
+
break;
|
|
3803
|
+
case 'deflate':
|
|
3804
|
+
decompress = zlib.createInflate();
|
|
3805
|
+
break;
|
|
3806
|
+
default:
|
|
3807
|
+
break;
|
|
3808
|
+
}
|
|
3809
|
+
if (decompress) {
|
|
3810
|
+
debug("decompress proxy response with 'content-encoding': %s", contentEncoding);
|
|
3811
|
+
_proxyRes.pipe(decompress);
|
|
3812
|
+
_proxyRes = decompress;
|
|
3813
|
+
}
|
|
3814
|
+
return _proxyRes;
|
|
3815
|
+
}
|
|
3816
|
+
function copyHeaders(originalResponse, response) {
|
|
3817
|
+
debug('copy original response headers');
|
|
3818
|
+
response.statusCode = originalResponse.statusCode;
|
|
3819
|
+
response.statusMessage = originalResponse.statusMessage;
|
|
3820
|
+
if (response.setHeader) {
|
|
3821
|
+
let keys = Object.keys(originalResponse.headers);
|
|
3822
|
+
keys = keys.filter((key)=>![
|
|
3823
|
+
'content-encoding',
|
|
3824
|
+
'transfer-encoding'
|
|
3825
|
+
].includes(key));
|
|
3826
|
+
keys.forEach((key)=>{
|
|
3827
|
+
let value = originalResponse.headers[key];
|
|
3828
|
+
if ('set-cookie' === key) {
|
|
3829
|
+
value = Array.isArray(value) ? value : [
|
|
3830
|
+
value
|
|
3831
|
+
];
|
|
3832
|
+
value = value.map((x)=>x.replace(/Domain=[^;]+?/i, ''));
|
|
3833
|
+
}
|
|
3834
|
+
response.setHeader(key, value);
|
|
3835
|
+
});
|
|
3836
|
+
} else response.headers = originalResponse.headers;
|
|
3837
|
+
}
|
|
3838
|
+
},
|
|
3839
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/http-proxy-middleware.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3840
|
+
exports.HttpProxyMiddleware = void 0;
|
|
3841
|
+
const httpProxy = __webpack_require__("./node_modules/.pnpm/http-proxy@1.18.1_debug@4.4.3/node_modules/http-proxy/index.js");
|
|
3842
|
+
const configuration_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/configuration.js");
|
|
3843
|
+
const get_plugins_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/get-plugins.js");
|
|
3844
|
+
const path_filter_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/path-filter.js");
|
|
3845
|
+
const PathRewriter = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/path-rewriter.js");
|
|
3846
|
+
const Router = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/router.js");
|
|
3847
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
3848
|
+
const function_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/utils/function.js");
|
|
3849
|
+
const logger_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/logger.js");
|
|
3850
|
+
class HttpProxyMiddleware {
|
|
3851
|
+
constructor(options){
|
|
3852
|
+
this.wsInternalSubscribed = false;
|
|
3853
|
+
this.serverOnCloseSubscribed = false;
|
|
3854
|
+
this.middleware = async (req, res, next)=>{
|
|
3855
|
+
if (this.shouldProxy(this.proxyOptions.pathFilter, req)) try {
|
|
3856
|
+
const activeProxyOptions = await this.prepareProxyRequest(req);
|
|
3857
|
+
(0, debug_1.Debug)("proxy request to target: %O", activeProxyOptions.target);
|
|
3858
|
+
this.proxy.web(req, res, activeProxyOptions);
|
|
3859
|
+
} catch (err) {
|
|
3860
|
+
next?.(err);
|
|
3861
|
+
}
|
|
3862
|
+
else next?.();
|
|
3863
|
+
const server = (req.socket ?? req.connection)?.server;
|
|
3864
|
+
if (server && !this.serverOnCloseSubscribed) {
|
|
3865
|
+
server.on('close', ()=>{
|
|
3866
|
+
(0, debug_1.Debug)('server close signal received: closing proxy server');
|
|
3867
|
+
this.proxy.close();
|
|
3868
|
+
});
|
|
3869
|
+
this.serverOnCloseSubscribed = true;
|
|
3870
|
+
}
|
|
3871
|
+
if (true === this.proxyOptions.ws) this.catchUpgradeRequest(server);
|
|
3872
|
+
};
|
|
3873
|
+
this.catchUpgradeRequest = (server)=>{
|
|
3874
|
+
if (!this.wsInternalSubscribed) {
|
|
3875
|
+
(0, debug_1.Debug)('subscribing to server upgrade event');
|
|
3876
|
+
server.on('upgrade', this.handleUpgrade);
|
|
3877
|
+
this.wsInternalSubscribed = true;
|
|
3878
|
+
}
|
|
3879
|
+
};
|
|
3880
|
+
this.handleUpgrade = async (req, socket, head)=>{
|
|
3881
|
+
try {
|
|
3882
|
+
if (this.shouldProxy(this.proxyOptions.pathFilter, req)) {
|
|
3883
|
+
const activeProxyOptions = await this.prepareProxyRequest(req);
|
|
3884
|
+
this.proxy.ws(req, socket, head, activeProxyOptions);
|
|
3885
|
+
(0, debug_1.Debug)('server upgrade event received. Proxying WebSocket');
|
|
3886
|
+
}
|
|
3887
|
+
} catch (err) {
|
|
3888
|
+
this.proxy.emit('error', err, req, socket);
|
|
3889
|
+
}
|
|
3890
|
+
};
|
|
3891
|
+
this.shouldProxy = (pathFilter, req)=>{
|
|
3892
|
+
try {
|
|
3893
|
+
return (0, path_filter_1.matchPathFilter)(pathFilter, req.url, req);
|
|
3894
|
+
} catch (err) {
|
|
3895
|
+
(0, debug_1.Debug)('Error: matchPathFilter() called with request url: ', `"${req.url}"`);
|
|
3896
|
+
this.logger.error(err);
|
|
3897
|
+
return false;
|
|
3898
|
+
}
|
|
3899
|
+
};
|
|
3900
|
+
this.prepareProxyRequest = async (req)=>{
|
|
3901
|
+
if (this.middleware.__LEGACY_HTTP_PROXY_MIDDLEWARE__) req.url = req.originalUrl || req.url;
|
|
3902
|
+
const newProxyOptions = Object.assign({}, this.proxyOptions);
|
|
3903
|
+
await this.applyRouter(req, newProxyOptions);
|
|
3904
|
+
await this.applyPathRewrite(req, this.pathRewriter);
|
|
3905
|
+
return newProxyOptions;
|
|
3906
|
+
};
|
|
3907
|
+
this.applyRouter = async (req, options)=>{
|
|
3908
|
+
let newTarget;
|
|
3909
|
+
if (options.router) {
|
|
3910
|
+
newTarget = await Router.getTarget(req, options);
|
|
3911
|
+
if (newTarget) {
|
|
3912
|
+
(0, debug_1.Debug)('router new target: "%s"', newTarget);
|
|
3913
|
+
options.target = newTarget;
|
|
3914
|
+
}
|
|
3915
|
+
}
|
|
3916
|
+
};
|
|
3917
|
+
this.applyPathRewrite = async (req, pathRewriter)=>{
|
|
3918
|
+
if (pathRewriter) {
|
|
3919
|
+
const path = await pathRewriter(req.url, req);
|
|
3920
|
+
if ('string' == typeof path) {
|
|
3921
|
+
(0, debug_1.Debug)('pathRewrite new path: %s', req.url);
|
|
3922
|
+
req.url = path;
|
|
3923
|
+
} else (0, debug_1.Debug)('pathRewrite: no rewritten path found: %s', req.url);
|
|
3924
|
+
}
|
|
3925
|
+
};
|
|
3926
|
+
(0, configuration_1.verifyConfig)(options);
|
|
3927
|
+
this.proxyOptions = options;
|
|
3928
|
+
this.logger = (0, logger_1.getLogger)(options);
|
|
3929
|
+
(0, debug_1.Debug)("create proxy server");
|
|
3930
|
+
this.proxy = httpProxy.createProxyServer({});
|
|
3931
|
+
this.registerPlugins(this.proxy, this.proxyOptions);
|
|
3932
|
+
this.pathRewriter = PathRewriter.createPathRewriter(this.proxyOptions.pathRewrite);
|
|
3933
|
+
this.middleware.upgrade = (req, socket, head)=>{
|
|
3934
|
+
if (!this.wsInternalSubscribed) this.handleUpgrade(req, socket, head);
|
|
3935
|
+
};
|
|
3936
|
+
}
|
|
3937
|
+
registerPlugins(proxy, options) {
|
|
3938
|
+
const plugins = (0, get_plugins_1.getPlugins)(options);
|
|
3939
|
+
plugins.forEach((plugin)=>{
|
|
3940
|
+
(0, debug_1.Debug)(`register plugin: "${(0, function_1.getFunctionName)(plugin)}"`);
|
|
3941
|
+
plugin(proxy, options);
|
|
3942
|
+
});
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
exports.HttpProxyMiddleware = HttpProxyMiddleware;
|
|
3946
|
+
},
|
|
3947
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3948
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3949
|
+
if (void 0 === k2) k2 = k;
|
|
3950
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3951
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
3952
|
+
enumerable: true,
|
|
3953
|
+
get: function() {
|
|
3954
|
+
return m[k];
|
|
3955
|
+
}
|
|
3956
|
+
};
|
|
3957
|
+
Object.defineProperty(o, k2, desc);
|
|
3958
|
+
} : function(o, m, k, k2) {
|
|
3959
|
+
if (void 0 === k2) k2 = k;
|
|
3960
|
+
o[k2] = m[k];
|
|
3961
|
+
});
|
|
3962
|
+
var __exportStar = this && this.__exportStar || function(m, exports) {
|
|
3963
|
+
for(var p in m)if ("default" !== p && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3964
|
+
};
|
|
3965
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3966
|
+
value: true
|
|
3967
|
+
});
|
|
3968
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/factory.js"), exports);
|
|
3969
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/handlers/index.js"), exports);
|
|
3970
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/index.js"), exports);
|
|
3971
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/index.js"), exports);
|
|
3972
|
+
},
|
|
3973
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/create-proxy-middleware.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3974
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3975
|
+
value: true
|
|
3976
|
+
});
|
|
3977
|
+
exports.legacyCreateProxyMiddleware = legacyCreateProxyMiddleware;
|
|
3978
|
+
const factory_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/factory.js");
|
|
3979
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
3980
|
+
const options_adapter_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/options-adapter.js");
|
|
3981
|
+
const debug = debug_1.Debug.extend('legacy-create-proxy-middleware');
|
|
3982
|
+
function legacyCreateProxyMiddleware(legacyContext, legacyOptions) {
|
|
3983
|
+
debug('init');
|
|
3984
|
+
const options = (0, options_adapter_1.legacyOptionsAdapter)(legacyContext, legacyOptions);
|
|
3985
|
+
const proxyMiddleware = (0, factory_1.createProxyMiddleware)(options);
|
|
3986
|
+
debug('add marker for patching req.url (old behavior)');
|
|
3987
|
+
proxyMiddleware.__LEGACY_HTTP_PROXY_MIDDLEWARE__ = true;
|
|
3988
|
+
return proxyMiddleware;
|
|
3989
|
+
}
|
|
3990
|
+
},
|
|
3991
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
3992
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3993
|
+
if (void 0 === k2) k2 = k;
|
|
3994
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3995
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
3996
|
+
enumerable: true,
|
|
3997
|
+
get: function() {
|
|
3998
|
+
return m[k];
|
|
3999
|
+
}
|
|
4000
|
+
};
|
|
4001
|
+
Object.defineProperty(o, k2, desc);
|
|
4002
|
+
} : function(o, m, k, k2) {
|
|
4003
|
+
if (void 0 === k2) k2 = k;
|
|
4004
|
+
o[k2] = m[k];
|
|
4005
|
+
});
|
|
4006
|
+
var __exportStar = this && this.__exportStar || function(m, exports) {
|
|
4007
|
+
for(var p in m)if ("default" !== p && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4008
|
+
};
|
|
4009
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4010
|
+
value: true
|
|
4011
|
+
});
|
|
4012
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/public.js"), exports);
|
|
4013
|
+
},
|
|
4014
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/options-adapter.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4015
|
+
exports.legacyOptionsAdapter = legacyOptionsAdapter;
|
|
4016
|
+
const url = __webpack_require__("url");
|
|
4017
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
4018
|
+
const logger_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/logger.js");
|
|
4019
|
+
const debug = debug_1.Debug.extend('legacy-options-adapter');
|
|
4020
|
+
const proxyEventMap = {
|
|
4021
|
+
onError: 'error',
|
|
4022
|
+
onProxyReq: 'proxyReq',
|
|
4023
|
+
onProxyRes: 'proxyRes',
|
|
4024
|
+
onProxyReqWs: 'proxyReqWs',
|
|
4025
|
+
onOpen: 'open',
|
|
4026
|
+
onClose: 'close'
|
|
4027
|
+
};
|
|
4028
|
+
function legacyOptionsAdapter(legacyContext, legacyOptions) {
|
|
4029
|
+
let options = {};
|
|
4030
|
+
let logger;
|
|
4031
|
+
if ('string' == typeof legacyContext && !!url.parse(legacyContext).host) throw new Error(`Shorthand syntax is removed from legacyCreateProxyMiddleware().
|
|
4032
|
+
Please use "legacyCreateProxyMiddleware({ target: 'http://www.example.org' })" instead.
|
|
4033
|
+
|
|
4034
|
+
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-shorthand-usage
|
|
4035
|
+
`);
|
|
4036
|
+
if (legacyContext && legacyOptions) {
|
|
4037
|
+
debug('map legacy context/filter to options.pathFilter');
|
|
4038
|
+
options = {
|
|
4039
|
+
...legacyOptions,
|
|
4040
|
+
pathFilter: legacyContext
|
|
4041
|
+
};
|
|
4042
|
+
logger = getLegacyLogger(options);
|
|
4043
|
+
logger.warn(`[http-proxy-middleware] Legacy "context" argument is deprecated. Migrate your "context" to "options.pathFilter":
|
|
4044
|
+
|
|
4045
|
+
const options = {
|
|
4046
|
+
pathFilter: '${legacyContext}',
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-context-argument
|
|
4050
|
+
`);
|
|
4051
|
+
} else if (legacyContext && !legacyOptions) {
|
|
4052
|
+
options = {
|
|
4053
|
+
...legacyContext
|
|
4054
|
+
};
|
|
4055
|
+
logger = getLegacyLogger(options);
|
|
4056
|
+
} else logger = getLegacyLogger({});
|
|
4057
|
+
Object.entries(proxyEventMap).forEach(([legacyEventName, proxyEventName])=>{
|
|
4058
|
+
if (options[legacyEventName]) {
|
|
4059
|
+
options.on = {
|
|
4060
|
+
...options.on
|
|
4061
|
+
};
|
|
4062
|
+
options.on[proxyEventName] = options[legacyEventName];
|
|
4063
|
+
debug('map legacy event "%s" to "on.%s"', legacyEventName, proxyEventName);
|
|
4064
|
+
logger.warn(`[http-proxy-middleware] Legacy "${legacyEventName}" is deprecated. Migrate to "options.on.${proxyEventName}":
|
|
4065
|
+
|
|
4066
|
+
const options = {
|
|
4067
|
+
on: {
|
|
4068
|
+
${proxyEventName}: () => {},
|
|
4069
|
+
},
|
|
4070
|
+
}
|
|
4071
|
+
|
|
4072
|
+
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#refactored-proxy-events
|
|
4073
|
+
`);
|
|
4074
|
+
}
|
|
4075
|
+
});
|
|
4076
|
+
const logProvider = options.logProvider && options.logProvider();
|
|
4077
|
+
const logLevel = options.logLevel;
|
|
4078
|
+
debug('legacy logLevel', logLevel);
|
|
4079
|
+
debug('legacy logProvider: %O', logProvider);
|
|
4080
|
+
if ('string' == typeof logLevel && 'silent' !== logLevel) {
|
|
4081
|
+
debug('map "logProvider" to "logger"');
|
|
4082
|
+
logger.warn(`[http-proxy-middleware] Legacy "logLevel" and "logProvider" are deprecated. Migrate to "options.logger":
|
|
4083
|
+
|
|
4084
|
+
const options = {
|
|
4085
|
+
logger: console,
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-logprovider-and-loglevel-options
|
|
4089
|
+
`);
|
|
4090
|
+
}
|
|
4091
|
+
return options;
|
|
4092
|
+
}
|
|
4093
|
+
function getLegacyLogger(options) {
|
|
4094
|
+
const legacyLogger = options.logProvider && options.logProvider();
|
|
4095
|
+
if (legacyLogger) options.logger = legacyLogger;
|
|
4096
|
+
return (0, logger_1.getLogger)(options);
|
|
4097
|
+
}
|
|
4098
|
+
},
|
|
4099
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/public.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4100
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4101
|
+
value: true
|
|
4102
|
+
});
|
|
4103
|
+
exports.legacyCreateProxyMiddleware = void 0;
|
|
4104
|
+
var create_proxy_middleware_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/legacy/create-proxy-middleware.js");
|
|
4105
|
+
Object.defineProperty(exports, "legacyCreateProxyMiddleware", {
|
|
4106
|
+
enumerable: true,
|
|
4107
|
+
get: function() {
|
|
4108
|
+
return create_proxy_middleware_1.legacyCreateProxyMiddleware;
|
|
4109
|
+
}
|
|
4110
|
+
});
|
|
4111
|
+
},
|
|
4112
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/logger.js" (__unused_rspack_module, exports) {
|
|
4113
|
+
exports.getLogger = getLogger;
|
|
4114
|
+
const noopLogger = {
|
|
4115
|
+
info: ()=>{},
|
|
4116
|
+
warn: ()=>{},
|
|
4117
|
+
error: ()=>{}
|
|
4118
|
+
};
|
|
4119
|
+
function getLogger(options) {
|
|
4120
|
+
return options.logger || noopLogger;
|
|
4121
|
+
}
|
|
4122
|
+
},
|
|
4123
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/path-filter.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4124
|
+
exports.matchPathFilter = matchPathFilter;
|
|
4125
|
+
const isGlob = __webpack_require__("./node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js");
|
|
4126
|
+
const micromatch = __webpack_require__("./node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js");
|
|
4127
|
+
const url = __webpack_require__("url");
|
|
4128
|
+
const errors_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/errors.js");
|
|
4129
|
+
function matchPathFilter(pathFilter = '/', uri, req) {
|
|
4130
|
+
if (isStringPath(pathFilter)) return matchSingleStringPath(pathFilter, uri);
|
|
4131
|
+
if (isGlobPath(pathFilter)) return matchSingleGlobPath(pathFilter, uri);
|
|
4132
|
+
if (Array.isArray(pathFilter)) {
|
|
4133
|
+
if (pathFilter.every(isStringPath)) return matchMultiPath(pathFilter, uri);
|
|
4134
|
+
if (pathFilter.every(isGlobPath)) return matchMultiGlobPath(pathFilter, uri);
|
|
4135
|
+
throw new Error(errors_1.ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY);
|
|
4136
|
+
}
|
|
4137
|
+
if ('function' == typeof pathFilter) {
|
|
4138
|
+
const pathname = getUrlPathName(uri);
|
|
4139
|
+
return pathFilter(pathname, req);
|
|
4140
|
+
}
|
|
4141
|
+
throw new Error(errors_1.ERRORS.ERR_CONTEXT_MATCHER_GENERIC);
|
|
4142
|
+
}
|
|
4143
|
+
function matchSingleStringPath(pathFilter, uri) {
|
|
4144
|
+
const pathname = getUrlPathName(uri);
|
|
4145
|
+
return pathname?.indexOf(pathFilter) === 0;
|
|
4146
|
+
}
|
|
4147
|
+
function matchSingleGlobPath(pattern, uri) {
|
|
4148
|
+
const pathname = getUrlPathName(uri);
|
|
4149
|
+
const matches = micromatch([
|
|
4150
|
+
pathname
|
|
4151
|
+
], pattern);
|
|
4152
|
+
return matches && matches.length > 0;
|
|
4153
|
+
}
|
|
4154
|
+
function matchMultiGlobPath(patternList, uri) {
|
|
4155
|
+
return matchSingleGlobPath(patternList, uri);
|
|
4156
|
+
}
|
|
4157
|
+
function matchMultiPath(pathFilterList, uri) {
|
|
4158
|
+
let isMultiPath = false;
|
|
4159
|
+
for (const context of pathFilterList)if (matchSingleStringPath(context, uri)) {
|
|
4160
|
+
isMultiPath = true;
|
|
4161
|
+
break;
|
|
4162
|
+
}
|
|
4163
|
+
return isMultiPath;
|
|
4164
|
+
}
|
|
4165
|
+
function getUrlPathName(uri) {
|
|
4166
|
+
return uri && url.parse(uri).pathname;
|
|
4167
|
+
}
|
|
4168
|
+
function isStringPath(pathFilter) {
|
|
4169
|
+
return 'string' == typeof pathFilter && !isGlob(pathFilter);
|
|
4170
|
+
}
|
|
4171
|
+
function isGlobPath(pathFilter) {
|
|
4172
|
+
return isGlob(pathFilter);
|
|
4173
|
+
}
|
|
4174
|
+
},
|
|
4175
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/path-rewriter.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4176
|
+
exports.createPathRewriter = createPathRewriter;
|
|
4177
|
+
const is_plain_object_1 = __webpack_require__("./node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.js");
|
|
4178
|
+
const errors_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/errors.js");
|
|
4179
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
4180
|
+
const debug = debug_1.Debug.extend('path-rewriter');
|
|
4181
|
+
function createPathRewriter(rewriteConfig) {
|
|
4182
|
+
let rulesCache;
|
|
4183
|
+
if (!isValidRewriteConfig(rewriteConfig)) return;
|
|
4184
|
+
if ('function' == typeof rewriteConfig) {
|
|
4185
|
+
const customRewriteFn = rewriteConfig;
|
|
4186
|
+
return customRewriteFn;
|
|
4187
|
+
}
|
|
4188
|
+
rulesCache = parsePathRewriteRules(rewriteConfig);
|
|
4189
|
+
return rewritePath;
|
|
4190
|
+
function rewritePath(path) {
|
|
4191
|
+
let result = path;
|
|
4192
|
+
for (const rule of rulesCache)if (rule.regex.test(path)) {
|
|
4193
|
+
result = result.replace(rule.regex, rule.value);
|
|
4194
|
+
debug('rewriting path from "%s" to "%s"', path, result);
|
|
4195
|
+
break;
|
|
4196
|
+
}
|
|
4197
|
+
return result;
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
function isValidRewriteConfig(rewriteConfig) {
|
|
4201
|
+
if ('function' == typeof rewriteConfig) return true;
|
|
4202
|
+
if ((0, is_plain_object_1.isPlainObject)(rewriteConfig)) return 0 !== Object.keys(rewriteConfig).length;
|
|
4203
|
+
if (null == rewriteConfig) return false;
|
|
4204
|
+
throw new Error(errors_1.ERRORS.ERR_PATH_REWRITER_CONFIG);
|
|
4205
|
+
}
|
|
4206
|
+
function parsePathRewriteRules(rewriteConfig) {
|
|
4207
|
+
const rules = [];
|
|
4208
|
+
if ((0, is_plain_object_1.isPlainObject)(rewriteConfig)) for (const [key, value] of Object.entries(rewriteConfig)){
|
|
4209
|
+
rules.push({
|
|
4210
|
+
regex: new RegExp(key),
|
|
4211
|
+
value: value
|
|
4212
|
+
});
|
|
4213
|
+
debug('rewrite rule created: "%s" ~> "%s"', key, value);
|
|
4214
|
+
}
|
|
4215
|
+
return rules;
|
|
4216
|
+
}
|
|
4217
|
+
},
|
|
4218
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/debug-proxy-errors-plugin.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4219
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4220
|
+
value: true
|
|
4221
|
+
});
|
|
4222
|
+
exports.debugProxyErrorsPlugin = void 0;
|
|
4223
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
4224
|
+
const debug = debug_1.Debug.extend('debug-proxy-errors-plugin');
|
|
4225
|
+
const debugProxyErrorsPlugin = (proxyServer)=>{
|
|
4226
|
+
proxyServer.on('error', (error, req, res, target)=>{
|
|
4227
|
+
debug(`http-proxy error event: \n%O`, error);
|
|
4228
|
+
});
|
|
4229
|
+
proxyServer.on('proxyReq', (proxyReq, req, socket)=>{
|
|
4230
|
+
socket.on('error', (error)=>{
|
|
4231
|
+
debug('Socket error in proxyReq event: \n%O', error);
|
|
4232
|
+
});
|
|
4233
|
+
});
|
|
4234
|
+
proxyServer.on('proxyRes', (proxyRes, req, res)=>{
|
|
4235
|
+
res.on('close', ()=>{
|
|
4236
|
+
if (!res.writableEnded) {
|
|
4237
|
+
debug('Destroying proxyRes in proxyRes close event');
|
|
4238
|
+
proxyRes.destroy();
|
|
4239
|
+
}
|
|
4240
|
+
});
|
|
4241
|
+
});
|
|
4242
|
+
proxyServer.on('proxyReqWs', (proxyReq, req, socket)=>{
|
|
4243
|
+
socket.on('error', (error)=>{
|
|
4244
|
+
debug('Socket error in proxyReqWs event: \n%O', error);
|
|
4245
|
+
});
|
|
4246
|
+
});
|
|
4247
|
+
proxyServer.on('open', (proxySocket)=>{
|
|
4248
|
+
proxySocket.on('error', (error)=>{
|
|
4249
|
+
debug('Socket error in open event: \n%O', error);
|
|
4250
|
+
});
|
|
4251
|
+
});
|
|
4252
|
+
proxyServer.on('close', (req, socket, head)=>{
|
|
4253
|
+
socket.on('error', (error)=>{
|
|
4254
|
+
debug('Socket error in close event: \n%O', error);
|
|
4255
|
+
});
|
|
4256
|
+
});
|
|
4257
|
+
proxyServer.on('econnreset', (error, req, res, target)=>{
|
|
4258
|
+
debug(`http-proxy econnreset event: \n%O`, error);
|
|
4259
|
+
});
|
|
4260
|
+
};
|
|
4261
|
+
exports.debugProxyErrorsPlugin = debugProxyErrorsPlugin;
|
|
4262
|
+
},
|
|
4263
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/error-response-plugin.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4264
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4265
|
+
value: true
|
|
4266
|
+
});
|
|
4267
|
+
exports.errorResponsePlugin = void 0;
|
|
4268
|
+
const status_code_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/status-code.js");
|
|
4269
|
+
function isResponseLike(obj) {
|
|
4270
|
+
return obj && 'function' == typeof obj.writeHead;
|
|
4271
|
+
}
|
|
4272
|
+
function isSocketLike(obj) {
|
|
4273
|
+
return obj && 'function' == typeof obj.write && !('writeHead' in obj);
|
|
4274
|
+
}
|
|
4275
|
+
const errorResponsePlugin = (proxyServer, options)=>{
|
|
4276
|
+
proxyServer.on('error', (err, req, res, target)=>{
|
|
4277
|
+
if (!req && !res) throw err;
|
|
4278
|
+
if (isResponseLike(res)) {
|
|
4279
|
+
if (!res.headersSent) {
|
|
4280
|
+
const statusCode = (0, status_code_1.getStatusCode)(err.code);
|
|
4281
|
+
res.writeHead(statusCode);
|
|
4282
|
+
}
|
|
4283
|
+
const host = req.headers && req.headers.host;
|
|
4284
|
+
res.end(`Error occurred while trying to proxy: ${host}${req.url}`);
|
|
4285
|
+
} else if (isSocketLike(res)) res.destroy();
|
|
4286
|
+
});
|
|
4287
|
+
};
|
|
4288
|
+
exports.errorResponsePlugin = errorResponsePlugin;
|
|
4289
|
+
},
|
|
4290
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4291
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
4292
|
+
if (void 0 === k2) k2 = k;
|
|
4293
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4294
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
4295
|
+
enumerable: true,
|
|
4296
|
+
get: function() {
|
|
4297
|
+
return m[k];
|
|
4298
|
+
}
|
|
4299
|
+
};
|
|
4300
|
+
Object.defineProperty(o, k2, desc);
|
|
4301
|
+
} : function(o, m, k, k2) {
|
|
4302
|
+
if (void 0 === k2) k2 = k;
|
|
4303
|
+
o[k2] = m[k];
|
|
4304
|
+
});
|
|
4305
|
+
var __exportStar = this && this.__exportStar || function(m, exports) {
|
|
4306
|
+
for(var p in m)if ("default" !== p && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4307
|
+
};
|
|
4308
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4309
|
+
value: true
|
|
4310
|
+
});
|
|
4311
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/debug-proxy-errors-plugin.js"), exports);
|
|
4312
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/error-response-plugin.js"), exports);
|
|
4313
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/logger-plugin.js"), exports);
|
|
4314
|
+
__exportStar(__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/proxy-events.js"), exports);
|
|
4315
|
+
},
|
|
4316
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/logger-plugin.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4317
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4318
|
+
value: true
|
|
4319
|
+
});
|
|
4320
|
+
exports.loggerPlugin = void 0;
|
|
4321
|
+
const url_1 = __webpack_require__("url");
|
|
4322
|
+
const logger_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/logger.js");
|
|
4323
|
+
const logger_plugin_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/utils/logger-plugin.js");
|
|
4324
|
+
const loggerPlugin = (proxyServer, options)=>{
|
|
4325
|
+
const logger = (0, logger_1.getLogger)(options);
|
|
4326
|
+
proxyServer.on('error', (err, req, res, target)=>{
|
|
4327
|
+
const hostname = req?.headers?.host;
|
|
4328
|
+
const requestHref = `${hostname}${req?.url}`;
|
|
4329
|
+
const targetHref = `${target?.href}`;
|
|
4330
|
+
const errorMessage = '[HPM] Error occurred while proxying request %s to %s [%s] (%s)';
|
|
4331
|
+
const errReference = 'https://nodejs.org/api/errors.html#errors_common_system_errors';
|
|
4332
|
+
logger.error(errorMessage, requestHref, targetHref, err.code || err, errReference);
|
|
4333
|
+
});
|
|
4334
|
+
proxyServer.on('proxyRes', (proxyRes, req, res)=>{
|
|
4335
|
+
const originalUrl = req.originalUrl ?? `${req.baseUrl || ''}${req.url}`;
|
|
4336
|
+
let target;
|
|
4337
|
+
try {
|
|
4338
|
+
const port = (0, logger_plugin_1.getPort)(proxyRes.req?.agent?.sockets);
|
|
4339
|
+
const obj = {
|
|
4340
|
+
protocol: proxyRes.req.protocol,
|
|
4341
|
+
host: proxyRes.req.host,
|
|
4342
|
+
pathname: proxyRes.req.path
|
|
4343
|
+
};
|
|
4344
|
+
target = new url_1.URL(`${obj.protocol}//${obj.host}${obj.pathname}`);
|
|
4345
|
+
if (port) target.port = port;
|
|
4346
|
+
} catch (err) {
|
|
4347
|
+
target = new url_1.URL(options.target);
|
|
4348
|
+
target.pathname = proxyRes.req.path;
|
|
4349
|
+
}
|
|
4350
|
+
const targetUrl = target.toString();
|
|
4351
|
+
const exchange = `[HPM] ${req.method} ${originalUrl} -> ${targetUrl} [${proxyRes.statusCode}]`;
|
|
4352
|
+
logger.info(exchange);
|
|
4353
|
+
});
|
|
4354
|
+
proxyServer.on('open', (socket)=>{
|
|
4355
|
+
logger.info('[HPM] Client connected: %o', socket.address());
|
|
4356
|
+
});
|
|
4357
|
+
proxyServer.on('close', (req, proxySocket, proxyHead)=>{
|
|
4358
|
+
logger.info('[HPM] Client disconnected: %o', proxySocket.address());
|
|
4359
|
+
});
|
|
4360
|
+
};
|
|
4361
|
+
exports.loggerPlugin = loggerPlugin;
|
|
4362
|
+
},
|
|
4363
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/plugins/default/proxy-events.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4364
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4365
|
+
value: true
|
|
4366
|
+
});
|
|
4367
|
+
exports.proxyEventsPlugin = void 0;
|
|
4368
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
4369
|
+
const function_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/utils/function.js");
|
|
4370
|
+
const debug = debug_1.Debug.extend('proxy-events-plugin');
|
|
4371
|
+
const proxyEventsPlugin = (proxyServer, options)=>{
|
|
4372
|
+
Object.entries(options.on || {}).forEach(([eventName, handler])=>{
|
|
4373
|
+
debug(`register event handler: "${eventName}" -> "${(0, function_1.getFunctionName)(handler)}"`);
|
|
4374
|
+
proxyServer.on(eventName, handler);
|
|
4375
|
+
});
|
|
4376
|
+
};
|
|
4377
|
+
exports.proxyEventsPlugin = proxyEventsPlugin;
|
|
4378
|
+
},
|
|
4379
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/router.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
4380
|
+
exports.getTarget = getTarget;
|
|
4381
|
+
const is_plain_object_1 = __webpack_require__("./node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.js");
|
|
4382
|
+
const debug_1 = __webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/debug.js");
|
|
4383
|
+
const debug = debug_1.Debug.extend('router');
|
|
4384
|
+
async function getTarget(req, config) {
|
|
4385
|
+
let newTarget;
|
|
4386
|
+
const router = config.router;
|
|
4387
|
+
if ((0, is_plain_object_1.isPlainObject)(router)) newTarget = getTargetFromProxyTable(req, router);
|
|
4388
|
+
else if ('function' == typeof router) newTarget = await router(req);
|
|
4389
|
+
return newTarget;
|
|
4390
|
+
}
|
|
4391
|
+
function getTargetFromProxyTable(req, table) {
|
|
4392
|
+
let result;
|
|
4393
|
+
const host = req.headers.host;
|
|
4394
|
+
const path = req.url;
|
|
4395
|
+
const hostAndPath = host + path;
|
|
4396
|
+
for (const [key, value] of Object.entries(table))if (containsPath(key)) {
|
|
4397
|
+
if (hostAndPath.indexOf(key) > -1) {
|
|
4398
|
+
result = value;
|
|
4399
|
+
debug('match: "%s" -> "%s"', key, result);
|
|
4400
|
+
break;
|
|
4401
|
+
}
|
|
4402
|
+
} else if (key === host) {
|
|
4403
|
+
result = value;
|
|
4404
|
+
debug('match: "%s" -> "%s"', host, result);
|
|
4405
|
+
break;
|
|
4406
|
+
}
|
|
4407
|
+
return result;
|
|
4408
|
+
}
|
|
4409
|
+
function containsPath(v) {
|
|
4410
|
+
return v.indexOf('/') > -1;
|
|
4411
|
+
}
|
|
4412
|
+
},
|
|
4413
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/status-code.js" (__unused_rspack_module, exports) {
|
|
4414
|
+
exports.getStatusCode = getStatusCode;
|
|
4415
|
+
function getStatusCode(errorCode) {
|
|
4416
|
+
let statusCode;
|
|
4417
|
+
if (/HPE_INVALID/.test(errorCode)) statusCode = 502;
|
|
4418
|
+
else switch(errorCode){
|
|
4419
|
+
case 'ECONNRESET':
|
|
4420
|
+
case 'ENOTFOUND':
|
|
4421
|
+
case 'ECONNREFUSED':
|
|
4422
|
+
case 'ETIMEDOUT':
|
|
4423
|
+
statusCode = 504;
|
|
4424
|
+
break;
|
|
4425
|
+
default:
|
|
4426
|
+
statusCode = 500;
|
|
4427
|
+
break;
|
|
4428
|
+
}
|
|
4429
|
+
return statusCode;
|
|
4430
|
+
}
|
|
4431
|
+
},
|
|
4432
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/utils/function.js" (__unused_rspack_module, exports) {
|
|
4433
|
+
exports.getFunctionName = getFunctionName;
|
|
4434
|
+
function getFunctionName(fn) {
|
|
4435
|
+
return fn.name || '[anonymous Function]';
|
|
4436
|
+
}
|
|
4437
|
+
},
|
|
4438
|
+
"./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/utils/logger-plugin.js" (__unused_rspack_module, exports) {
|
|
4439
|
+
exports.getPort = getPort;
|
|
4440
|
+
function getPort(sockets) {
|
|
4441
|
+
return Object.keys(sockets || {})?.[0]?.split(':')[1];
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
});
|
|
4445
|
+
__webpack_require__("./node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/index.js");
|
|
4446
|
+
var dist__esModule = true;
|
|
4447
|
+
export { dist__esModule as __esModule };
|