@rsbuild/core 2.1.7 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/cors/index.d.ts +1 -1
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.d.ts +1 -1
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/node.d.ts +2 -2
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/dist/{711.js → 626.js} +106 -84
- package/dist/build.d.ts +4 -0
- package/dist/chokidar.js +1 -1046
- package/{dist-types → dist}/cli/commands.d.ts +2 -2
- package/{dist-types → dist}/cli/init.d.ts +2 -2
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/{dist-types → dist}/configChain.d.ts +2 -2
- package/dist/connect-next.js +1 -876
- package/dist/cors.js +1 -1
- package/{dist-types → dist}/createCompiler.d.ts +2 -2
- package/{dist-types → dist}/createContext.d.ts +3 -3
- package/{dist-types → dist}/createRsbuild.d.ts +1 -1
- package/{dist-types → dist}/defaultConfig.d.ts +1 -1
- package/{dist-types → dist}/helpers/compiler.d.ts +1 -1
- package/{dist-types → dist}/helpers/css.d.ts +1 -1
- package/{dist-types → dist}/helpers/format.d.ts +1 -1
- package/{dist-types → dist}/helpers/fs.d.ts +2 -2
- package/{dist-types → dist}/helpers/index.d.ts +4 -4
- package/{dist-types → dist}/helpers/overlayConfig.d.ts +1 -1
- package/{dist-types → dist}/helpers/path.d.ts +1 -1
- package/{dist-types → dist}/helpers/restartManager.d.ts +2 -2
- package/{dist-types → dist}/helpers/stats.d.ts +2 -2
- package/{dist-types → dist}/helpers/url.d.ts +2 -2
- package/{dist-types → dist}/helpers/vendors.d.ts +1 -1
- package/{dist-types → dist}/hooks.d.ts +1 -1
- package/dist/http-proxy-middleware.js +5 -3010
- package/{dist-types → dist}/index.d.ts +14 -14
- package/dist/index.js +1 -1
- package/{dist-types → dist}/initConfigs.d.ts +1 -1
- package/{dist-types → dist}/initPlugins.d.ts +2 -2
- package/{dist-types → dist}/inspectConfig.d.ts +2 -2
- package/dist/launch-editor-middleware.js +1 -544
- package/{dist-types → dist}/loadConfig.d.ts +6 -6
- package/{dist-types → dist}/loader/cssUrlLoader.d.ts +1 -1
- package/{dist-types → dist}/loader/ignoreCssLoader.d.ts +1 -1
- package/{dist-types → dist}/loader/transformLoader.d.ts +1 -1
- package/{dist-types → dist}/loader/transformRawLoader.d.ts +1 -1
- package/{dist-types → dist}/logger.d.ts +1 -1
- package/dist/manifest-plugin.js +1 -692
- package/dist/memfs.js +1 -5695
- package/{dist-types → dist}/mergeConfig.d.ts +1 -1
- package/dist/open.js +2 -439
- package/{dist-types → dist}/pluginHelper.d.ts +1 -1
- package/{dist-types → dist}/pluginManager.d.ts +2 -2
- package/{dist-types → dist}/plugins/appIcon.d.ts +1 -1
- package/{dist-types → dist}/plugins/asset.d.ts +1 -1
- package/{dist-types → dist}/plugins/basic.d.ts +1 -1
- package/dist/plugins/cache.d.ts +2 -0
- package/{dist-types → dist}/plugins/cleanOutput.d.ts +1 -1
- package/{dist-types → dist}/plugins/css.d.ts +1 -1
- package/{dist-types → dist}/plugins/define.d.ts +1 -1
- package/dist/plugins/entry.d.ts +2 -0
- package/{dist-types → dist}/plugins/externals.d.ts +2 -2
- package/{dist-types → dist}/plugins/fileSize.d.ts +1 -1
- package/{dist-types → dist}/plugins/html.d.ts +1 -1
- package/{dist-types → dist}/plugins/inlineChunk.d.ts +1 -1
- package/{dist-types → dist}/plugins/lazyCompilation.d.ts +1 -1
- package/{dist-types → dist}/plugins/manifest.d.ts +1 -1
- package/{dist-types → dist}/plugins/minimize.d.ts +2 -2
- package/{dist-types → dist}/plugins/moduleFederation.d.ts +1 -1
- package/{dist-types → dist}/plugins/nodeAddons.d.ts +1 -1
- package/dist/plugins/nonce.d.ts +2 -0
- package/{dist-types → dist}/plugins/output.d.ts +1 -1
- package/{dist-types → dist}/plugins/progress.d.ts +1 -1
- package/{dist-types → dist}/plugins/resolve.d.ts +1 -1
- package/{dist-types → dist}/plugins/resourceHints.d.ts +1 -1
- package/{dist-types → dist}/plugins/rsdoctor.d.ts +1 -1
- package/{dist-types → dist}/plugins/rspackProfile.d.ts +1 -1
- package/{dist-types → dist}/plugins/server.d.ts +1 -1
- package/{dist-types → dist}/plugins/sourceMap.d.ts +1 -1
- package/{dist-types → dist}/plugins/splitChunks.d.ts +1 -1
- package/dist/plugins/sri.d.ts +2 -0
- package/{dist-types → dist}/plugins/swc.d.ts +1 -1
- package/{dist-types → dist}/plugins/target.d.ts +1 -1
- package/dist/plugins/wasm.d.ts +2 -0
- package/{dist-types → dist}/plugins/worker.d.ts +1 -1
- package/dist/range-parser.js +1 -1
- package/dist/restart.d.ts +15 -0
- package/{dist-types → dist}/rspack-plugins/RsbuildHtmlPlugin.d.ts +1 -1
- package/{dist-types → dist}/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +1 -1
- package/{dist-types → dist}/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +1 -1
- package/{dist-types → dist}/rspack-plugins/resource-hints/extractChunks.d.ts +1 -1
- package/{dist-types → dist}/rspackConfig.d.ts +1 -1
- package/{dist-types → dist}/server/assets-middleware/getFileFromUrl.d.ts +1 -1
- package/{dist-types → dist}/server/assets-middleware/index.d.ts +2 -2
- package/{dist-types → dist}/server/assets-middleware/middleware.d.ts +1 -1
- package/{dist-types → dist}/server/assets-middleware/setupOutputFileSystem.d.ts +1 -1
- package/{dist-types → dist}/server/assets-middleware/setupWriteToDisk.d.ts +2 -2
- package/{dist-types → dist}/server/browserLogs.d.ts +1 -1
- package/{dist-types → dist}/server/buildManager.d.ts +3 -3
- package/{dist-types → dist}/server/cliShortcuts.d.ts +2 -2
- package/{dist-types → dist}/server/devMiddlewares.d.ts +4 -4
- package/{dist-types → dist}/server/devServer.d.ts +4 -4
- package/{dist-types → dist}/server/environment.d.ts +1 -1
- package/{dist-types → dist}/server/gzipMiddleware.d.ts +1 -1
- package/{dist-types → dist}/server/helper.d.ts +4 -4
- package/{dist-types → dist}/server/historyApiFallback.d.ts +2 -2
- package/{dist-types → dist}/server/httpServer.d.ts +1 -1
- package/{dist-types → dist}/server/middlewares.d.ts +2 -2
- package/{dist-types → dist}/server/open.d.ts +2 -2
- package/{dist-types → dist}/server/previewServer.d.ts +2 -2
- package/{dist-types → dist}/server/proxy.d.ts +3 -3
- package/{dist-types → dist}/server/runner/basic.d.ts +1 -1
- package/{dist-types → dist}/server/runner/cjs.d.ts +2 -2
- package/{dist-types → dist}/server/runner/esm.d.ts +2 -2
- package/{dist-types → dist}/server/runner/index.d.ts +1 -1
- package/{dist-types → dist}/server/serverSetup.d.ts +1 -1
- package/{dist-types → dist}/server/socketServer.d.ts +1 -1
- package/{dist-types → dist}/server/watchFiles.d.ts +4 -3
- package/dist/sirv.js +1 -1
- package/dist/tinyglobby.js +1 -1670
- package/{dist-types → dist}/types/config.d.ts +24 -15
- package/{dist-types → dist}/types/context.d.ts +9 -9
- package/{dist-types → dist}/types/hooks.d.ts +31 -15
- package/dist/types/index.d.ts +8 -0
- package/{dist-types → dist}/types/plugin.d.ts +7 -7
- package/{dist-types → dist}/types/rsbuild.d.ts +15 -14
- package/{dist-types → dist}/types/rspack.d.ts +2 -2
- package/{dist-types → dist}/types/thirdParty.d.ts +5 -5
- package/dist/ws.js +2 -1524
- package/package.json +9 -10
- package/dist-types/build.d.ts +0 -4
- package/dist-types/package.json +0 -1
- package/dist-types/plugins/cache.d.ts +0 -2
- package/dist-types/plugins/entry.d.ts +0 -2
- package/dist-types/plugins/nonce.d.ts +0 -2
- package/dist-types/plugins/sri.d.ts +0 -2
- package/dist-types/plugins/wasm.d.ts +0 -2
- package/dist-types/restart.d.ts +0 -14
- package/dist-types/types/index.d.ts +0 -8
- /package/dist/{711.js.LICENSE.txt → 626.js.LICENSE.txt} +0 -0
- /package/{dist-types → dist}/cli/index.d.ts +0 -0
- /package/dist/client/{307.js → 307~0.js} +0 -0
- /package/{dist-types → dist}/constants.d.ts +0 -0
- /package/{dist-types → dist}/helpers/exitHook.d.ts +0 -0
- /package/{dist-types → dist}/helpers/packageJson.d.ts +0 -0
- /package/{dist-types → dist}/helpers/version.d.ts +0 -0
- /package/{dist-types → dist}/loadEnv.d.ts +0 -0
- /package/{dist-types → dist}/loader/workerLoader.d.ts +0 -0
- /package/dist/{1~rslib-runtime.js → rslib-runtime.js} +0 -0
- /package/{dist-types → dist}/rspack-plugins/resource-hints/getResourceType.d.ts +0 -0
- /package/{dist-types → dist}/server/ansiHTML.d.ts +0 -0
- /package/{dist-types → dist}/server/assets-middleware/parseTokenList.d.ts +0 -0
- /package/{dist-types → dist}/server/compileState.d.ts +0 -0
- /package/{dist-types → dist}/server/gracefulShutdown.d.ts +0 -0
- /package/{dist-types → dist}/server/hmrFallback.d.ts +0 -0
- /package/{dist-types → dist}/server/overlay.d.ts +0 -0
- /package/{dist-types → dist}/server/publicPathnames.d.ts +0 -0
- /package/{dist-types → dist}/server/runner/asModule.d.ts +0 -0
- /package/{dist-types → dist}/server/runner/type.d.ts +0 -0
- /package/{dist-types → dist}/types/utils.d.ts +0 -0
|
@@ -1,2656 +1,5 @@
|
|
|
1
1
|
/*! LICENSE: http-proxy-middleware.js.LICENSE.txt */
|
|
2
|
-
import node_http from "node:http";
|
|
3
|
-
import node_https from "node:https";
|
|
4
|
-
import node_http2 from "node:http2";
|
|
5
|
-
import { EventEmitter } from "node:events";
|
|
6
|
-
import "node:net";
|
|
7
|
-
import "node:stream";
|
|
8
|
-
import { styleText } from "node:util";
|
|
9
|
-
import { URL as external_node_url_URL } from "node:url";
|
|
10
|
-
import { URL as external_url_URL } from "url";
|
|
11
|
-
import "node:zlib";
|
|
12
|
-
import "node:querystring";
|
|
13
|
-
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
14
|
-
import "./711.js";
|
|
15
|
-
__webpack_require__.add({
|
|
16
|
-
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
17
|
-
let stringify = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"), compile = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"), expand = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"), parse = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"), braces = (input, options = {})=>{
|
|
18
|
-
let output = [];
|
|
19
|
-
if (Array.isArray(input)) for (let pattern of input){
|
|
20
|
-
let result = braces.create(pattern, options);
|
|
21
|
-
Array.isArray(result) ? output.push(...result) : output.push(result);
|
|
22
|
-
}
|
|
23
|
-
else output = [].concat(braces.create(input, options));
|
|
24
|
-
return options && !0 === options.expand && !0 === options.nodupes && (output = [
|
|
25
|
-
...new Set(output)
|
|
26
|
-
]), output;
|
|
27
|
-
};
|
|
28
|
-
braces.parse = (input, options = {})=>parse(input, options), braces.stringify = (input, options = {})=>'string' == typeof input ? stringify(braces.parse(input, options), options) : stringify(input, options), braces.compile = (input, options = {})=>('string' == typeof input && (input = braces.parse(input, options)), compile(input, options)), braces.expand = (input, options = {})=>{
|
|
29
|
-
'string' == typeof input && (input = braces.parse(input, options));
|
|
30
|
-
let result = expand(input, options);
|
|
31
|
-
return !0 === options.noempty && (result = result.filter(Boolean)), !0 === options.nodupes && (result = [
|
|
32
|
-
...new Set(result)
|
|
33
|
-
]), result;
|
|
34
|
-
}, braces.create = (input, options = {})=>'' === input || input.length < 3 ? [
|
|
35
|
-
input
|
|
36
|
-
] : !0 !== options.expand ? braces.compile(input, options) : braces.expand(input, options), module.exports = braces;
|
|
37
|
-
},
|
|
38
|
-
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
39
|
-
let fill = __webpack_require__("../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"), utils = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
|
|
40
|
-
module.exports = (ast, options = {})=>{
|
|
41
|
-
let walk = (node, parent = {})=>{
|
|
42
|
-
let invalidBlock = utils.isInvalidBrace(parent), invalidNode = !0 === node.invalid && !0 === options.escapeInvalid, invalid = !0 === invalidBlock || !0 === invalidNode, prefix = !0 === options.escapeInvalid ? '\\' : '', output = '';
|
|
43
|
-
if (!0 === node.isOpen) return prefix + node.value;
|
|
44
|
-
if (!0 === node.isClose) return console.log('node.isClose', prefix, node.value), prefix + node.value;
|
|
45
|
-
if ('open' === node.type) return invalid ? prefix + node.value : '(';
|
|
46
|
-
if ('close' === node.type) return invalid ? prefix + node.value : ')';
|
|
47
|
-
if ('comma' === node.type) return 'comma' === node.prev.type ? '' : invalid ? node.value : '|';
|
|
48
|
-
if (node.value) return node.value;
|
|
49
|
-
if (node.nodes && node.ranges > 0) {
|
|
50
|
-
let args = utils.reduce(node.nodes), range = fill(...args, {
|
|
51
|
-
...options,
|
|
52
|
-
wrap: !1,
|
|
53
|
-
toRegex: !0,
|
|
54
|
-
strictZeros: !0
|
|
55
|
-
});
|
|
56
|
-
if (0 !== range.length) return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
57
|
-
}
|
|
58
|
-
if (node.nodes) for (let child of node.nodes)output += walk(child, node);
|
|
59
|
-
return output;
|
|
60
|
-
};
|
|
61
|
-
return walk(ast);
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js" (module) {
|
|
65
|
-
module.exports = {
|
|
66
|
-
MAX_LENGTH: 10000,
|
|
67
|
-
CHAR_0: '0',
|
|
68
|
-
CHAR_9: '9',
|
|
69
|
-
CHAR_UPPERCASE_A: 'A',
|
|
70
|
-
CHAR_LOWERCASE_A: 'a',
|
|
71
|
-
CHAR_UPPERCASE_Z: 'Z',
|
|
72
|
-
CHAR_LOWERCASE_Z: 'z',
|
|
73
|
-
CHAR_LEFT_PARENTHESES: '(',
|
|
74
|
-
CHAR_RIGHT_PARENTHESES: ')',
|
|
75
|
-
CHAR_ASTERISK: '*',
|
|
76
|
-
CHAR_AMPERSAND: '&',
|
|
77
|
-
CHAR_AT: '@',
|
|
78
|
-
CHAR_BACKSLASH: '\\',
|
|
79
|
-
CHAR_BACKTICK: '`',
|
|
80
|
-
CHAR_CARRIAGE_RETURN: '\r',
|
|
81
|
-
CHAR_CIRCUMFLEX_ACCENT: '^',
|
|
82
|
-
CHAR_COLON: ':',
|
|
83
|
-
CHAR_COMMA: ',',
|
|
84
|
-
CHAR_DOLLAR: '$',
|
|
85
|
-
CHAR_DOT: '.',
|
|
86
|
-
CHAR_DOUBLE_QUOTE: '"',
|
|
87
|
-
CHAR_EQUAL: '=',
|
|
88
|
-
CHAR_EXCLAMATION_MARK: '!',
|
|
89
|
-
CHAR_FORM_FEED: '\f',
|
|
90
|
-
CHAR_FORWARD_SLASH: '/',
|
|
91
|
-
CHAR_HASH: '#',
|
|
92
|
-
CHAR_HYPHEN_MINUS: '-',
|
|
93
|
-
CHAR_LEFT_ANGLE_BRACKET: '<',
|
|
94
|
-
CHAR_LEFT_CURLY_BRACE: '{',
|
|
95
|
-
CHAR_LEFT_SQUARE_BRACKET: '[',
|
|
96
|
-
CHAR_LINE_FEED: '\n',
|
|
97
|
-
CHAR_NO_BREAK_SPACE: '\u00A0',
|
|
98
|
-
CHAR_PERCENT: '%',
|
|
99
|
-
CHAR_PLUS: '+',
|
|
100
|
-
CHAR_QUESTION_MARK: '?',
|
|
101
|
-
CHAR_RIGHT_ANGLE_BRACKET: '>',
|
|
102
|
-
CHAR_RIGHT_CURLY_BRACE: '}',
|
|
103
|
-
CHAR_RIGHT_SQUARE_BRACKET: ']',
|
|
104
|
-
CHAR_SEMICOLON: ';',
|
|
105
|
-
CHAR_SINGLE_QUOTE: '\'',
|
|
106
|
-
CHAR_SPACE: ' ',
|
|
107
|
-
CHAR_TAB: '\t',
|
|
108
|
-
CHAR_UNDERSCORE: '_',
|
|
109
|
-
CHAR_VERTICAL_LINE: '|',
|
|
110
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF'
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
114
|
-
let fill = __webpack_require__("../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"), stringify = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"), utils = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js"), append = (queue = '', stash = '', enclose = !1)=>{
|
|
115
|
-
let result = [];
|
|
116
|
-
if (queue = [].concat(queue), !(stash = [].concat(stash)).length) return queue;
|
|
117
|
-
if (!queue.length) return enclose ? utils.flatten(stash).map((ele)=>`{${ele}}`) : stash;
|
|
118
|
-
for (let item of queue)if (Array.isArray(item)) for (let value of item)result.push(append(value, stash, enclose));
|
|
119
|
-
else for (let ele of stash)!0 === enclose && 'string' == typeof ele && (ele = `{${ele}}`), result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
120
|
-
return utils.flatten(result);
|
|
121
|
-
};
|
|
122
|
-
module.exports = (ast, options = {})=>{
|
|
123
|
-
let rangeLimit = void 0 === options.rangeLimit ? 1000 : options.rangeLimit, walk = (node, parent = {})=>{
|
|
124
|
-
node.queue = [];
|
|
125
|
-
let p = parent, q = parent.queue;
|
|
126
|
-
for(; 'brace' !== p.type && 'root' !== p.type && p.parent;)q = (p = p.parent).queue;
|
|
127
|
-
if (node.invalid || node.dollar) return void q.push(append(q.pop(), stringify(node, options)));
|
|
128
|
-
if ('brace' === node.type && !0 !== node.invalid && 2 === node.nodes.length) return void q.push(append(q.pop(), [
|
|
129
|
-
'{}'
|
|
130
|
-
]));
|
|
131
|
-
if (node.nodes && node.ranges > 0) {
|
|
132
|
-
let args = utils.reduce(node.nodes);
|
|
133
|
-
if (utils.exceedsLimit(...args, options.step, rangeLimit)) throw RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
|
|
134
|
-
let range = fill(...args, options);
|
|
135
|
-
0 === range.length && (range = stringify(node, options)), q.push(append(q.pop(), range)), node.nodes = [];
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
let enclose = utils.encloseBrace(node), queue = node.queue, block = node;
|
|
139
|
-
for(; 'brace' !== block.type && 'root' !== block.type && block.parent;)queue = (block = block.parent).queue;
|
|
140
|
-
for(let i = 0; i < node.nodes.length; i++){
|
|
141
|
-
let child = node.nodes[i];
|
|
142
|
-
if ('comma' === child.type && 'brace' === node.type) {
|
|
143
|
-
1 === i && queue.push(''), queue.push('');
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
if ('close' === child.type) {
|
|
147
|
-
q.push(append(q.pop(), queue, enclose));
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
if (child.value && 'open' !== child.type) {
|
|
151
|
-
queue.push(append(queue.pop(), child.value));
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
child.nodes && walk(child, node);
|
|
155
|
-
}
|
|
156
|
-
return queue;
|
|
157
|
-
};
|
|
158
|
-
return utils.flatten(walk(ast));
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
162
|
-
let stringify = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"), { 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");
|
|
163
|
-
module.exports = (input, options = {})=>{
|
|
164
|
-
let value;
|
|
165
|
-
if ('string' != typeof input) throw TypeError('Expected a string');
|
|
166
|
-
let opts = options || {}, max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
167
|
-
if (input.length > max) throw SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
168
|
-
let ast = {
|
|
169
|
-
type: 'root',
|
|
170
|
-
input,
|
|
171
|
-
nodes: []
|
|
172
|
-
}, stack = [
|
|
173
|
-
ast
|
|
174
|
-
], block = ast, prev = ast, brackets = 0, length = input.length, index = 0, depth = 0, advance = ()=>input[index++], push = (node)=>{
|
|
175
|
-
if ('text' === node.type && 'dot' === prev.type && (prev.type = 'text'), prev && 'text' === prev.type && 'text' === node.type) {
|
|
176
|
-
prev.value += node.value;
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
return block.nodes.push(node), node.parent = block, node.prev = prev, prev = node, node;
|
|
180
|
-
};
|
|
181
|
-
for(push({
|
|
182
|
-
type: 'bos'
|
|
183
|
-
}); index < length;)if (block = stack[stack.length - 1], (value = advance()) !== CHAR_ZERO_WIDTH_NOBREAK_SPACE && value !== CHAR_NO_BREAK_SPACE) {
|
|
184
|
-
if (value === CHAR_BACKSLASH) {
|
|
185
|
-
push({
|
|
186
|
-
type: 'text',
|
|
187
|
-
value: (options.keepEscaping ? value : '') + advance()
|
|
188
|
-
});
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
192
|
-
push({
|
|
193
|
-
type: 'text',
|
|
194
|
-
value: '\\' + value
|
|
195
|
-
});
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
199
|
-
let next;
|
|
200
|
-
for(brackets++; index < length && (next = advance());){
|
|
201
|
-
if (value += next, next === CHAR_LEFT_SQUARE_BRACKET) {
|
|
202
|
-
brackets++;
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
if (next === CHAR_BACKSLASH) {
|
|
206
|
-
value += advance();
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET && 0 == --brackets) break;
|
|
210
|
-
}
|
|
211
|
-
push({
|
|
212
|
-
type: 'text',
|
|
213
|
-
value
|
|
214
|
-
});
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
if (value === CHAR_LEFT_PARENTHESES) {
|
|
218
|
-
block = push({
|
|
219
|
-
type: 'paren',
|
|
220
|
-
nodes: []
|
|
221
|
-
}), stack.push(block), push({
|
|
222
|
-
type: 'text',
|
|
223
|
-
value
|
|
224
|
-
});
|
|
225
|
-
continue;
|
|
226
|
-
}
|
|
227
|
-
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
228
|
-
if ('paren' !== block.type) {
|
|
229
|
-
push({
|
|
230
|
-
type: 'text',
|
|
231
|
-
value
|
|
232
|
-
});
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
block = stack.pop(), push({
|
|
236
|
-
type: 'text',
|
|
237
|
-
value
|
|
238
|
-
}), block = stack[stack.length - 1];
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
242
|
-
let next, open = value;
|
|
243
|
-
for(!0 !== options.keepQuotes && (value = ''); index < length && (next = advance());){
|
|
244
|
-
if (next === CHAR_BACKSLASH) {
|
|
245
|
-
value += next + advance();
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
if (next === open) {
|
|
249
|
-
!0 === options.keepQuotes && (value += next);
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
value += next;
|
|
253
|
-
}
|
|
254
|
-
push({
|
|
255
|
-
type: 'text',
|
|
256
|
-
value
|
|
257
|
-
});
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
261
|
-
depth++, block = push({
|
|
262
|
-
type: 'brace',
|
|
263
|
-
open: !0,
|
|
264
|
-
close: !1,
|
|
265
|
-
dollar: prev.value && '$' === prev.value.slice(-1) || !0 === block.dollar,
|
|
266
|
-
depth,
|
|
267
|
-
commas: 0,
|
|
268
|
-
ranges: 0,
|
|
269
|
-
nodes: []
|
|
270
|
-
}), stack.push(block), push({
|
|
271
|
-
type: 'open',
|
|
272
|
-
value
|
|
273
|
-
});
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
277
|
-
if ('brace' !== block.type) {
|
|
278
|
-
push({
|
|
279
|
-
type: 'text',
|
|
280
|
-
value
|
|
281
|
-
});
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
(block = stack.pop()).close = !0, push({
|
|
285
|
-
type: 'close',
|
|
286
|
-
value
|
|
287
|
-
}), depth--, block = stack[stack.length - 1];
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
if (value === CHAR_COMMA && depth > 0) {
|
|
291
|
-
if (block.ranges > 0) {
|
|
292
|
-
block.ranges = 0;
|
|
293
|
-
let open = block.nodes.shift();
|
|
294
|
-
block.nodes = [
|
|
295
|
-
open,
|
|
296
|
-
{
|
|
297
|
-
type: 'text',
|
|
298
|
-
value: stringify(block)
|
|
299
|
-
}
|
|
300
|
-
];
|
|
301
|
-
}
|
|
302
|
-
push({
|
|
303
|
-
type: 'comma',
|
|
304
|
-
value
|
|
305
|
-
}), block.commas++;
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
if (value === CHAR_DOT && depth > 0 && 0 === block.commas) {
|
|
309
|
-
let siblings = block.nodes;
|
|
310
|
-
if (0 === depth || 0 === siblings.length) {
|
|
311
|
-
push({
|
|
312
|
-
type: 'text',
|
|
313
|
-
value
|
|
314
|
-
});
|
|
315
|
-
continue;
|
|
316
|
-
}
|
|
317
|
-
if ('dot' === prev.type) {
|
|
318
|
-
if (block.range = [], prev.value += value, prev.type = 'range', 3 !== block.nodes.length && 5 !== block.nodes.length) {
|
|
319
|
-
block.invalid = !0, block.ranges = 0, prev.type = 'text';
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
block.ranges++, block.args = [];
|
|
323
|
-
continue;
|
|
324
|
-
}
|
|
325
|
-
if ('range' === prev.type) {
|
|
326
|
-
siblings.pop();
|
|
327
|
-
let before = siblings[siblings.length - 1];
|
|
328
|
-
before.value += prev.value + value, prev = before, block.ranges--;
|
|
329
|
-
continue;
|
|
330
|
-
}
|
|
331
|
-
push({
|
|
332
|
-
type: 'dot',
|
|
333
|
-
value
|
|
334
|
-
});
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
push({
|
|
338
|
-
type: 'text',
|
|
339
|
-
value
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
do if ('root' !== (block = stack.pop()).type) {
|
|
343
|
-
block.nodes.forEach((node)=>{
|
|
344
|
-
node.nodes || ('open' === node.type && (node.isOpen = !0), 'close' === node.type && (node.isClose = !0), node.nodes || (node.type = 'text'), node.invalid = !0);
|
|
345
|
-
});
|
|
346
|
-
let parent = stack[stack.length - 1], index = parent.nodes.indexOf(block);
|
|
347
|
-
parent.nodes.splice(index, 1, ...block.nodes);
|
|
348
|
-
}
|
|
349
|
-
while (stack.length > 0);
|
|
350
|
-
return push({
|
|
351
|
-
type: 'eos'
|
|
352
|
-
}), ast;
|
|
353
|
-
};
|
|
354
|
-
},
|
|
355
|
-
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
356
|
-
let utils = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");
|
|
357
|
-
module.exports = (ast, options = {})=>{
|
|
358
|
-
let stringify = (node, parent = {})=>{
|
|
359
|
-
let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent), invalidNode = !0 === node.invalid && !0 === options.escapeInvalid, output = '';
|
|
360
|
-
if (node.value) return (invalidBlock || invalidNode) && utils.isOpenOrClose(node) ? '\\' + node.value : node.value;
|
|
361
|
-
if (node.value) return node.value;
|
|
362
|
-
if (node.nodes) for (let child of node.nodes)output += stringify(child);
|
|
363
|
-
return output;
|
|
364
|
-
};
|
|
365
|
-
return stringify(ast);
|
|
366
|
-
};
|
|
367
|
-
},
|
|
368
|
-
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js" (__unused_rspack_module, exports) {
|
|
369
|
-
exports.isInteger = (num)=>'number' == typeof num ? Number.isInteger(num) : 'string' == typeof num && '' !== num.trim() && Number.isInteger(Number(num)), exports.find = (node, type)=>node.nodes.find((node)=>node.type === type), exports.exceedsLimit = (min, max, step = 1, limit)=>!1 !== limit && !!exports.isInteger(min) && !!exports.isInteger(max) && (Number(max) - Number(min)) / Number(step) >= limit, exports.escapeNode = (block, n = 0, type)=>{
|
|
370
|
-
let node = block.nodes[n];
|
|
371
|
-
node && (type && node.type === type || 'open' === node.type || 'close' === node.type) && !0 !== node.escaped && (node.value = '\\' + node.value, node.escaped = !0);
|
|
372
|
-
}, exports.encloseBrace = (node)=>'brace' === node.type && node.commas >> 0 + node.ranges == 0 && (node.invalid = !0, !0), exports.isInvalidBrace = (block)=>'brace' === block.type && (!0 === block.invalid || !!block.dollar || (block.commas >> 0 + block.ranges == 0 || !0 !== block.open || !0 !== block.close) && (block.invalid = !0, !0)), exports.isOpenOrClose = (node)=>'open' === node.type || 'close' === node.type || !0 === node.open || !0 === node.close, exports.reduce = (nodes)=>nodes.reduce((acc, node)=>('text' === node.type && acc.push(node.value), 'range' === node.type && (node.type = 'text'), acc), []), exports.flatten = (...args)=>{
|
|
373
|
-
let result = [], flat = (arr)=>{
|
|
374
|
-
for(let i = 0; i < arr.length; i++){
|
|
375
|
-
let ele = arr[i];
|
|
376
|
-
if (Array.isArray(ele)) {
|
|
377
|
-
flat(ele);
|
|
378
|
-
continue;
|
|
379
|
-
}
|
|
380
|
-
void 0 !== ele && result.push(ele);
|
|
381
|
-
}
|
|
382
|
-
return result;
|
|
383
|
-
};
|
|
384
|
-
return flat(args), result;
|
|
385
|
-
};
|
|
386
|
-
},
|
|
387
|
-
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js" (module, exports, __webpack_require__) {
|
|
388
|
-
let warned;
|
|
389
|
-
function useColors() {
|
|
390
|
-
let m;
|
|
391
|
-
return "u" > typeof window && !!window.process && ('renderer' === window.process.type || !!window.process.__nwjs) || !("u" > typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) && ("u" > typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "u" > typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "u" > typeof navigator && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || "u" > typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
392
|
-
}
|
|
393
|
-
function formatArgs(args) {
|
|
394
|
-
if (args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff), !this.useColors) return;
|
|
395
|
-
let c = 'color: ' + this.color;
|
|
396
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
397
|
-
let index = 0, lastC = 0;
|
|
398
|
-
args[0].replace(/%[a-zA-Z%]/g, (match)=>{
|
|
399
|
-
'%%' !== match && (index++, '%c' === match && (lastC = index));
|
|
400
|
-
}), args.splice(lastC, 0, c);
|
|
401
|
-
}
|
|
402
|
-
function save(namespaces) {
|
|
403
|
-
try {
|
|
404
|
-
namespaces ? exports.storage.setItem('debug', namespaces) : exports.storage.removeItem('debug');
|
|
405
|
-
} catch (error) {}
|
|
406
|
-
}
|
|
407
|
-
function load() {
|
|
408
|
-
let r;
|
|
409
|
-
try {
|
|
410
|
-
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG');
|
|
411
|
-
} catch (error) {}
|
|
412
|
-
return !r && "u" > typeof process && 'env' in process && (r = process.env.DEBUG), r;
|
|
413
|
-
}
|
|
414
|
-
function localstorage() {
|
|
415
|
-
try {
|
|
416
|
-
return localStorage;
|
|
417
|
-
} catch (error) {}
|
|
418
|
-
}
|
|
419
|
-
exports.formatArgs = formatArgs, exports.save = save, exports.load = load, exports.useColors = useColors, exports.storage = localstorage(), warned = !1, exports.destroy = ()=>{
|
|
420
|
-
warned || (warned = !0, console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'));
|
|
421
|
-
}, exports.colors = [
|
|
422
|
-
'#0000CC',
|
|
423
|
-
'#0000FF',
|
|
424
|
-
'#0033CC',
|
|
425
|
-
'#0033FF',
|
|
426
|
-
'#0066CC',
|
|
427
|
-
'#0066FF',
|
|
428
|
-
'#0099CC',
|
|
429
|
-
'#0099FF',
|
|
430
|
-
'#00CC00',
|
|
431
|
-
'#00CC33',
|
|
432
|
-
'#00CC66',
|
|
433
|
-
'#00CC99',
|
|
434
|
-
'#00CCCC',
|
|
435
|
-
'#00CCFF',
|
|
436
|
-
'#3300CC',
|
|
437
|
-
'#3300FF',
|
|
438
|
-
'#3333CC',
|
|
439
|
-
'#3333FF',
|
|
440
|
-
'#3366CC',
|
|
441
|
-
'#3366FF',
|
|
442
|
-
'#3399CC',
|
|
443
|
-
'#3399FF',
|
|
444
|
-
'#33CC00',
|
|
445
|
-
'#33CC33',
|
|
446
|
-
'#33CC66',
|
|
447
|
-
'#33CC99',
|
|
448
|
-
'#33CCCC',
|
|
449
|
-
'#33CCFF',
|
|
450
|
-
'#6600CC',
|
|
451
|
-
'#6600FF',
|
|
452
|
-
'#6633CC',
|
|
453
|
-
'#6633FF',
|
|
454
|
-
'#66CC00',
|
|
455
|
-
'#66CC33',
|
|
456
|
-
'#9900CC',
|
|
457
|
-
'#9900FF',
|
|
458
|
-
'#9933CC',
|
|
459
|
-
'#9933FF',
|
|
460
|
-
'#99CC00',
|
|
461
|
-
'#99CC33',
|
|
462
|
-
'#CC0000',
|
|
463
|
-
'#CC0033',
|
|
464
|
-
'#CC0066',
|
|
465
|
-
'#CC0099',
|
|
466
|
-
'#CC00CC',
|
|
467
|
-
'#CC00FF',
|
|
468
|
-
'#CC3300',
|
|
469
|
-
'#CC3333',
|
|
470
|
-
'#CC3366',
|
|
471
|
-
'#CC3399',
|
|
472
|
-
'#CC33CC',
|
|
473
|
-
'#CC33FF',
|
|
474
|
-
'#CC6600',
|
|
475
|
-
'#CC6633',
|
|
476
|
-
'#CC9900',
|
|
477
|
-
'#CC9933',
|
|
478
|
-
'#CCCC00',
|
|
479
|
-
'#CCCC33',
|
|
480
|
-
'#FF0000',
|
|
481
|
-
'#FF0033',
|
|
482
|
-
'#FF0066',
|
|
483
|
-
'#FF0099',
|
|
484
|
-
'#FF00CC',
|
|
485
|
-
'#FF00FF',
|
|
486
|
-
'#FF3300',
|
|
487
|
-
'#FF3333',
|
|
488
|
-
'#FF3366',
|
|
489
|
-
'#FF3399',
|
|
490
|
-
'#FF33CC',
|
|
491
|
-
'#FF33FF',
|
|
492
|
-
'#FF6600',
|
|
493
|
-
'#FF6633',
|
|
494
|
-
'#FF9900',
|
|
495
|
-
'#FF9933',
|
|
496
|
-
'#FFCC00',
|
|
497
|
-
'#FFCC33'
|
|
498
|
-
], exports.log = console.debug || console.log || (()=>{}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
|
|
499
|
-
let { formatters } = module.exports;
|
|
500
|
-
formatters.j = function(v) {
|
|
501
|
-
try {
|
|
502
|
-
return JSON.stringify(v);
|
|
503
|
-
} catch (error) {
|
|
504
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
},
|
|
508
|
-
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
509
|
-
module.exports = function setup(env) {
|
|
510
|
-
function selectColor(namespace) {
|
|
511
|
-
let hash = 0;
|
|
512
|
-
for(let i = 0; i < namespace.length; i++)hash = (hash << 5) - hash + namespace.charCodeAt(i) | 0;
|
|
513
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
514
|
-
}
|
|
515
|
-
function createDebug(namespace) {
|
|
516
|
-
let prevTime, namespacesCache, enabledCache, enableOverride = null;
|
|
517
|
-
function debug(...args) {
|
|
518
|
-
if (!debug.enabled) return;
|
|
519
|
-
let self = debug, curr = Number(new Date());
|
|
520
|
-
self.diff = curr - (prevTime || curr), self.prev = prevTime, self.curr = curr, prevTime = curr, args[0] = createDebug.coerce(args[0]), 'string' != typeof args[0] && args.unshift('%O');
|
|
521
|
-
let index = 0;
|
|
522
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format)=>{
|
|
523
|
-
if ('%%' === match) return '%';
|
|
524
|
-
index++;
|
|
525
|
-
let formatter = createDebug.formatters[format];
|
|
526
|
-
if ('function' == typeof formatter) {
|
|
527
|
-
let val = args[index];
|
|
528
|
-
match = formatter.call(self, val), args.splice(index, 1), index--;
|
|
529
|
-
}
|
|
530
|
-
return match;
|
|
531
|
-
}), createDebug.formatArgs.call(self, args), (self.log || createDebug.log).apply(self, args);
|
|
532
|
-
}
|
|
533
|
-
return debug.namespace = namespace, debug.useColors = createDebug.useColors(), debug.color = createDebug.selectColor(namespace), debug.extend = extend, debug.destroy = createDebug.destroy, Object.defineProperty(debug, 'enabled', {
|
|
534
|
-
enumerable: !0,
|
|
535
|
-
configurable: !1,
|
|
536
|
-
get: ()=>null !== enableOverride ? enableOverride : (namespacesCache !== createDebug.namespaces && (namespacesCache = createDebug.namespaces, enabledCache = createDebug.enabled(namespace)), enabledCache),
|
|
537
|
-
set: (v)=>{
|
|
538
|
-
enableOverride = v;
|
|
539
|
-
}
|
|
540
|
-
}), 'function' == typeof createDebug.init && createDebug.init(debug), debug;
|
|
541
|
-
}
|
|
542
|
-
function extend(namespace, delimiter) {
|
|
543
|
-
let newDebug = createDebug(this.namespace + (void 0 === delimiter ? ':' : delimiter) + namespace);
|
|
544
|
-
return newDebug.log = this.log, newDebug;
|
|
545
|
-
}
|
|
546
|
-
function enable(namespaces) {
|
|
547
|
-
for (let ns of (createDebug.save(namespaces), createDebug.namespaces = namespaces, createDebug.names = [], createDebug.skips = [], ('string' == typeof namespaces ? namespaces : '').trim().replace(/\s+/g, ',').split(',').filter(Boolean)))'-' === ns[0] ? createDebug.skips.push(ns.slice(1)) : createDebug.names.push(ns);
|
|
548
|
-
}
|
|
549
|
-
function matchesTemplate(search, template) {
|
|
550
|
-
let searchIndex = 0, templateIndex = 0, starIndex = -1, matchIndex = 0;
|
|
551
|
-
for(; searchIndex < search.length;)if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || '*' === template[templateIndex])) '*' === template[templateIndex] ? (starIndex = templateIndex, matchIndex = searchIndex) : searchIndex++, templateIndex++;
|
|
552
|
-
else {
|
|
553
|
-
if (-1 === starIndex) return !1;
|
|
554
|
-
templateIndex = starIndex + 1, searchIndex = ++matchIndex;
|
|
555
|
-
}
|
|
556
|
-
for(; templateIndex < template.length && '*' === template[templateIndex];)templateIndex++;
|
|
557
|
-
return templateIndex === template.length;
|
|
558
|
-
}
|
|
559
|
-
function disable() {
|
|
560
|
-
let namespaces = [
|
|
561
|
-
...createDebug.names,
|
|
562
|
-
...createDebug.skips.map((namespace)=>'-' + namespace)
|
|
563
|
-
].join(',');
|
|
564
|
-
return createDebug.enable(''), namespaces;
|
|
565
|
-
}
|
|
566
|
-
function enabled(name) {
|
|
567
|
-
for (let skip of createDebug.skips)if (matchesTemplate(name, skip)) return !1;
|
|
568
|
-
for (let ns of createDebug.names)if (matchesTemplate(name, ns)) return !0;
|
|
569
|
-
return !1;
|
|
570
|
-
}
|
|
571
|
-
function coerce(val) {
|
|
572
|
-
return val instanceof Error ? val.stack || val.message : val;
|
|
573
|
-
}
|
|
574
|
-
function destroy() {
|
|
575
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
576
|
-
}
|
|
577
|
-
return createDebug.debug = createDebug, createDebug.default = createDebug, createDebug.coerce = coerce, createDebug.disable = disable, createDebug.enable = enable, createDebug.enabled = enabled, createDebug.humanize = __webpack_require__("../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"), createDebug.destroy = destroy, Object.keys(env).forEach((key)=>{
|
|
578
|
-
createDebug[key] = env[key];
|
|
579
|
-
}), createDebug.names = [], createDebug.skips = [], createDebug.formatters = {}, createDebug.selectColor = selectColor, createDebug.enable(createDebug.load()), createDebug;
|
|
580
|
-
};
|
|
581
|
-
},
|
|
582
|
-
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
583
|
-
"u" < typeof process || 'renderer' === process.type || !0 === process.browser || process.__nwjs ? module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js") : module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js");
|
|
584
|
-
},
|
|
585
|
-
"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js" (module, exports, __webpack_require__) {
|
|
586
|
-
let tty = __webpack_require__("tty"), util = __webpack_require__("util");
|
|
587
|
-
exports.init = init, exports.log = log, exports.formatArgs = formatArgs, exports.save = save, exports.load = load, exports.useColors = useColors, exports.destroy = util.deprecate(()=>{}, 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'), exports.colors = [
|
|
588
|
-
6,
|
|
589
|
-
2,
|
|
590
|
-
3,
|
|
591
|
-
4,
|
|
592
|
-
5,
|
|
593
|
-
1
|
|
594
|
-
];
|
|
595
|
-
try {
|
|
596
|
-
let supportsColor = __webpack_require__("supports-color");
|
|
597
|
-
supportsColor && (supportsColor.stderr || supportsColor).level >= 2 && (exports.colors = [
|
|
598
|
-
20,
|
|
599
|
-
21,
|
|
600
|
-
26,
|
|
601
|
-
27,
|
|
602
|
-
32,
|
|
603
|
-
33,
|
|
604
|
-
38,
|
|
605
|
-
39,
|
|
606
|
-
40,
|
|
607
|
-
41,
|
|
608
|
-
42,
|
|
609
|
-
43,
|
|
610
|
-
44,
|
|
611
|
-
45,
|
|
612
|
-
56,
|
|
613
|
-
57,
|
|
614
|
-
62,
|
|
615
|
-
63,
|
|
616
|
-
68,
|
|
617
|
-
69,
|
|
618
|
-
74,
|
|
619
|
-
75,
|
|
620
|
-
76,
|
|
621
|
-
77,
|
|
622
|
-
78,
|
|
623
|
-
79,
|
|
624
|
-
80,
|
|
625
|
-
81,
|
|
626
|
-
92,
|
|
627
|
-
93,
|
|
628
|
-
98,
|
|
629
|
-
99,
|
|
630
|
-
112,
|
|
631
|
-
113,
|
|
632
|
-
128,
|
|
633
|
-
129,
|
|
634
|
-
134,
|
|
635
|
-
135,
|
|
636
|
-
148,
|
|
637
|
-
149,
|
|
638
|
-
160,
|
|
639
|
-
161,
|
|
640
|
-
162,
|
|
641
|
-
163,
|
|
642
|
-
164,
|
|
643
|
-
165,
|
|
644
|
-
166,
|
|
645
|
-
167,
|
|
646
|
-
168,
|
|
647
|
-
169,
|
|
648
|
-
170,
|
|
649
|
-
171,
|
|
650
|
-
172,
|
|
651
|
-
173,
|
|
652
|
-
178,
|
|
653
|
-
179,
|
|
654
|
-
184,
|
|
655
|
-
185,
|
|
656
|
-
196,
|
|
657
|
-
197,
|
|
658
|
-
198,
|
|
659
|
-
199,
|
|
660
|
-
200,
|
|
661
|
-
201,
|
|
662
|
-
202,
|
|
663
|
-
203,
|
|
664
|
-
204,
|
|
665
|
-
205,
|
|
666
|
-
206,
|
|
667
|
-
207,
|
|
668
|
-
208,
|
|
669
|
-
209,
|
|
670
|
-
214,
|
|
671
|
-
215,
|
|
672
|
-
220,
|
|
673
|
-
221
|
|
674
|
-
]);
|
|
675
|
-
} catch (error) {}
|
|
676
|
-
function useColors() {
|
|
677
|
-
return 'colors' in exports.inspectOpts ? !!exports.inspectOpts.colors : tty.isatty(process.stderr.fd);
|
|
678
|
-
}
|
|
679
|
-
function formatArgs(args) {
|
|
680
|
-
let { namespace: name, useColors } = this;
|
|
681
|
-
if (useColors) {
|
|
682
|
-
let c = this.color, colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c), prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
683
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix), args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
684
|
-
} else args[0] = getDate() + name + ' ' + args[0];
|
|
685
|
-
}
|
|
686
|
-
function getDate() {
|
|
687
|
-
return exports.inspectOpts.hideDate ? '' : new Date().toISOString() + ' ';
|
|
688
|
-
}
|
|
689
|
-
function log(...args) {
|
|
690
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
|
691
|
-
}
|
|
692
|
-
function save(namespaces) {
|
|
693
|
-
namespaces ? process.env.DEBUG = namespaces : delete process.env.DEBUG;
|
|
694
|
-
}
|
|
695
|
-
function load() {
|
|
696
|
-
return process.env.DEBUG;
|
|
697
|
-
}
|
|
698
|
-
function init(debug) {
|
|
699
|
-
debug.inspectOpts = {};
|
|
700
|
-
let keys = Object.keys(exports.inspectOpts);
|
|
701
|
-
for(let i = 0; i < keys.length; i++)debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
702
|
-
}
|
|
703
|
-
exports.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{
|
|
704
|
-
let prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase()), val = process.env[key];
|
|
705
|
-
return val = !!/^(yes|on|true|enabled)$/i.test(val) || !/^(no|off|false|disabled)$/i.test(val) && ('null' === val ? null : Number(val)), obj[prop] = val, obj;
|
|
706
|
-
}, {}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
|
|
707
|
-
let { formatters } = module.exports;
|
|
708
|
-
formatters.o = function(v) {
|
|
709
|
-
return this.inspectOpts.colors = this.useColors, util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' ');
|
|
710
|
-
}, formatters.O = function(v) {
|
|
711
|
-
return this.inspectOpts.colors = this.useColors, util.inspect(v, this.inspectOpts);
|
|
712
|
-
};
|
|
713
|
-
},
|
|
714
|
-
"../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
715
|
-
let util = __webpack_require__("util"), toRegexRange = __webpack_require__("../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js"), isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val), isValidValue = (value)=>'number' == typeof value || 'string' == typeof value && '' !== value, zeros = (input)=>{
|
|
716
|
-
let value = `${input}`, index = -1;
|
|
717
|
-
if ('-' === value[0] && (value = value.slice(1)), '0' === value) return !1;
|
|
718
|
-
for(; '0' === value[++index];);
|
|
719
|
-
return index > 0;
|
|
720
|
-
}, pad = (input, maxLength, toNumber)=>{
|
|
721
|
-
if (maxLength > 0) {
|
|
722
|
-
let dash = '-' === input[0] ? '-' : '';
|
|
723
|
-
dash && (input = input.slice(1)), input = dash + input.padStart(dash ? maxLength - 1 : maxLength, '0');
|
|
724
|
-
}
|
|
725
|
-
return !1 === toNumber ? String(input) : input;
|
|
726
|
-
}, toMaxLen = (input, maxLength)=>{
|
|
727
|
-
let negative = '-' === input[0] ? '-' : '';
|
|
728
|
-
for(negative && (input = input.slice(1), maxLength--); input.length < maxLength;)input = '0' + input;
|
|
729
|
-
return negative ? '-' + input : input;
|
|
730
|
-
}, toRange = (a, b, isNumbers, options)=>{
|
|
731
|
-
if (isNumbers) return toRegexRange(a, b, {
|
|
732
|
-
wrap: !1,
|
|
733
|
-
...options
|
|
734
|
-
});
|
|
735
|
-
let start = String.fromCharCode(a);
|
|
736
|
-
if (a === b) return start;
|
|
737
|
-
let stop = String.fromCharCode(b);
|
|
738
|
-
return `[${start}-${stop}]`;
|
|
739
|
-
}, toRegex = (start, end, options)=>{
|
|
740
|
-
if (Array.isArray(start)) {
|
|
741
|
-
let wrap = !0 === options.wrap, prefix = options.capture ? '' : '?:';
|
|
742
|
-
return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
|
|
743
|
-
}
|
|
744
|
-
return toRegexRange(start, end, options);
|
|
745
|
-
}, rangeError = (...args)=>RangeError('Invalid range arguments: ' + util.inspect(...args)), invalidRange = (start, end, options)=>{
|
|
746
|
-
if (!0 === options.strictRanges) throw rangeError([
|
|
747
|
-
start,
|
|
748
|
-
end
|
|
749
|
-
]);
|
|
750
|
-
return [];
|
|
751
|
-
}, fill = (start, end, step, options = {})=>{
|
|
752
|
-
if (null == end && isValidValue(start)) return [
|
|
753
|
-
start
|
|
754
|
-
];
|
|
755
|
-
if (!isValidValue(start) || !isValidValue(end)) return invalidRange(start, end, options);
|
|
756
|
-
if ('function' == typeof step) return fill(start, end, 1, {
|
|
757
|
-
transform: step
|
|
758
|
-
});
|
|
759
|
-
if (isObject(step)) return fill(start, end, 0, step);
|
|
760
|
-
let opts = {
|
|
761
|
-
...options
|
|
762
|
-
};
|
|
763
|
-
if (!0 === opts.capture && (opts.wrap = !0), !Number.isInteger(+(step = step || opts.step || 1))) {
|
|
764
|
-
if (null != step && !isObject(step)) {
|
|
765
|
-
var step1 = step;
|
|
766
|
-
if (!0 === opts.strictRanges) throw TypeError(`Expected step "${step1}" to be a number`);
|
|
767
|
-
return [];
|
|
768
|
-
}
|
|
769
|
-
return fill(start, end, 1, step);
|
|
770
|
-
}
|
|
771
|
-
return Number.isInteger(+start) && Number.isInteger(+end) ? ((start, end, step = 1, options = {})=>{
|
|
772
|
-
let a = Number(start), b = Number(end);
|
|
773
|
-
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
774
|
-
if (!0 === options.strictRanges) throw rangeError([
|
|
775
|
-
start,
|
|
776
|
-
end
|
|
777
|
-
]);
|
|
778
|
-
return [];
|
|
779
|
-
}
|
|
780
|
-
0 === a && (a = 0), 0 === b && (b = 0);
|
|
781
|
-
let descending = a > b, startString = String(start), endString = String(end), stepString = String(step);
|
|
782
|
-
step = Math.max(Math.abs(step), 1);
|
|
783
|
-
let padded = zeros(startString) || zeros(endString) || zeros(stepString), maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0, toNumber = !1 === padded && !1 == ('string' == typeof start || 'string' == typeof end || !0 === options.stringify), format = options.transform || ((value)=>!0 === toNumber ? Number(value) : String(value));
|
|
784
|
-
if (options.toRegex && 1 === step) return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), !0, options);
|
|
785
|
-
let parts = {
|
|
786
|
-
negatives: [],
|
|
787
|
-
positives: []
|
|
788
|
-
}, push = (num)=>parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)), range = [], index = 0;
|
|
789
|
-
for(; descending ? a >= b : a <= b;)!0 === options.toRegex && step > 1 ? push(a) : range.push(pad(format(a, index), maxLen, toNumber)), a = descending ? a - step : a + step, index++;
|
|
790
|
-
if (!0 === options.toRegex) {
|
|
791
|
-
let result, prefix, positives, negatives;
|
|
792
|
-
return step > 1 ? (parts.negatives.sort((a, b)=>a < b ? -1 : +(a > b)), parts.positives.sort((a, b)=>a < b ? -1 : +(a > b)), prefix = options.capture ? '' : '?:', positives = '', negatives = '', (parts.positives.length && (positives = parts.positives.map((v)=>toMaxLen(String(v), maxLen)).join('|')), parts.negatives.length && (negatives = `-(${prefix}${parts.negatives.map((v)=>toMaxLen(String(v), maxLen)).join('|')})`), result = positives && negatives ? `${positives}|${negatives}` : positives || negatives, options.wrap) ? `(${prefix}${result})` : result) : toRegex(range, null, {
|
|
793
|
-
wrap: !1,
|
|
794
|
-
...options
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
return range;
|
|
798
|
-
})(start, end, step, opts) : ((start, end, step = 1, options = {})=>{
|
|
799
|
-
if (!Number.isInteger(+start) && start.length > 1 || !Number.isInteger(+end) && end.length > 1) return invalidRange(start, end, options);
|
|
800
|
-
let format = options.transform || ((val)=>String.fromCharCode(val)), a = `${start}`.charCodeAt(0), b = `${end}`.charCodeAt(0), descending = a > b, min = Math.min(a, b), max = Math.max(a, b);
|
|
801
|
-
if (options.toRegex && 1 === step) return toRange(min, max, !1, options);
|
|
802
|
-
let range = [], index = 0;
|
|
803
|
-
for(; descending ? a >= b : a <= b;)range.push(format(a, index)), a = descending ? a - step : a + step, index++;
|
|
804
|
-
return !0 === options.toRegex ? toRegex(range, null, {
|
|
805
|
-
wrap: !1,
|
|
806
|
-
options
|
|
807
|
-
}) : range;
|
|
808
|
-
})(start, end, Math.max(Math.abs(step), 1), opts);
|
|
809
|
-
};
|
|
810
|
-
module.exports = fill;
|
|
811
|
-
},
|
|
812
|
-
"../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js" (module) {
|
|
813
|
-
module.exports = function isExtglob(str) {
|
|
814
|
-
var match;
|
|
815
|
-
if ('string' != typeof str || '' === str) return !1;
|
|
816
|
-
for(; match = /(\\).|([@?!+*]\(.*\))/g.exec(str);){
|
|
817
|
-
if (match[2]) return !0;
|
|
818
|
-
str = str.slice(match.index + match[0].length);
|
|
819
|
-
}
|
|
820
|
-
return !1;
|
|
821
|
-
};
|
|
822
|
-
},
|
|
823
|
-
"../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
824
|
-
var isExtglob = __webpack_require__("../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"), chars = {
|
|
825
|
-
'{': '}',
|
|
826
|
-
'(': ')',
|
|
827
|
-
'[': ']'
|
|
828
|
-
}, strictCheck = function(str) {
|
|
829
|
-
if ('!' === str[0]) return !0;
|
|
830
|
-
for(var index = 0, pipeIndex = -2, closeSquareIndex = -2, closeCurlyIndex = -2, closeParenIndex = -2, backSlashIndex = -2; index < str.length;){
|
|
831
|
-
if ('*' === str[index] || '?' === str[index + 1] && /[\].+)]/.test(str[index]) || -1 !== closeSquareIndex && '[' === str[index] && ']' !== str[index + 1] && (closeSquareIndex < index && (closeSquareIndex = str.indexOf(']', index)), closeSquareIndex > index) && (-1 === backSlashIndex || backSlashIndex > closeSquareIndex || -1 === (backSlashIndex = str.indexOf('\\', index)) || backSlashIndex > closeSquareIndex) || -1 !== closeCurlyIndex && '{' === str[index] && '}' !== str[index + 1] && (closeCurlyIndex = str.indexOf('}', index)) > index && (-1 === (backSlashIndex = str.indexOf('\\', index)) || backSlashIndex > closeCurlyIndex) || -1 !== closeParenIndex && '(' === str[index] && '?' === str[index + 1] && /[:!=]/.test(str[index + 2]) && ')' !== str[index + 3] && (closeParenIndex = str.indexOf(')', index)) > index && (-1 === (backSlashIndex = str.indexOf('\\', index)) || backSlashIndex > closeParenIndex) || -1 !== pipeIndex && '(' === str[index] && '|' !== str[index + 1] && (pipeIndex < index && (pipeIndex = str.indexOf('|', index)), -1 !== pipeIndex && ')' !== str[pipeIndex + 1] && (closeParenIndex = str.indexOf(')', pipeIndex)) > pipeIndex) && (-1 === (backSlashIndex = str.indexOf('\\', pipeIndex)) || backSlashIndex > closeParenIndex)) return !0;
|
|
832
|
-
if ('\\' === str[index]) {
|
|
833
|
-
var open = str[index + 1];
|
|
834
|
-
index += 2;
|
|
835
|
-
var close = chars[open];
|
|
836
|
-
if (close) {
|
|
837
|
-
var n = str.indexOf(close, index);
|
|
838
|
-
-1 !== n && (index = n + 1);
|
|
839
|
-
}
|
|
840
|
-
if ('!' === str[index]) return !0;
|
|
841
|
-
} else index++;
|
|
842
|
-
}
|
|
843
|
-
return !1;
|
|
844
|
-
}, relaxedCheck = function(str) {
|
|
845
|
-
if ('!' === str[0]) return !0;
|
|
846
|
-
for(var index = 0; index < str.length;){
|
|
847
|
-
if (/[*?{}()[\]]/.test(str[index])) return !0;
|
|
848
|
-
if ('\\' === str[index]) {
|
|
849
|
-
var open = str[index + 1];
|
|
850
|
-
index += 2;
|
|
851
|
-
var close = chars[open];
|
|
852
|
-
if (close) {
|
|
853
|
-
var n = str.indexOf(close, index);
|
|
854
|
-
-1 !== n && (index = n + 1);
|
|
855
|
-
}
|
|
856
|
-
if ('!' === str[index]) return !0;
|
|
857
|
-
} else index++;
|
|
858
|
-
}
|
|
859
|
-
return !1;
|
|
860
|
-
};
|
|
861
|
-
module.exports = function isGlob(str, options) {
|
|
862
|
-
if ('string' != typeof str || '' === str) return !1;
|
|
863
|
-
if (isExtglob(str)) return !0;
|
|
864
|
-
var check = strictCheck;
|
|
865
|
-
return options && !1 === options.strict && (check = relaxedCheck), check(str);
|
|
866
|
-
};
|
|
867
|
-
},
|
|
868
|
-
"../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js" (module) {
|
|
869
|
-
module.exports = function(num) {
|
|
870
|
-
return 'number' == typeof num ? num - num == 0 : 'string' == typeof num && '' !== num.trim() && (Number.isFinite ? Number.isFinite(+num) : isFinite(+num));
|
|
871
|
-
};
|
|
872
|
-
},
|
|
873
|
-
"../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
874
|
-
let util = __webpack_require__("util"), braces = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js"), picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/index.js"), utils = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"), isEmptyString = (v)=>'' === v || './' === v, hasBraces = (v)=>{
|
|
875
|
-
let index = v.indexOf('{');
|
|
876
|
-
return index > -1 && v.indexOf('}', index) > -1;
|
|
877
|
-
}, micromatch = (list, patterns, options)=>{
|
|
878
|
-
patterns = [].concat(patterns), list = [].concat(list);
|
|
879
|
-
let omit = new Set(), keep = new Set(), items = new Set(), negatives = 0, onResult = (state)=>{
|
|
880
|
-
items.add(state.output), options && options.onResult && options.onResult(state);
|
|
881
|
-
};
|
|
882
|
-
for(let i = 0; i < patterns.length; i++){
|
|
883
|
-
let isMatch = picomatch(String(patterns[i]), {
|
|
884
|
-
...options,
|
|
885
|
-
onResult
|
|
886
|
-
}, !0), negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
887
|
-
for (let item of (negated && negatives++, list)){
|
|
888
|
-
let matched = isMatch(item, !0);
|
|
889
|
-
(negated ? !matched.isMatch : matched.isMatch) && (negated ? omit.add(matched.output) : (omit.delete(matched.output), keep.add(matched.output)));
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
let matches = (negatives === patterns.length ? [
|
|
893
|
-
...items
|
|
894
|
-
] : [
|
|
895
|
-
...keep
|
|
896
|
-
]).filter((item)=>!omit.has(item));
|
|
897
|
-
if (options && 0 === matches.length) {
|
|
898
|
-
if (!0 === options.failglob) throw Error(`No matches found for "${patterns.join(', ')}"`);
|
|
899
|
-
if (!0 === options.nonull || !0 === options.nullglob) return options.unescape ? patterns.map((p)=>p.replace(/\\/g, '')) : patterns;
|
|
900
|
-
}
|
|
901
|
-
return matches;
|
|
902
|
-
};
|
|
903
|
-
micromatch.match = micromatch, micromatch.matcher = (pattern, options)=>picomatch(pattern, options), micromatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str), micromatch.any = micromatch.isMatch, micromatch.not = (list, patterns, options = {})=>{
|
|
904
|
-
patterns = [].concat(patterns).map(String);
|
|
905
|
-
let result = new Set(), items = [], matches = new Set(micromatch(list, patterns, {
|
|
906
|
-
...options,
|
|
907
|
-
onResult: (state)=>{
|
|
908
|
-
options.onResult && options.onResult(state), items.push(state.output);
|
|
909
|
-
}
|
|
910
|
-
}));
|
|
911
|
-
for (let item of items)matches.has(item) || result.add(item);
|
|
912
|
-
return [
|
|
913
|
-
...result
|
|
914
|
-
];
|
|
915
|
-
}, micromatch.contains = (str, pattern, options)=>{
|
|
916
|
-
if ('string' != typeof str) throw TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
917
|
-
if (Array.isArray(pattern)) return pattern.some((p)=>micromatch.contains(str, p, options));
|
|
918
|
-
if ('string' == typeof pattern) {
|
|
919
|
-
if (isEmptyString(str) || isEmptyString(pattern)) return !1;
|
|
920
|
-
if (str.includes(pattern) || str.startsWith('./') && str.slice(2).includes(pattern)) return !0;
|
|
921
|
-
}
|
|
922
|
-
return micromatch.isMatch(str, pattern, {
|
|
923
|
-
...options,
|
|
924
|
-
contains: !0
|
|
925
|
-
});
|
|
926
|
-
}, micromatch.matchKeys = (obj, patterns, options)=>{
|
|
927
|
-
if (!utils.isObject(obj)) throw TypeError('Expected the first argument to be an object');
|
|
928
|
-
let keys = micromatch(Object.keys(obj), patterns, options), res = {};
|
|
929
|
-
for (let key of keys)res[key] = obj[key];
|
|
930
|
-
return res;
|
|
931
|
-
}, micromatch.some = (list, patterns, options)=>{
|
|
932
|
-
let items = [].concat(list);
|
|
933
|
-
for (let pattern of [].concat(patterns)){
|
|
934
|
-
let isMatch = picomatch(String(pattern), options);
|
|
935
|
-
if (items.some((item)=>isMatch(item))) return !0;
|
|
936
|
-
}
|
|
937
|
-
return !1;
|
|
938
|
-
}, micromatch.every = (list, patterns, options)=>{
|
|
939
|
-
let items = [].concat(list);
|
|
940
|
-
for (let pattern of [].concat(patterns)){
|
|
941
|
-
let isMatch = picomatch(String(pattern), options);
|
|
942
|
-
if (!items.every((item)=>isMatch(item))) return !1;
|
|
943
|
-
}
|
|
944
|
-
return !0;
|
|
945
|
-
}, micromatch.all = (str, patterns, options)=>{
|
|
946
|
-
if ('string' != typeof str) throw TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
947
|
-
return [].concat(patterns).every((p)=>picomatch(p, options)(str));
|
|
948
|
-
}, micromatch.capture = (glob, input, options)=>{
|
|
949
|
-
let posix = utils.isWindows(options), match = picomatch.makeRe(String(glob), {
|
|
950
|
-
...options,
|
|
951
|
-
capture: !0
|
|
952
|
-
}).exec(posix ? utils.toPosixSlashes(input) : input);
|
|
953
|
-
if (match) return match.slice(1).map((v)=>void 0 === v ? '' : v);
|
|
954
|
-
}, micromatch.makeRe = (...args)=>picomatch.makeRe(...args), micromatch.scan = (...args)=>picomatch.scan(...args), micromatch.parse = (patterns, options)=>{
|
|
955
|
-
let res = [];
|
|
956
|
-
for (let pattern of [].concat(patterns || []))for (let str of braces(String(pattern), options))res.push(picomatch.parse(str, options));
|
|
957
|
-
return res;
|
|
958
|
-
}, micromatch.braces = (pattern, options)=>{
|
|
959
|
-
if ('string' != typeof pattern) throw TypeError('Expected a string');
|
|
960
|
-
return options && !0 === options.nobrace || !hasBraces(pattern) ? [
|
|
961
|
-
pattern
|
|
962
|
-
] : braces(pattern, options);
|
|
963
|
-
}, micromatch.braceExpand = (pattern, options)=>{
|
|
964
|
-
if ('string' != typeof pattern) throw TypeError('Expected a string');
|
|
965
|
-
return micromatch.braces(pattern, {
|
|
966
|
-
...options,
|
|
967
|
-
expand: !0
|
|
968
|
-
});
|
|
969
|
-
}, micromatch.hasBraces = hasBraces, module.exports = micromatch;
|
|
970
|
-
},
|
|
971
|
-
"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js" (module) {
|
|
972
|
-
function parse(str) {
|
|
973
|
-
if (!((str = String(str)).length > 100)) {
|
|
974
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
975
|
-
if (match) {
|
|
976
|
-
var n = parseFloat(match[1]);
|
|
977
|
-
switch((match[2] || 'ms').toLowerCase()){
|
|
978
|
-
case 'years':
|
|
979
|
-
case 'year':
|
|
980
|
-
case 'yrs':
|
|
981
|
-
case 'yr':
|
|
982
|
-
case 'y':
|
|
983
|
-
return 31557600000 * n;
|
|
984
|
-
case 'weeks':
|
|
985
|
-
case 'week':
|
|
986
|
-
case 'w':
|
|
987
|
-
return 604800000 * n;
|
|
988
|
-
case 'days':
|
|
989
|
-
case 'day':
|
|
990
|
-
case 'd':
|
|
991
|
-
return 86400000 * n;
|
|
992
|
-
case 'hours':
|
|
993
|
-
case 'hour':
|
|
994
|
-
case 'hrs':
|
|
995
|
-
case 'hr':
|
|
996
|
-
case 'h':
|
|
997
|
-
return 3600000 * n;
|
|
998
|
-
case 'minutes':
|
|
999
|
-
case 'minute':
|
|
1000
|
-
case 'mins':
|
|
1001
|
-
case 'min':
|
|
1002
|
-
case 'm':
|
|
1003
|
-
return 60000 * n;
|
|
1004
|
-
case 'seconds':
|
|
1005
|
-
case 'second':
|
|
1006
|
-
case 'secs':
|
|
1007
|
-
case 'sec':
|
|
1008
|
-
case 's':
|
|
1009
|
-
return 1000 * n;
|
|
1010
|
-
case 'milliseconds':
|
|
1011
|
-
case 'millisecond':
|
|
1012
|
-
case 'msecs':
|
|
1013
|
-
case 'msec':
|
|
1014
|
-
case 'ms':
|
|
1015
|
-
return n;
|
|
1016
|
-
default:
|
|
1017
|
-
return;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
function fmtShort(ms) {
|
|
1023
|
-
var msAbs = Math.abs(ms);
|
|
1024
|
-
return msAbs >= 86400000 ? Math.round(ms / 86400000) + 'd' : msAbs >= 3600000 ? Math.round(ms / 3600000) + 'h' : msAbs >= 60000 ? Math.round(ms / 60000) + 'm' : msAbs >= 1000 ? Math.round(ms / 1000) + 's' : ms + 'ms';
|
|
1025
|
-
}
|
|
1026
|
-
function fmtLong(ms) {
|
|
1027
|
-
var msAbs = Math.abs(ms);
|
|
1028
|
-
return msAbs >= 86400000 ? plural(ms, msAbs, 86400000, 'day') : msAbs >= 3600000 ? plural(ms, msAbs, 3600000, 'hour') : msAbs >= 60000 ? plural(ms, msAbs, 60000, 'minute') : msAbs >= 1000 ? plural(ms, msAbs, 1000, 'second') : ms + ' ms';
|
|
1029
|
-
}
|
|
1030
|
-
function plural(ms, msAbs, n, name) {
|
|
1031
|
-
return Math.round(ms / n) + ' ' + name + (msAbs >= 1.5 * n ? 's' : '');
|
|
1032
|
-
}
|
|
1033
|
-
module.exports = function(val, options) {
|
|
1034
|
-
options = options || {};
|
|
1035
|
-
var type = typeof val;
|
|
1036
|
-
if ('string' === type && val.length > 0) return parse(val);
|
|
1037
|
-
if ('number' === type && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
|
|
1038
|
-
throw Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
1039
|
-
};
|
|
1040
|
-
},
|
|
1041
|
-
"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1042
|
-
module.exports = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js");
|
|
1043
|
-
},
|
|
1044
|
-
"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1045
|
-
let path = __webpack_require__("path?aeb1"), WIN_NO_SLASH = "[^\\\\/]", QMARK = '[^/]', END_ANCHOR = "(?:\\/|$)", START_ANCHOR = "(?:^|\\/)", DOTS_SLASH = `\\.{1,2}${END_ANCHOR}`, NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`, NO_DOT_SLASH = `(?!\\.{0,1}${END_ANCHOR})`, NO_DOTS_SLASH = `(?!${DOTS_SLASH})`, STAR = `${QMARK}*?`, POSIX_CHARS = {
|
|
1046
|
-
DOT_LITERAL: '\\.',
|
|
1047
|
-
PLUS_LITERAL: '\\+',
|
|
1048
|
-
QMARK_LITERAL: '\\?',
|
|
1049
|
-
SLASH_LITERAL: '\\/',
|
|
1050
|
-
ONE_CHAR: '(?=.)',
|
|
1051
|
-
QMARK,
|
|
1052
|
-
END_ANCHOR,
|
|
1053
|
-
DOTS_SLASH,
|
|
1054
|
-
NO_DOT: "(?!\\.)",
|
|
1055
|
-
NO_DOTS,
|
|
1056
|
-
NO_DOT_SLASH,
|
|
1057
|
-
NO_DOTS_SLASH,
|
|
1058
|
-
QMARK_NO_DOT: "[^.\\/]",
|
|
1059
|
-
STAR,
|
|
1060
|
-
START_ANCHOR
|
|
1061
|
-
}, WINDOWS_CHARS = {
|
|
1062
|
-
...POSIX_CHARS,
|
|
1063
|
-
SLASH_LITERAL: "[\\\\/]",
|
|
1064
|
-
QMARK: WIN_NO_SLASH,
|
|
1065
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
1066
|
-
DOTS_SLASH: "\\.{1,2}(?:[\\\\/]|$)",
|
|
1067
|
-
NO_DOT: "(?!\\.)",
|
|
1068
|
-
NO_DOTS: "(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",
|
|
1069
|
-
NO_DOT_SLASH: "(?!\\.{0,1}(?:[\\\\/]|$))",
|
|
1070
|
-
NO_DOTS_SLASH: "(?!\\.{1,2}(?:[\\\\/]|$))",
|
|
1071
|
-
QMARK_NO_DOT: "[^.\\\\/]",
|
|
1072
|
-
START_ANCHOR: "(?:^|[\\\\/])",
|
|
1073
|
-
END_ANCHOR: "(?:[\\\\/]|$)"
|
|
1074
|
-
};
|
|
1075
|
-
module.exports = {
|
|
1076
|
-
DEFAULT_MAX_EXTGLOB_RECURSION: 0,
|
|
1077
|
-
MAX_LENGTH: 65536,
|
|
1078
|
-
POSIX_REGEX_SOURCE: {
|
|
1079
|
-
__proto__: null,
|
|
1080
|
-
alnum: 'a-zA-Z0-9',
|
|
1081
|
-
alpha: 'a-zA-Z',
|
|
1082
|
-
ascii: '\\x00-\\x7F',
|
|
1083
|
-
blank: ' \\t',
|
|
1084
|
-
cntrl: '\\x00-\\x1F\\x7F',
|
|
1085
|
-
digit: '0-9',
|
|
1086
|
-
graph: '\\x21-\\x7E',
|
|
1087
|
-
lower: 'a-z',
|
|
1088
|
-
print: '\\x20-\\x7E ',
|
|
1089
|
-
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
1090
|
-
space: ' \\t\\r\\n\\v\\f',
|
|
1091
|
-
upper: 'A-Z',
|
|
1092
|
-
word: 'A-Za-z0-9_',
|
|
1093
|
-
xdigit: 'A-Fa-f0-9'
|
|
1094
|
-
},
|
|
1095
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
1096
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
1097
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
1098
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
1099
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
1100
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
1101
|
-
REPLACEMENTS: {
|
|
1102
|
-
__proto__: null,
|
|
1103
|
-
'***': '*',
|
|
1104
|
-
'**/**': '**',
|
|
1105
|
-
'**/**/**': '**'
|
|
1106
|
-
},
|
|
1107
|
-
CHAR_0: 48,
|
|
1108
|
-
CHAR_9: 57,
|
|
1109
|
-
CHAR_UPPERCASE_A: 65,
|
|
1110
|
-
CHAR_LOWERCASE_A: 97,
|
|
1111
|
-
CHAR_UPPERCASE_Z: 90,
|
|
1112
|
-
CHAR_LOWERCASE_Z: 122,
|
|
1113
|
-
CHAR_LEFT_PARENTHESES: 40,
|
|
1114
|
-
CHAR_RIGHT_PARENTHESES: 41,
|
|
1115
|
-
CHAR_ASTERISK: 42,
|
|
1116
|
-
CHAR_AMPERSAND: 38,
|
|
1117
|
-
CHAR_AT: 64,
|
|
1118
|
-
CHAR_BACKWARD_SLASH: 92,
|
|
1119
|
-
CHAR_CARRIAGE_RETURN: 13,
|
|
1120
|
-
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
1121
|
-
CHAR_COLON: 58,
|
|
1122
|
-
CHAR_COMMA: 44,
|
|
1123
|
-
CHAR_DOT: 46,
|
|
1124
|
-
CHAR_DOUBLE_QUOTE: 34,
|
|
1125
|
-
CHAR_EQUAL: 61,
|
|
1126
|
-
CHAR_EXCLAMATION_MARK: 33,
|
|
1127
|
-
CHAR_FORM_FEED: 12,
|
|
1128
|
-
CHAR_FORWARD_SLASH: 47,
|
|
1129
|
-
CHAR_GRAVE_ACCENT: 96,
|
|
1130
|
-
CHAR_HASH: 35,
|
|
1131
|
-
CHAR_HYPHEN_MINUS: 45,
|
|
1132
|
-
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
1133
|
-
CHAR_LEFT_CURLY_BRACE: 123,
|
|
1134
|
-
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
1135
|
-
CHAR_LINE_FEED: 10,
|
|
1136
|
-
CHAR_NO_BREAK_SPACE: 160,
|
|
1137
|
-
CHAR_PERCENT: 37,
|
|
1138
|
-
CHAR_PLUS: 43,
|
|
1139
|
-
CHAR_QUESTION_MARK: 63,
|
|
1140
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
1141
|
-
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
1142
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
1143
|
-
CHAR_SEMICOLON: 59,
|
|
1144
|
-
CHAR_SINGLE_QUOTE: 39,
|
|
1145
|
-
CHAR_SPACE: 32,
|
|
1146
|
-
CHAR_TAB: 9,
|
|
1147
|
-
CHAR_UNDERSCORE: 95,
|
|
1148
|
-
CHAR_VERTICAL_LINE: 124,
|
|
1149
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1150
|
-
SEP: path.sep,
|
|
1151
|
-
extglobChars: (chars)=>({
|
|
1152
|
-
'!': {
|
|
1153
|
-
type: 'negate',
|
|
1154
|
-
open: '(?:(?!(?:',
|
|
1155
|
-
close: `))${chars.STAR})`
|
|
1156
|
-
},
|
|
1157
|
-
'?': {
|
|
1158
|
-
type: 'qmark',
|
|
1159
|
-
open: '(?:',
|
|
1160
|
-
close: ')?'
|
|
1161
|
-
},
|
|
1162
|
-
'+': {
|
|
1163
|
-
type: 'plus',
|
|
1164
|
-
open: '(?:',
|
|
1165
|
-
close: ')+'
|
|
1166
|
-
},
|
|
1167
|
-
'*': {
|
|
1168
|
-
type: 'star',
|
|
1169
|
-
open: '(?:',
|
|
1170
|
-
close: ')*'
|
|
1171
|
-
},
|
|
1172
|
-
'@': {
|
|
1173
|
-
type: 'at',
|
|
1174
|
-
open: '(?:',
|
|
1175
|
-
close: ')'
|
|
1176
|
-
}
|
|
1177
|
-
}),
|
|
1178
|
-
globChars: (win32)=>!0 === win32 ? WINDOWS_CHARS : POSIX_CHARS
|
|
1179
|
-
};
|
|
1180
|
-
},
|
|
1181
|
-
"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1182
|
-
let constants = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"), utils = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"), { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants, expandRange = (args, options)=>{
|
|
1183
|
-
if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
|
|
1184
|
-
args.sort();
|
|
1185
|
-
let value = `[${args.join('-')}]`;
|
|
1186
|
-
try {
|
|
1187
|
-
new RegExp(value);
|
|
1188
|
-
} catch (ex) {
|
|
1189
|
-
return args.map((v)=>utils.escapeRegex(v)).join('..');
|
|
1190
|
-
}
|
|
1191
|
-
return value;
|
|
1192
|
-
}, syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`, splitTopLevel = (input)=>{
|
|
1193
|
-
let parts = [], bracket = 0, paren = 0, quote = 0, value = '', escaped = !1;
|
|
1194
|
-
for (let ch of input){
|
|
1195
|
-
if (!0 === escaped) {
|
|
1196
|
-
value += ch, escaped = !1;
|
|
1197
|
-
continue;
|
|
1198
|
-
}
|
|
1199
|
-
if ('\\' === ch) {
|
|
1200
|
-
value += ch, escaped = !0;
|
|
1201
|
-
continue;
|
|
1202
|
-
}
|
|
1203
|
-
if ('"' === ch) {
|
|
1204
|
-
quote = +(1 !== quote), value += ch;
|
|
1205
|
-
continue;
|
|
1206
|
-
}
|
|
1207
|
-
if (0 === quote) {
|
|
1208
|
-
if ('[' === ch) bracket++;
|
|
1209
|
-
else if (']' === ch && bracket > 0) bracket--;
|
|
1210
|
-
else if (0 === bracket) {
|
|
1211
|
-
if ('(' === ch) paren++;
|
|
1212
|
-
else if (')' === ch && paren > 0) paren--;
|
|
1213
|
-
else if ('|' === ch && 0 === paren) {
|
|
1214
|
-
parts.push(value), value = '';
|
|
1215
|
-
continue;
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
value += ch;
|
|
1220
|
-
}
|
|
1221
|
-
return parts.push(value), parts;
|
|
1222
|
-
}, normalizeSimpleBranch = (branch)=>{
|
|
1223
|
-
let value = branch.trim(), changed = !0;
|
|
1224
|
-
for(; !0 === changed;)changed = !1, /^@\([^\\()[\]{}|]+\)$/.test(value) && (value = value.slice(2, -1), changed = !0);
|
|
1225
|
-
if (((branch)=>{
|
|
1226
|
-
let escaped = !1;
|
|
1227
|
-
for (let ch of branch){
|
|
1228
|
-
if (!0 === escaped) {
|
|
1229
|
-
escaped = !1;
|
|
1230
|
-
continue;
|
|
1231
|
-
}
|
|
1232
|
-
if ('\\' === ch) {
|
|
1233
|
-
escaped = !0;
|
|
1234
|
-
continue;
|
|
1235
|
-
}
|
|
1236
|
-
if (/[?*+@!()[\]{}]/.test(ch)) return !1;
|
|
1237
|
-
}
|
|
1238
|
-
return !0;
|
|
1239
|
-
})(value)) return value.replace(/\\(.)/g, '$1');
|
|
1240
|
-
}, parseRepeatedExtglob = (pattern, requireEnd = !0)=>{
|
|
1241
|
-
if ('+' !== pattern[0] && '*' !== pattern[0] || '(' !== pattern[1]) return;
|
|
1242
|
-
let bracket = 0, paren = 0, quote = 0, escaped = !1;
|
|
1243
|
-
for(let i = 1; i < pattern.length; i++){
|
|
1244
|
-
let ch = pattern[i];
|
|
1245
|
-
if (!0 === escaped) {
|
|
1246
|
-
escaped = !1;
|
|
1247
|
-
continue;
|
|
1248
|
-
}
|
|
1249
|
-
if ('\\' === ch) {
|
|
1250
|
-
escaped = !0;
|
|
1251
|
-
continue;
|
|
1252
|
-
}
|
|
1253
|
-
if ('"' === ch) {
|
|
1254
|
-
quote = +(1 !== quote);
|
|
1255
|
-
continue;
|
|
1256
|
-
}
|
|
1257
|
-
if (1 !== quote) {
|
|
1258
|
-
if ('[' === ch) {
|
|
1259
|
-
bracket++;
|
|
1260
|
-
continue;
|
|
1261
|
-
}
|
|
1262
|
-
if (']' === ch && bracket > 0) {
|
|
1263
|
-
bracket--;
|
|
1264
|
-
continue;
|
|
1265
|
-
}
|
|
1266
|
-
if (!(bracket > 0)) {
|
|
1267
|
-
if ('(' === ch) {
|
|
1268
|
-
paren++;
|
|
1269
|
-
continue;
|
|
1270
|
-
}
|
|
1271
|
-
if (')' === ch && 0 == --paren) {
|
|
1272
|
-
if (!0 === requireEnd && i !== pattern.length - 1) return;
|
|
1273
|
-
return {
|
|
1274
|
-
type: pattern[0],
|
|
1275
|
-
body: pattern.slice(2, i),
|
|
1276
|
-
end: i
|
|
1277
|
-
};
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
}, getStarExtglobSequenceOutput = (pattern)=>{
|
|
1283
|
-
let index = 0, chars = [];
|
|
1284
|
-
for(; index < pattern.length;){
|
|
1285
|
-
let match = parseRepeatedExtglob(pattern.slice(index), !1);
|
|
1286
|
-
if (!match || '*' !== match.type) return;
|
|
1287
|
-
let branches = splitTopLevel(match.body).map((branch)=>branch.trim());
|
|
1288
|
-
if (1 !== branches.length) return;
|
|
1289
|
-
let branch = normalizeSimpleBranch(branches[0]);
|
|
1290
|
-
if (!branch || 1 !== branch.length) return;
|
|
1291
|
-
chars.push(branch), index += match.end + 1;
|
|
1292
|
-
}
|
|
1293
|
-
if (chars.length < 1) return;
|
|
1294
|
-
let source = 1 === chars.length ? utils.escapeRegex(chars[0]) : `[${chars.map((ch)=>utils.escapeRegex(ch)).join('')}]`;
|
|
1295
|
-
return `${source}*`;
|
|
1296
|
-
}, repeatedExtglobRecursion = (pattern)=>{
|
|
1297
|
-
let depth = 0, value = pattern.trim(), match = parseRepeatedExtglob(value);
|
|
1298
|
-
for(; match;)depth++, match = parseRepeatedExtglob(value = match.body.trim());
|
|
1299
|
-
return depth;
|
|
1300
|
-
}, parse = (input, options)=>{
|
|
1301
|
-
let value;
|
|
1302
|
-
if ('string' != typeof input) throw TypeError('Expected a string');
|
|
1303
|
-
input = REPLACEMENTS[input] || input;
|
|
1304
|
-
let opts = {
|
|
1305
|
-
...options
|
|
1306
|
-
}, max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH, len = input.length;
|
|
1307
|
-
if (len > max) throw SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1308
|
-
let bos = {
|
|
1309
|
-
type: 'bos',
|
|
1310
|
-
value: '',
|
|
1311
|
-
output: opts.prepend || ''
|
|
1312
|
-
}, tokens = [
|
|
1313
|
-
bos
|
|
1314
|
-
], capture = opts.capture ? '' : '?:', win32 = utils.isWindows(options), PLATFORM_CHARS = constants.globChars(win32), EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS), { 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, globstar = (opts)=>`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`, nodot = opts.dot ? '' : NO_DOT, qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT, star = !0 === opts.bash ? globstar(opts) : STAR;
|
|
1315
|
-
opts.capture && (star = `(${star})`), 'boolean' == typeof opts.noext && (opts.noextglob = opts.noext);
|
|
1316
|
-
let state = {
|
|
1317
|
-
input,
|
|
1318
|
-
index: -1,
|
|
1319
|
-
start: 0,
|
|
1320
|
-
dot: !0 === opts.dot,
|
|
1321
|
-
consumed: '',
|
|
1322
|
-
output: '',
|
|
1323
|
-
prefix: '',
|
|
1324
|
-
backtrack: !1,
|
|
1325
|
-
negated: !1,
|
|
1326
|
-
brackets: 0,
|
|
1327
|
-
braces: 0,
|
|
1328
|
-
parens: 0,
|
|
1329
|
-
quotes: 0,
|
|
1330
|
-
globstar: !1,
|
|
1331
|
-
tokens
|
|
1332
|
-
};
|
|
1333
|
-
len = (input = utils.removePrefix(input, state)).length;
|
|
1334
|
-
let extglobs = [], braces = [], stack = [], prev = bos, eos = ()=>state.index === len - 1, peek = state.peek = (n = 1)=>input[state.index + n], advance = state.advance = ()=>input[++state.index] || '', remaining = ()=>input.slice(state.index + 1), consume = (value = '', num = 0)=>{
|
|
1335
|
-
state.consumed += value, state.index += num;
|
|
1336
|
-
}, append = (token)=>{
|
|
1337
|
-
state.output += null != token.output ? token.output : token.value, consume(token.value);
|
|
1338
|
-
}, negate = ()=>{
|
|
1339
|
-
let count = 1;
|
|
1340
|
-
for(; '!' === peek() && ('(' !== peek(2) || '?' === peek(3));)advance(), state.start++, count++;
|
|
1341
|
-
return count % 2 != 0 && (state.negated = !0, state.start++, !0);
|
|
1342
|
-
}, increment = (type)=>{
|
|
1343
|
-
state[type]++, stack.push(type);
|
|
1344
|
-
}, decrement = (type)=>{
|
|
1345
|
-
state[type]--, stack.pop();
|
|
1346
|
-
}, push = (tok)=>{
|
|
1347
|
-
if ('globstar' === prev.type) {
|
|
1348
|
-
let isBrace = state.braces > 0 && ('comma' === tok.type || 'brace' === tok.type), isExtglob = !0 === tok.extglob || extglobs.length && ('pipe' === tok.type || 'paren' === tok.type);
|
|
1349
|
-
'slash' === tok.type || 'paren' === tok.type || isBrace || isExtglob || (state.output = state.output.slice(0, -prev.output.length), prev.type = 'star', prev.value = '*', prev.output = star, state.output += prev.output);
|
|
1350
|
-
}
|
|
1351
|
-
if (extglobs.length && 'paren' !== tok.type && (extglobs[extglobs.length - 1].inner += tok.value), (tok.value || tok.output) && append(tok), prev && 'text' === prev.type && 'text' === tok.type) {
|
|
1352
|
-
prev.value += tok.value, prev.output = (prev.output || '') + tok.value;
|
|
1353
|
-
return;
|
|
1354
|
-
}
|
|
1355
|
-
tok.prev = prev, tokens.push(tok), prev = tok;
|
|
1356
|
-
}, extglobOpen = (type, value)=>{
|
|
1357
|
-
let token = {
|
|
1358
|
-
...EXTGLOB_CHARS[value],
|
|
1359
|
-
conditions: 1,
|
|
1360
|
-
inner: ''
|
|
1361
|
-
};
|
|
1362
|
-
token.prev = prev, token.parens = state.parens, token.output = state.output, token.startIndex = state.index, token.tokensIndex = tokens.length;
|
|
1363
|
-
let output = (opts.capture ? '(' : '') + token.open;
|
|
1364
|
-
increment('parens'), push({
|
|
1365
|
-
type,
|
|
1366
|
-
value,
|
|
1367
|
-
output: state.output ? '' : ONE_CHAR
|
|
1368
|
-
}), push({
|
|
1369
|
-
type: 'paren',
|
|
1370
|
-
extglob: !0,
|
|
1371
|
-
value: advance(),
|
|
1372
|
-
output
|
|
1373
|
-
}), extglobs.push(token);
|
|
1374
|
-
}, extglobClose = (token)=>{
|
|
1375
|
-
let rest, literal = input.slice(token.startIndex, state.index + 1), analysis = ((body, options)=>{
|
|
1376
|
-
if (!1 === options.maxExtglobRecursion) return {
|
|
1377
|
-
risky: !1
|
|
1378
|
-
};
|
|
1379
|
-
let max = 'number' == typeof options.maxExtglobRecursion ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION, branches = splitTopLevel(body).map((branch)=>branch.trim());
|
|
1380
|
-
if (branches.length > 1 && (branches.some((branch)=>'' === branch) || branches.some((branch)=>/^[*?]+$/.test(branch)) || ((branches)=>{
|
|
1381
|
-
let values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
1382
|
-
for(let i = 0; i < values.length; i++)for(let j = i + 1; j < values.length; j++){
|
|
1383
|
-
let a = values[i], b = values[j], char = a[0];
|
|
1384
|
-
if (char && a === char.repeat(a.length) && b === char.repeat(b.length) && (a === b || a.startsWith(b) || b.startsWith(a))) return !0;
|
|
1385
|
-
}
|
|
1386
|
-
return !1;
|
|
1387
|
-
})(branches))) return {
|
|
1388
|
-
risky: !0
|
|
1389
|
-
};
|
|
1390
|
-
for (let branch of branches){
|
|
1391
|
-
let safeOutput = getStarExtglobSequenceOutput(branch);
|
|
1392
|
-
if (safeOutput) return {
|
|
1393
|
-
risky: !0,
|
|
1394
|
-
safeOutput
|
|
1395
|
-
};
|
|
1396
|
-
if (repeatedExtglobRecursion(branch) > max) return {
|
|
1397
|
-
risky: !0
|
|
1398
|
-
};
|
|
1399
|
-
}
|
|
1400
|
-
return {
|
|
1401
|
-
risky: !1
|
|
1402
|
-
};
|
|
1403
|
-
})(input.slice(token.startIndex + 2, state.index), opts);
|
|
1404
|
-
if (('plus' === token.type || 'star' === token.type) && analysis.risky) {
|
|
1405
|
-
let safeOutput = analysis.safeOutput ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0, open = tokens[token.tokensIndex];
|
|
1406
|
-
open.type = 'text', open.value = literal, open.output = safeOutput || utils.escapeRegex(literal);
|
|
1407
|
-
for(let i = token.tokensIndex + 1; i < tokens.length; i++)tokens[i].value = '', tokens[i].output = '', delete tokens[i].suffix;
|
|
1408
|
-
state.output = token.output + open.output, state.backtrack = !0, push({
|
|
1409
|
-
type: 'paren',
|
|
1410
|
-
extglob: !0,
|
|
1411
|
-
value,
|
|
1412
|
-
output: ''
|
|
1413
|
-
}), decrement('parens');
|
|
1414
|
-
return;
|
|
1415
|
-
}
|
|
1416
|
-
let output = token.close + (opts.capture ? ')' : '');
|
|
1417
|
-
if ('negate' === token.type) {
|
|
1418
|
-
let extglobStar = star;
|
|
1419
|
-
if (token.inner && token.inner.length > 1 && token.inner.includes('/') && (extglobStar = globstar(opts)), (extglobStar !== star || eos() || /^\)+$/.test(remaining())) && (output = token.close = `)$))${extglobStar}`), token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
1420
|
-
let expression = parse(rest, {
|
|
1421
|
-
...options,
|
|
1422
|
-
fastpaths: !1
|
|
1423
|
-
}).output;
|
|
1424
|
-
output = token.close = `)${expression})${extglobStar})`;
|
|
1425
|
-
}
|
|
1426
|
-
'bos' === token.prev.type && (state.negatedExtglob = !0);
|
|
1427
|
-
}
|
|
1428
|
-
push({
|
|
1429
|
-
type: 'paren',
|
|
1430
|
-
extglob: !0,
|
|
1431
|
-
value,
|
|
1432
|
-
output
|
|
1433
|
-
}), decrement('parens');
|
|
1434
|
-
};
|
|
1435
|
-
if (!1 !== opts.fastpaths && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
1436
|
-
let backslashes = !1, output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index)=>'\\' === first ? (backslashes = !0, m) : '?' === first ? esc ? esc + first + (rest ? QMARK.repeat(rest.length) : '') : 0 === index ? qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '') : QMARK.repeat(chars.length) : '.' === first ? DOT_LITERAL.repeat(chars.length) : '*' === first ? esc ? esc + first + (rest ? star : '') : star : esc ? m : `\\${m}`);
|
|
1437
|
-
return (!0 === backslashes && (output = !0 === opts.unescape ? output.replace(/\\/g, '') : output.replace(/\\+/g, (m)=>m.length % 2 == 0 ? '\\\\' : m ? '\\' : '')), output === input && !0 === opts.contains) ? state.output = input : state.output = utils.wrapOutput(output, state, options), state;
|
|
1438
|
-
}
|
|
1439
|
-
for(; !eos();){
|
|
1440
|
-
if ('\u0000' === (value = advance())) continue;
|
|
1441
|
-
if ('\\' === value) {
|
|
1442
|
-
let next = peek();
|
|
1443
|
-
if ('/' === next && !0 !== opts.bash || '.' === next || ';' === next) continue;
|
|
1444
|
-
if (!next) {
|
|
1445
|
-
push({
|
|
1446
|
-
type: 'text',
|
|
1447
|
-
value: value += '\\'
|
|
1448
|
-
});
|
|
1449
|
-
continue;
|
|
1450
|
-
}
|
|
1451
|
-
let match = /^\\+/.exec(remaining()), slashes = 0;
|
|
1452
|
-
if (match && match[0].length > 2 && (slashes = match[0].length, state.index += slashes, slashes % 2 != 0 && (value += '\\')), !0 === opts.unescape ? value = advance() : value += advance(), 0 === state.brackets) {
|
|
1453
|
-
push({
|
|
1454
|
-
type: 'text',
|
|
1455
|
-
value
|
|
1456
|
-
});
|
|
1457
|
-
continue;
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
if (state.brackets > 0 && (']' !== value || '[' === prev.value || '[^' === prev.value)) {
|
|
1461
|
-
if (!1 !== opts.posix && ':' === value) {
|
|
1462
|
-
let inner = prev.value.slice(1);
|
|
1463
|
-
if (inner.includes('[') && (prev.posix = !0, inner.includes(':'))) {
|
|
1464
|
-
let idx = prev.value.lastIndexOf('['), pre = prev.value.slice(0, idx), posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
|
|
1465
|
-
if (posix) {
|
|
1466
|
-
prev.value = pre + posix, state.backtrack = !0, advance(), bos.output || 1 !== tokens.indexOf(prev) || (bos.output = ONE_CHAR);
|
|
1467
|
-
continue;
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
('[' === value && ':' !== peek() || '-' === value && ']' === peek()) && (value = `\\${value}`), ']' === value && ('[' === prev.value || '[^' === prev.value) && (value = `\\${value}`), !0 === opts.posix && '!' === value && '[' === prev.value && (value = '^'), prev.value += value, append({
|
|
1472
|
-
value
|
|
1473
|
-
});
|
|
1474
|
-
continue;
|
|
1475
|
-
}
|
|
1476
|
-
if (1 === state.quotes && '"' !== value) {
|
|
1477
|
-
value = utils.escapeRegex(value), prev.value += value, append({
|
|
1478
|
-
value
|
|
1479
|
-
});
|
|
1480
|
-
continue;
|
|
1481
|
-
}
|
|
1482
|
-
if ('"' === value) {
|
|
1483
|
-
state.quotes = +(1 !== state.quotes), !0 === opts.keepQuotes && push({
|
|
1484
|
-
type: 'text',
|
|
1485
|
-
value
|
|
1486
|
-
});
|
|
1487
|
-
continue;
|
|
1488
|
-
}
|
|
1489
|
-
if ('(' === value) {
|
|
1490
|
-
increment('parens'), push({
|
|
1491
|
-
type: 'paren',
|
|
1492
|
-
value
|
|
1493
|
-
});
|
|
1494
|
-
continue;
|
|
1495
|
-
}
|
|
1496
|
-
if (')' === value) {
|
|
1497
|
-
if (0 === state.parens && !0 === opts.strictBrackets) throw SyntaxError(syntaxError('opening', '('));
|
|
1498
|
-
let extglob = extglobs[extglobs.length - 1];
|
|
1499
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
|
1500
|
-
extglobClose(extglobs.pop());
|
|
1501
|
-
continue;
|
|
1502
|
-
}
|
|
1503
|
-
push({
|
|
1504
|
-
type: 'paren',
|
|
1505
|
-
value,
|
|
1506
|
-
output: state.parens ? ')' : '\\)'
|
|
1507
|
-
}), decrement('parens');
|
|
1508
|
-
continue;
|
|
1509
|
-
}
|
|
1510
|
-
if ('[' === value) {
|
|
1511
|
-
if (!0 !== opts.nobracket && remaining().includes(']')) increment('brackets');
|
|
1512
|
-
else {
|
|
1513
|
-
if (!0 !== opts.nobracket && !0 === opts.strictBrackets) throw SyntaxError(syntaxError('closing', ']'));
|
|
1514
|
-
value = `\\${value}`;
|
|
1515
|
-
}
|
|
1516
|
-
push({
|
|
1517
|
-
type: 'bracket',
|
|
1518
|
-
value
|
|
1519
|
-
});
|
|
1520
|
-
continue;
|
|
1521
|
-
}
|
|
1522
|
-
if (']' === value) {
|
|
1523
|
-
if (!0 === opts.nobracket || prev && 'bracket' === prev.type && 1 === prev.value.length) {
|
|
1524
|
-
push({
|
|
1525
|
-
type: 'text',
|
|
1526
|
-
value,
|
|
1527
|
-
output: `\\${value}`
|
|
1528
|
-
});
|
|
1529
|
-
continue;
|
|
1530
|
-
}
|
|
1531
|
-
if (0 === state.brackets) {
|
|
1532
|
-
if (!0 === opts.strictBrackets) throw SyntaxError(syntaxError('opening', '['));
|
|
1533
|
-
push({
|
|
1534
|
-
type: 'text',
|
|
1535
|
-
value,
|
|
1536
|
-
output: `\\${value}`
|
|
1537
|
-
});
|
|
1538
|
-
continue;
|
|
1539
|
-
}
|
|
1540
|
-
decrement('brackets');
|
|
1541
|
-
let prevValue = prev.value.slice(1);
|
|
1542
|
-
if (!0 === prev.posix || '^' !== prevValue[0] || prevValue.includes('/') || (value = `/${value}`), prev.value += value, append({
|
|
1543
|
-
value
|
|
1544
|
-
}), !1 === opts.literalBrackets || utils.hasRegexChars(prevValue)) continue;
|
|
1545
|
-
let escaped = utils.escapeRegex(prev.value);
|
|
1546
|
-
if (state.output = state.output.slice(0, -prev.value.length), !0 === opts.literalBrackets) {
|
|
1547
|
-
state.output += escaped, prev.value = escaped;
|
|
1548
|
-
continue;
|
|
1549
|
-
}
|
|
1550
|
-
prev.value = `(${capture}${escaped}|${prev.value})`, state.output += prev.value;
|
|
1551
|
-
continue;
|
|
1552
|
-
}
|
|
1553
|
-
if ('{' === value && !0 !== opts.nobrace) {
|
|
1554
|
-
increment('braces');
|
|
1555
|
-
let open = {
|
|
1556
|
-
type: 'brace',
|
|
1557
|
-
value,
|
|
1558
|
-
output: '(',
|
|
1559
|
-
outputIndex: state.output.length,
|
|
1560
|
-
tokensIndex: state.tokens.length
|
|
1561
|
-
};
|
|
1562
|
-
braces.push(open), push(open);
|
|
1563
|
-
continue;
|
|
1564
|
-
}
|
|
1565
|
-
if ('}' === value) {
|
|
1566
|
-
let brace = braces[braces.length - 1];
|
|
1567
|
-
if (!0 === opts.nobrace || !brace) {
|
|
1568
|
-
push({
|
|
1569
|
-
type: 'text',
|
|
1570
|
-
value,
|
|
1571
|
-
output: value
|
|
1572
|
-
});
|
|
1573
|
-
continue;
|
|
1574
|
-
}
|
|
1575
|
-
let output = ')';
|
|
1576
|
-
if (!0 === brace.dots) {
|
|
1577
|
-
let arr = tokens.slice(), range = [];
|
|
1578
|
-
for(let i = arr.length - 1; i >= 0 && (tokens.pop(), 'brace' !== arr[i].type); i--)'dots' !== arr[i].type && range.unshift(arr[i].value);
|
|
1579
|
-
output = expandRange(range, opts), state.backtrack = !0;
|
|
1580
|
-
}
|
|
1581
|
-
if (!0 !== brace.comma && !0 !== brace.dots) {
|
|
1582
|
-
let out = state.output.slice(0, brace.outputIndex), toks = state.tokens.slice(brace.tokensIndex);
|
|
1583
|
-
for (let t of (brace.value = brace.output = '\\{', value = output = '\\}', state.output = out, toks))state.output += t.output || t.value;
|
|
1584
|
-
}
|
|
1585
|
-
push({
|
|
1586
|
-
type: 'brace',
|
|
1587
|
-
value,
|
|
1588
|
-
output
|
|
1589
|
-
}), decrement('braces'), braces.pop();
|
|
1590
|
-
continue;
|
|
1591
|
-
}
|
|
1592
|
-
if ('|' === value) {
|
|
1593
|
-
extglobs.length > 0 && extglobs[extglobs.length - 1].conditions++, push({
|
|
1594
|
-
type: 'text',
|
|
1595
|
-
value
|
|
1596
|
-
});
|
|
1597
|
-
continue;
|
|
1598
|
-
}
|
|
1599
|
-
if (',' === value) {
|
|
1600
|
-
let output = value, brace = braces[braces.length - 1];
|
|
1601
|
-
brace && 'braces' === stack[stack.length - 1] && (brace.comma = !0, output = '|'), push({
|
|
1602
|
-
type: 'comma',
|
|
1603
|
-
value,
|
|
1604
|
-
output
|
|
1605
|
-
});
|
|
1606
|
-
continue;
|
|
1607
|
-
}
|
|
1608
|
-
if ('/' === value) {
|
|
1609
|
-
if ('dot' === prev.type && state.index === state.start + 1) {
|
|
1610
|
-
state.start = state.index + 1, state.consumed = '', state.output = '', tokens.pop(), prev = bos;
|
|
1611
|
-
continue;
|
|
1612
|
-
}
|
|
1613
|
-
push({
|
|
1614
|
-
type: 'slash',
|
|
1615
|
-
value,
|
|
1616
|
-
output: SLASH_LITERAL
|
|
1617
|
-
});
|
|
1618
|
-
continue;
|
|
1619
|
-
}
|
|
1620
|
-
if ('.' === value) {
|
|
1621
|
-
if (state.braces > 0 && 'dot' === prev.type) {
|
|
1622
|
-
'.' === prev.value && (prev.output = DOT_LITERAL);
|
|
1623
|
-
let brace = braces[braces.length - 1];
|
|
1624
|
-
prev.type = 'dots', prev.output += value, prev.value += value, brace.dots = !0;
|
|
1625
|
-
continue;
|
|
1626
|
-
}
|
|
1627
|
-
if (state.braces + state.parens === 0 && 'bos' !== prev.type && 'slash' !== prev.type) {
|
|
1628
|
-
push({
|
|
1629
|
-
type: 'text',
|
|
1630
|
-
value,
|
|
1631
|
-
output: DOT_LITERAL
|
|
1632
|
-
});
|
|
1633
|
-
continue;
|
|
1634
|
-
}
|
|
1635
|
-
push({
|
|
1636
|
-
type: 'dot',
|
|
1637
|
-
value,
|
|
1638
|
-
output: DOT_LITERAL
|
|
1639
|
-
});
|
|
1640
|
-
continue;
|
|
1641
|
-
}
|
|
1642
|
-
if ('?' === value) {
|
|
1643
|
-
if (!(prev && '(' === prev.value) && !0 !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
1644
|
-
extglobOpen('qmark', value);
|
|
1645
|
-
continue;
|
|
1646
|
-
}
|
|
1647
|
-
if (prev && 'paren' === prev.type) {
|
|
1648
|
-
let next = peek(), output = value;
|
|
1649
|
-
if ('<' === next && !utils.supportsLookbehinds()) throw Error('Node.js v10 or higher is required for regex lookbehinds');
|
|
1650
|
-
('(' !== prev.value || /[!=<:]/.test(next)) && ('<' !== next || /<([!=]|\w+>)/.test(remaining())) || (output = `\\${value}`), push({
|
|
1651
|
-
type: 'text',
|
|
1652
|
-
value,
|
|
1653
|
-
output
|
|
1654
|
-
});
|
|
1655
|
-
continue;
|
|
1656
|
-
}
|
|
1657
|
-
if (!0 !== opts.dot && ('slash' === prev.type || 'bos' === prev.type)) {
|
|
1658
|
-
push({
|
|
1659
|
-
type: 'qmark',
|
|
1660
|
-
value,
|
|
1661
|
-
output: QMARK_NO_DOT
|
|
1662
|
-
});
|
|
1663
|
-
continue;
|
|
1664
|
-
}
|
|
1665
|
-
push({
|
|
1666
|
-
type: 'qmark',
|
|
1667
|
-
value,
|
|
1668
|
-
output: QMARK
|
|
1669
|
-
});
|
|
1670
|
-
continue;
|
|
1671
|
-
}
|
|
1672
|
-
if ('!' === value) {
|
|
1673
|
-
if (!0 !== opts.noextglob && '(' === peek() && ('?' !== peek(2) || !/[!=<:]/.test(peek(3)))) {
|
|
1674
|
-
extglobOpen('negate', value);
|
|
1675
|
-
continue;
|
|
1676
|
-
}
|
|
1677
|
-
if (!0 !== opts.nonegate && 0 === state.index) {
|
|
1678
|
-
negate();
|
|
1679
|
-
continue;
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
if ('+' === value) {
|
|
1683
|
-
if (!0 !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
1684
|
-
extglobOpen('plus', value);
|
|
1685
|
-
continue;
|
|
1686
|
-
}
|
|
1687
|
-
if (prev && '(' === prev.value || !1 === opts.regex) {
|
|
1688
|
-
push({
|
|
1689
|
-
type: 'plus',
|
|
1690
|
-
value,
|
|
1691
|
-
output: PLUS_LITERAL
|
|
1692
|
-
});
|
|
1693
|
-
continue;
|
|
1694
|
-
}
|
|
1695
|
-
if (prev && ('bracket' === prev.type || 'paren' === prev.type || 'brace' === prev.type) || state.parens > 0) {
|
|
1696
|
-
push({
|
|
1697
|
-
type: 'plus',
|
|
1698
|
-
value
|
|
1699
|
-
});
|
|
1700
|
-
continue;
|
|
1701
|
-
}
|
|
1702
|
-
push({
|
|
1703
|
-
type: 'plus',
|
|
1704
|
-
value: PLUS_LITERAL
|
|
1705
|
-
});
|
|
1706
|
-
continue;
|
|
1707
|
-
}
|
|
1708
|
-
if ('@' === value) {
|
|
1709
|
-
if (!0 !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
|
|
1710
|
-
push({
|
|
1711
|
-
type: 'at',
|
|
1712
|
-
extglob: !0,
|
|
1713
|
-
value,
|
|
1714
|
-
output: ''
|
|
1715
|
-
});
|
|
1716
|
-
continue;
|
|
1717
|
-
}
|
|
1718
|
-
push({
|
|
1719
|
-
type: 'text',
|
|
1720
|
-
value
|
|
1721
|
-
});
|
|
1722
|
-
continue;
|
|
1723
|
-
}
|
|
1724
|
-
if ('*' !== value) {
|
|
1725
|
-
('$' === value || '^' === value) && (value = `\\${value}`);
|
|
1726
|
-
let match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1727
|
-
match && (value += match[0], state.index += match[0].length), push({
|
|
1728
|
-
type: 'text',
|
|
1729
|
-
value
|
|
1730
|
-
});
|
|
1731
|
-
continue;
|
|
1732
|
-
}
|
|
1733
|
-
if (prev && ('globstar' === prev.type || !0 === prev.star)) {
|
|
1734
|
-
prev.type = 'star', prev.star = !0, prev.value += value, prev.output = star, state.backtrack = !0, state.globstar = !0, consume(value);
|
|
1735
|
-
continue;
|
|
1736
|
-
}
|
|
1737
|
-
let rest = remaining();
|
|
1738
|
-
if (!0 !== opts.noextglob && /^\([^?]/.test(rest)) {
|
|
1739
|
-
extglobOpen('star', value);
|
|
1740
|
-
continue;
|
|
1741
|
-
}
|
|
1742
|
-
if ('star' === prev.type) {
|
|
1743
|
-
if (!0 === opts.noglobstar) {
|
|
1744
|
-
consume(value);
|
|
1745
|
-
continue;
|
|
1746
|
-
}
|
|
1747
|
-
let prior = prev.prev, before = prior.prev, isStart = 'slash' === prior.type || 'bos' === prior.type, afterStar = before && ('star' === before.type || 'globstar' === before.type);
|
|
1748
|
-
if (!0 === opts.bash && (!isStart || rest[0] && '/' !== rest[0])) {
|
|
1749
|
-
push({
|
|
1750
|
-
type: 'star',
|
|
1751
|
-
value,
|
|
1752
|
-
output: ''
|
|
1753
|
-
});
|
|
1754
|
-
continue;
|
|
1755
|
-
}
|
|
1756
|
-
let isBrace = state.braces > 0 && ('comma' === prior.type || 'brace' === prior.type), isExtglob = extglobs.length && ('pipe' === prior.type || 'paren' === prior.type);
|
|
1757
|
-
if (!isStart && 'paren' !== prior.type && !isBrace && !isExtglob) {
|
|
1758
|
-
push({
|
|
1759
|
-
type: 'star',
|
|
1760
|
-
value,
|
|
1761
|
-
output: ''
|
|
1762
|
-
});
|
|
1763
|
-
continue;
|
|
1764
|
-
}
|
|
1765
|
-
for(; '/**' === rest.slice(0, 3);){
|
|
1766
|
-
let after = input[state.index + 4];
|
|
1767
|
-
if (after && '/' !== after) break;
|
|
1768
|
-
rest = rest.slice(3), consume('/**', 3);
|
|
1769
|
-
}
|
|
1770
|
-
if ('bos' === prior.type && eos()) {
|
|
1771
|
-
prev.type = 'globstar', prev.value += value, prev.output = globstar(opts), state.output = prev.output, state.globstar = !0, consume(value);
|
|
1772
|
-
continue;
|
|
1773
|
-
}
|
|
1774
|
-
if ('slash' === prior.type && 'bos' !== prior.prev.type && !afterStar && eos()) {
|
|
1775
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length), prior.output = `(?:${prior.output}`, prev.type = 'globstar', prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'), prev.value += value, state.globstar = !0, state.output += prior.output + prev.output, consume(value);
|
|
1776
|
-
continue;
|
|
1777
|
-
}
|
|
1778
|
-
if ('slash' === prior.type && 'bos' !== prior.prev.type && '/' === rest[0]) {
|
|
1779
|
-
let end = void 0 !== rest[1] ? '|$' : '';
|
|
1780
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length), prior.output = `(?:${prior.output}`, prev.type = 'globstar', prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`, prev.value += value, state.output += prior.output + prev.output, state.globstar = !0, consume(value + advance()), push({
|
|
1781
|
-
type: 'slash',
|
|
1782
|
-
value: '/',
|
|
1783
|
-
output: ''
|
|
1784
|
-
});
|
|
1785
|
-
continue;
|
|
1786
|
-
}
|
|
1787
|
-
if ('bos' === prior.type && '/' === rest[0]) {
|
|
1788
|
-
prev.type = 'globstar', prev.value += value, prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`, state.output = prev.output, state.globstar = !0, consume(value + advance()), push({
|
|
1789
|
-
type: 'slash',
|
|
1790
|
-
value: '/',
|
|
1791
|
-
output: ''
|
|
1792
|
-
});
|
|
1793
|
-
continue;
|
|
1794
|
-
}
|
|
1795
|
-
state.output = state.output.slice(0, -prev.output.length), prev.type = 'globstar', prev.output = globstar(opts), prev.value += value, state.output += prev.output, state.globstar = !0, consume(value);
|
|
1796
|
-
continue;
|
|
1797
|
-
}
|
|
1798
|
-
let token = {
|
|
1799
|
-
type: 'star',
|
|
1800
|
-
value,
|
|
1801
|
-
output: star
|
|
1802
|
-
};
|
|
1803
|
-
if (!0 === opts.bash) {
|
|
1804
|
-
token.output = '.*?', ('bos' === prev.type || 'slash' === prev.type) && (token.output = nodot + token.output), push(token);
|
|
1805
|
-
continue;
|
|
1806
|
-
}
|
|
1807
|
-
if (prev && ('bracket' === prev.type || 'paren' === prev.type) && !0 === opts.regex) {
|
|
1808
|
-
token.output = value, push(token);
|
|
1809
|
-
continue;
|
|
1810
|
-
}
|
|
1811
|
-
(state.index === state.start || 'slash' === prev.type || 'dot' === prev.type) && ('dot' === prev.type ? (state.output += NO_DOT_SLASH, prev.output += NO_DOT_SLASH) : !0 === opts.dot ? (state.output += NO_DOTS_SLASH, prev.output += NO_DOTS_SLASH) : (state.output += nodot, prev.output += nodot), '*' !== peek() && (state.output += ONE_CHAR, prev.output += ONE_CHAR)), push(token);
|
|
1812
|
-
}
|
|
1813
|
-
for(; state.brackets > 0;){
|
|
1814
|
-
if (!0 === opts.strictBrackets) throw SyntaxError(syntaxError('closing', ']'));
|
|
1815
|
-
state.output = utils.escapeLast(state.output, '['), decrement('brackets');
|
|
1816
|
-
}
|
|
1817
|
-
for(; state.parens > 0;){
|
|
1818
|
-
if (!0 === opts.strictBrackets) throw SyntaxError(syntaxError('closing', ')'));
|
|
1819
|
-
state.output = utils.escapeLast(state.output, '('), decrement('parens');
|
|
1820
|
-
}
|
|
1821
|
-
for(; state.braces > 0;){
|
|
1822
|
-
if (!0 === opts.strictBrackets) throw SyntaxError(syntaxError('closing', '}'));
|
|
1823
|
-
state.output = utils.escapeLast(state.output, '{'), decrement('braces');
|
|
1824
|
-
}
|
|
1825
|
-
if (!0 !== opts.strictSlashes && ('star' === prev.type || 'bracket' === prev.type) && push({
|
|
1826
|
-
type: 'maybe_slash',
|
|
1827
|
-
value: '',
|
|
1828
|
-
output: `${SLASH_LITERAL}?`
|
|
1829
|
-
}), !0 === state.backtrack) for (let token of (state.output = '', state.tokens))state.output += null != token.output ? token.output : token.value, token.suffix && (state.output += token.suffix);
|
|
1830
|
-
return state;
|
|
1831
|
-
};
|
|
1832
|
-
parse.fastpaths = (input, options)=>{
|
|
1833
|
-
let opts = {
|
|
1834
|
-
...options
|
|
1835
|
-
}, max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH, len = input.length;
|
|
1836
|
-
if (len > max) throw SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1837
|
-
input = REPLACEMENTS[input] || input;
|
|
1838
|
-
let win32 = utils.isWindows(options), { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(win32), nodot = opts.dot ? NO_DOTS : NO_DOT, slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT, capture = opts.capture ? '' : '?:', star = !0 === opts.bash ? '.*?' : STAR;
|
|
1839
|
-
opts.capture && (star = `(${star})`);
|
|
1840
|
-
let globstar = (opts)=>!0 === opts.noglobstar ? star : `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`, create = (str)=>{
|
|
1841
|
-
switch(str){
|
|
1842
|
-
case '*':
|
|
1843
|
-
return `${nodot}${ONE_CHAR}${star}`;
|
|
1844
|
-
case '.*':
|
|
1845
|
-
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1846
|
-
case '*.*':
|
|
1847
|
-
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1848
|
-
case '*/*':
|
|
1849
|
-
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
1850
|
-
case '**':
|
|
1851
|
-
return nodot + globstar(opts);
|
|
1852
|
-
case '**/*':
|
|
1853
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
1854
|
-
case '**/*.*':
|
|
1855
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1856
|
-
case '**/.*':
|
|
1857
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1858
|
-
default:
|
|
1859
|
-
{
|
|
1860
|
-
let match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1861
|
-
if (!match) return;
|
|
1862
|
-
let source = create(match[1]);
|
|
1863
|
-
if (!source) return;
|
|
1864
|
-
return source + DOT_LITERAL + match[2];
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
}, source = create(utils.removePrefix(input, {
|
|
1868
|
-
negated: !1,
|
|
1869
|
-
prefix: ''
|
|
1870
|
-
}));
|
|
1871
|
-
return source && !0 !== opts.strictSlashes && (source += `${SLASH_LITERAL}?`), source;
|
|
1872
|
-
}, module.exports = parse;
|
|
1873
|
-
},
|
|
1874
|
-
"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1875
|
-
let path = __webpack_require__("path?aeb1"), scan = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"), parse = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"), utils = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"), constants = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"), picomatch = (glob, options, returnState = !1)=>{
|
|
1876
|
-
if (Array.isArray(glob)) {
|
|
1877
|
-
let fns = glob.map((input)=>picomatch(input, options, returnState));
|
|
1878
|
-
return (str)=>{
|
|
1879
|
-
for (let isMatch of fns){
|
|
1880
|
-
let state = isMatch(str);
|
|
1881
|
-
if (state) return state;
|
|
1882
|
-
}
|
|
1883
|
-
return !1;
|
|
1884
|
-
};
|
|
1885
|
-
}
|
|
1886
|
-
let isState = glob && 'object' == typeof glob && !Array.isArray(glob) && glob.tokens && glob.input;
|
|
1887
|
-
if ('' === glob || 'string' != typeof glob && !isState) throw TypeError('Expected pattern to be a non-empty string');
|
|
1888
|
-
let opts = options || {}, posix = utils.isWindows(options), regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, !1, !0), state = regex.state;
|
|
1889
|
-
delete regex.state;
|
|
1890
|
-
let isIgnored = ()=>!1;
|
|
1891
|
-
if (opts.ignore) {
|
|
1892
|
-
let ignoreOpts = {
|
|
1893
|
-
...options,
|
|
1894
|
-
ignore: null,
|
|
1895
|
-
onMatch: null,
|
|
1896
|
-
onResult: null
|
|
1897
|
-
};
|
|
1898
|
-
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
1899
|
-
}
|
|
1900
|
-
let matcher = (input, returnObject = !1)=>{
|
|
1901
|
-
let { isMatch, match, output } = picomatch.test(input, regex, options, {
|
|
1902
|
-
glob,
|
|
1903
|
-
posix
|
|
1904
|
-
}), result = {
|
|
1905
|
-
glob,
|
|
1906
|
-
state,
|
|
1907
|
-
regex,
|
|
1908
|
-
posix,
|
|
1909
|
-
input,
|
|
1910
|
-
output,
|
|
1911
|
-
match,
|
|
1912
|
-
isMatch
|
|
1913
|
-
};
|
|
1914
|
-
return ('function' == typeof opts.onResult && opts.onResult(result), !1 === isMatch) ? (result.isMatch = !1, !!returnObject && result) : isIgnored(input) ? ('function' == typeof opts.onIgnore && opts.onIgnore(result), result.isMatch = !1, !!returnObject && result) : ('function' == typeof opts.onMatch && opts.onMatch(result), !returnObject || result);
|
|
1915
|
-
};
|
|
1916
|
-
return returnState && (matcher.state = state), matcher;
|
|
1917
|
-
};
|
|
1918
|
-
picomatch.test = (input, regex, options, { glob, posix } = {})=>{
|
|
1919
|
-
if ('string' != typeof input) throw TypeError('Expected input to be a string');
|
|
1920
|
-
if ('' === input) return {
|
|
1921
|
-
isMatch: !1,
|
|
1922
|
-
output: ''
|
|
1923
|
-
};
|
|
1924
|
-
let opts = options || {}, format = opts.format || (posix ? utils.toPosixSlashes : null), match = input === glob, output = match && format ? format(input) : input;
|
|
1925
|
-
return !1 === match && (match = (output = format ? format(input) : input) === glob), (!1 === match || !0 === opts.capture) && (match = !0 === opts.matchBase || !0 === opts.basename ? picomatch.matchBase(input, regex, options, posix) : regex.exec(output)), {
|
|
1926
|
-
isMatch: !!match,
|
|
1927
|
-
match,
|
|
1928
|
-
output
|
|
1929
|
-
};
|
|
1930
|
-
}, picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options))=>(glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path.basename(input)), picomatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str), picomatch.parse = (pattern, options)=>Array.isArray(pattern) ? pattern.map((p)=>picomatch.parse(p, options)) : parse(pattern, {
|
|
1931
|
-
...options,
|
|
1932
|
-
fastpaths: !1
|
|
1933
|
-
}), picomatch.scan = (input, options)=>scan(input, options), picomatch.compileRe = (state, options, returnOutput = !1, returnState = !1)=>{
|
|
1934
|
-
if (!0 === returnOutput) return state.output;
|
|
1935
|
-
let opts = options || {}, prepend = opts.contains ? '' : '^', append = opts.contains ? '' : '$', source = `${prepend}(?:${state.output})${append}`;
|
|
1936
|
-
state && !0 === state.negated && (source = `^(?!${source}).*$`);
|
|
1937
|
-
let regex = picomatch.toRegex(source, options);
|
|
1938
|
-
return !0 === returnState && (regex.state = state), regex;
|
|
1939
|
-
}, picomatch.makeRe = (input, options = {}, returnOutput = !1, returnState = !1)=>{
|
|
1940
|
-
if (!input || 'string' != typeof input) throw TypeError('Expected a non-empty string');
|
|
1941
|
-
let parsed = {
|
|
1942
|
-
negated: !1,
|
|
1943
|
-
fastpaths: !0
|
|
1944
|
-
};
|
|
1945
|
-
return !1 !== options.fastpaths && ('.' === input[0] || '*' === input[0]) && (parsed.output = parse.fastpaths(input, options)), parsed.output || (parsed = parse(input, options)), picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
1946
|
-
}, picomatch.toRegex = (source, options)=>{
|
|
1947
|
-
try {
|
|
1948
|
-
let opts = options || {};
|
|
1949
|
-
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
1950
|
-
} catch (err) {
|
|
1951
|
-
if (options && !0 === options.debug) throw err;
|
|
1952
|
-
return /$^/;
|
|
1953
|
-
}
|
|
1954
|
-
}, picomatch.constants = constants, module.exports = picomatch;
|
|
1955
|
-
},
|
|
1956
|
-
"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/scan.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1957
|
-
let utils = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"), { 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.2/node_modules/picomatch/lib/constants.js"), isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH, depth = (token)=>{
|
|
1958
|
-
!0 !== token.isPrefix && (token.depth = token.isGlobstar ? 1 / 0 : 1);
|
|
1959
|
-
};
|
|
1960
|
-
module.exports = (input, options)=>{
|
|
1961
|
-
let prev, code, opts = options || {}, length = input.length - 1, scanToEnd = !0 === opts.parts || !0 === opts.scanToEnd, slashes = [], tokens = [], parts = [], str = input, index = -1, start = 0, lastIndex = 0, isBrace = !1, isBracket = !1, isGlob = !1, isExtglob = !1, isGlobstar = !1, braceEscaped = !1, backslashes = !1, negated = !1, negatedExtglob = !1, finished = !1, braces = 0, token = {
|
|
1962
|
-
value: '',
|
|
1963
|
-
depth: 0,
|
|
1964
|
-
isGlob: !1
|
|
1965
|
-
}, eos = ()=>index >= length, peek = ()=>str.charCodeAt(index + 1), advance = ()=>(prev = code, str.charCodeAt(++index));
|
|
1966
|
-
for(; index < length;){
|
|
1967
|
-
let next;
|
|
1968
|
-
if ((code = advance()) === CHAR_BACKWARD_SLASH) {
|
|
1969
|
-
backslashes = token.backslashes = !0, (code = advance()) === CHAR_LEFT_CURLY_BRACE && (braceEscaped = !0);
|
|
1970
|
-
continue;
|
|
1971
|
-
}
|
|
1972
|
-
if (!0 === braceEscaped || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1973
|
-
for(braces++; !0 !== eos() && (code = advance());){
|
|
1974
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1975
|
-
backslashes = token.backslashes = !0, advance();
|
|
1976
|
-
continue;
|
|
1977
|
-
}
|
|
1978
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1979
|
-
braces++;
|
|
1980
|
-
continue;
|
|
1981
|
-
}
|
|
1982
|
-
if (!0 !== braceEscaped && code === CHAR_DOT && (code = advance()) === CHAR_DOT || !0 !== braceEscaped && code === CHAR_COMMA) {
|
|
1983
|
-
if (isBrace = token.isBrace = !0, isGlob = token.isGlob = !0, finished = !0, !0 === scanToEnd) continue;
|
|
1984
|
-
break;
|
|
1985
|
-
}
|
|
1986
|
-
if (code === CHAR_RIGHT_CURLY_BRACE && 0 == --braces) {
|
|
1987
|
-
braceEscaped = !1, isBrace = token.isBrace = !0, finished = !0;
|
|
1988
|
-
break;
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
if (!0 === scanToEnd) continue;
|
|
1992
|
-
break;
|
|
1993
|
-
}
|
|
1994
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
1995
|
-
if (slashes.push(index), tokens.push(token), token = {
|
|
1996
|
-
value: '',
|
|
1997
|
-
depth: 0,
|
|
1998
|
-
isGlob: !1
|
|
1999
|
-
}, !0 === finished) continue;
|
|
2000
|
-
if (prev === CHAR_DOT && index === start + 1) {
|
|
2001
|
-
start += 2;
|
|
2002
|
-
continue;
|
|
2003
|
-
}
|
|
2004
|
-
lastIndex = index + 1;
|
|
2005
|
-
continue;
|
|
2006
|
-
}
|
|
2007
|
-
if (!0 !== opts.noext && !0 == (code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) && peek() === CHAR_LEFT_PARENTHESES) {
|
|
2008
|
-
if (isGlob = token.isGlob = !0, isExtglob = token.isExtglob = !0, finished = !0, code === CHAR_EXCLAMATION_MARK && index === start && (negatedExtglob = !0), !0 === scanToEnd) {
|
|
2009
|
-
for(; !0 !== eos() && (code = advance());){
|
|
2010
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
2011
|
-
backslashes = token.backslashes = !0, code = advance();
|
|
2012
|
-
continue;
|
|
2013
|
-
}
|
|
2014
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
2015
|
-
isGlob = token.isGlob = !0, finished = !0;
|
|
2016
|
-
break;
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
continue;
|
|
2020
|
-
}
|
|
2021
|
-
break;
|
|
2022
|
-
}
|
|
2023
|
-
if (code === CHAR_ASTERISK) {
|
|
2024
|
-
if (prev === CHAR_ASTERISK && (isGlobstar = token.isGlobstar = !0), isGlob = token.isGlob = !0, finished = !0, !0 === scanToEnd) continue;
|
|
2025
|
-
break;
|
|
2026
|
-
}
|
|
2027
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
2028
|
-
if (isGlob = token.isGlob = !0, finished = !0, !0 === scanToEnd) continue;
|
|
2029
|
-
break;
|
|
2030
|
-
}
|
|
2031
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
2032
|
-
for(; !0 !== eos() && (next = advance());){
|
|
2033
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
2034
|
-
backslashes = token.backslashes = !0, advance();
|
|
2035
|
-
continue;
|
|
2036
|
-
}
|
|
2037
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
2038
|
-
isBracket = token.isBracket = !0, isGlob = token.isGlob = !0, finished = !0;
|
|
2039
|
-
break;
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
if (!0 === scanToEnd) continue;
|
|
2043
|
-
break;
|
|
2044
|
-
}
|
|
2045
|
-
if (!0 !== opts.nonegate && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
2046
|
-
negated = token.negated = !0, start++;
|
|
2047
|
-
continue;
|
|
2048
|
-
}
|
|
2049
|
-
if (!0 !== opts.noparen && code === CHAR_LEFT_PARENTHESES) {
|
|
2050
|
-
if (isGlob = token.isGlob = !0, !0 === scanToEnd) {
|
|
2051
|
-
for(; !0 !== eos() && (code = advance());){
|
|
2052
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
2053
|
-
backslashes = token.backslashes = !0, code = advance();
|
|
2054
|
-
continue;
|
|
2055
|
-
}
|
|
2056
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
2057
|
-
finished = !0;
|
|
2058
|
-
break;
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
continue;
|
|
2062
|
-
}
|
|
2063
|
-
break;
|
|
2064
|
-
}
|
|
2065
|
-
if (!0 === isGlob) {
|
|
2066
|
-
if (finished = !0, !0 === scanToEnd) continue;
|
|
2067
|
-
break;
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
!0 === opts.noext && (isExtglob = !1, isGlob = !1);
|
|
2071
|
-
let base = str, prefix = '', glob = '';
|
|
2072
|
-
start > 0 && (prefix = str.slice(0, start), str = str.slice(start), lastIndex -= start), base && !0 === isGlob && lastIndex > 0 ? (base = str.slice(0, lastIndex), glob = str.slice(lastIndex)) : !0 === isGlob ? (base = '', glob = str) : base = str, base && '' !== base && '/' !== base && base !== str && isPathSeparator(base.charCodeAt(base.length - 1)) && (base = base.slice(0, -1)), !0 === opts.unescape && (glob && (glob = utils.removeBackslashes(glob)), base && !0 === backslashes && (base = utils.removeBackslashes(base)));
|
|
2073
|
-
let state = {
|
|
2074
|
-
prefix,
|
|
2075
|
-
input,
|
|
2076
|
-
start,
|
|
2077
|
-
base,
|
|
2078
|
-
glob,
|
|
2079
|
-
isBrace,
|
|
2080
|
-
isBracket,
|
|
2081
|
-
isGlob,
|
|
2082
|
-
isExtglob,
|
|
2083
|
-
isGlobstar,
|
|
2084
|
-
negated,
|
|
2085
|
-
negatedExtglob
|
|
2086
|
-
};
|
|
2087
|
-
if (!0 === opts.tokens && (state.maxDepth = 0, isPathSeparator(code) || tokens.push(token), state.tokens = tokens), !0 === opts.parts || !0 === opts.tokens) {
|
|
2088
|
-
let prevIndex;
|
|
2089
|
-
for(let idx = 0; idx < slashes.length; idx++){
|
|
2090
|
-
let n = prevIndex ? prevIndex + 1 : start, i = slashes[idx], value = input.slice(n, i);
|
|
2091
|
-
opts.tokens && (0 === idx && 0 !== start ? (tokens[idx].isPrefix = !0, tokens[idx].value = prefix) : tokens[idx].value = value, depth(tokens[idx]), state.maxDepth += tokens[idx].depth), (0 !== idx || '' !== value) && parts.push(value), prevIndex = i;
|
|
2092
|
-
}
|
|
2093
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
2094
|
-
let value = input.slice(prevIndex + 1);
|
|
2095
|
-
parts.push(value), opts.tokens && (tokens[tokens.length - 1].value = value, depth(tokens[tokens.length - 1]), state.maxDepth += tokens[tokens.length - 1].depth);
|
|
2096
|
-
}
|
|
2097
|
-
state.slashes = slashes, state.parts = parts;
|
|
2098
|
-
}
|
|
2099
|
-
return state;
|
|
2100
|
-
};
|
|
2101
|
-
},
|
|
2102
|
-
"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
2103
|
-
let path = __webpack_require__("path?aeb1"), win32 = 'win32' === process.platform, { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js");
|
|
2104
|
-
exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val), exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str), exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str), exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'), exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/'), exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match), exports.supportsLookbehinds = ()=>{
|
|
2105
|
-
let segs = process.version.slice(1).split('.').map(Number);
|
|
2106
|
-
return 3 === segs.length && !!(segs[0] >= 9) || 8 === segs[0] && !!(segs[1] >= 10);
|
|
2107
|
-
}, exports.isWindows = (options)=>options && 'boolean' == typeof options.windows ? options.windows : !0 === win32 || '\\' === path.sep, exports.escapeLast = (input, char, lastIdx)=>{
|
|
2108
|
-
let idx = input.lastIndexOf(char, lastIdx);
|
|
2109
|
-
return -1 === idx ? input : '\\' === input[idx - 1] ? exports.escapeLast(input, char, idx - 1) : `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
2110
|
-
}, exports.removePrefix = (input, state = {})=>{
|
|
2111
|
-
let output = input;
|
|
2112
|
-
return output.startsWith('./') && (output = output.slice(2), state.prefix = './'), output;
|
|
2113
|
-
}, exports.wrapOutput = (input, state = {}, options = {})=>{
|
|
2114
|
-
let prepend = options.contains ? '' : '^', append = options.contains ? '' : '$', output = `${prepend}(?:${input})${append}`;
|
|
2115
|
-
return !0 === state.negated && (output = `(?:^(?!${output}).*$)`), output;
|
|
2116
|
-
};
|
|
2117
|
-
},
|
|
2118
|
-
"../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
2119
|
-
let isNumber = __webpack_require__("../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js"), toRegexRange = (min, max, options)=>{
|
|
2120
|
-
if (!1 === isNumber(min)) throw TypeError('toRegexRange: expected the first argument to be a number');
|
|
2121
|
-
if (void 0 === max || min === max) return String(min);
|
|
2122
|
-
if (!1 === isNumber(max)) throw TypeError('toRegexRange: expected the second argument to be a number.');
|
|
2123
|
-
let opts = {
|
|
2124
|
-
relaxZeros: !0,
|
|
2125
|
-
...options
|
|
2126
|
-
};
|
|
2127
|
-
'boolean' == typeof opts.strictZeros && (opts.relaxZeros = !1 === opts.strictZeros);
|
|
2128
|
-
let cacheKey = min + ':' + max + '=' + String(opts.relaxZeros) + String(opts.shorthand) + String(opts.capture) + String(opts.wrap);
|
|
2129
|
-
if (toRegexRange.cache.hasOwnProperty(cacheKey)) return toRegexRange.cache[cacheKey].result;
|
|
2130
|
-
let a = Math.min(min, max), b = Math.max(min, max);
|
|
2131
|
-
if (1 === Math.abs(a - b)) {
|
|
2132
|
-
let result = min + '|' + max;
|
|
2133
|
-
return opts.capture ? `(${result})` : !1 === opts.wrap ? result : `(?:${result})`;
|
|
2134
|
-
}
|
|
2135
|
-
let isPadded = hasPadding(min) || hasPadding(max), state = {
|
|
2136
|
-
min,
|
|
2137
|
-
max,
|
|
2138
|
-
a,
|
|
2139
|
-
b
|
|
2140
|
-
}, positives = [], negatives = [];
|
|
2141
|
-
return isPadded && (state.isPadded = isPadded, state.maxLen = String(state.max).length), a < 0 && (negatives = splitToPatterns(b < 0 ? Math.abs(b) : 1, Math.abs(a), state, opts), a = state.a = 0), b >= 0 && (positives = splitToPatterns(a, b, state, opts)), state.negatives = negatives, state.positives = positives, state.result = collatePatterns(negatives, positives, opts), !0 === opts.capture ? state.result = `(${state.result})` : !1 !== opts.wrap && positives.length + negatives.length > 1 && (state.result = `(?:${state.result})`), toRegexRange.cache[cacheKey] = state, state.result;
|
|
2142
|
-
};
|
|
2143
|
-
function collatePatterns(neg, pos, options) {
|
|
2144
|
-
let onlyNegative = filterPatterns(neg, pos, '-', !1, options) || [], onlyPositive = filterPatterns(pos, neg, '', !1, options) || [], intersected = filterPatterns(neg, pos, '-?', !0, options) || [];
|
|
2145
|
-
return onlyNegative.concat(intersected).concat(onlyPositive).join('|');
|
|
2146
|
-
}
|
|
2147
|
-
function splitToRanges(min, max) {
|
|
2148
|
-
let nines = 1, zeros = 1, stop = countNines(min, 1), stops = new Set([
|
|
2149
|
-
max
|
|
2150
|
-
]);
|
|
2151
|
-
for(; min <= stop && stop <= max;)stops.add(stop), nines += 1, stop = countNines(min, nines);
|
|
2152
|
-
for(stop = countZeros(max + 1, zeros) - 1; min < stop && stop <= max;)stops.add(stop), zeros += 1, stop = countZeros(max + 1, zeros) - 1;
|
|
2153
|
-
return (stops = [
|
|
2154
|
-
...stops
|
|
2155
|
-
]).sort(compare), stops;
|
|
2156
|
-
}
|
|
2157
|
-
function rangeToPattern(start, stop, options) {
|
|
2158
|
-
if (start === stop) return {
|
|
2159
|
-
pattern: start,
|
|
2160
|
-
count: [],
|
|
2161
|
-
digits: 0
|
|
2162
|
-
};
|
|
2163
|
-
let zipped = zip(start, stop), digits = zipped.length, pattern = '', count = 0;
|
|
2164
|
-
for(let i = 0; i < digits; i++){
|
|
2165
|
-
let [startDigit, stopDigit] = zipped[i];
|
|
2166
|
-
startDigit === stopDigit ? pattern += startDigit : '0' !== startDigit || '9' !== stopDigit ? pattern += toCharacterClass(startDigit, stopDigit, options) : count++;
|
|
2167
|
-
}
|
|
2168
|
-
return count && (pattern += !0 === options.shorthand ? '\\d' : '[0-9]'), {
|
|
2169
|
-
pattern,
|
|
2170
|
-
count: [
|
|
2171
|
-
count
|
|
2172
|
-
],
|
|
2173
|
-
digits
|
|
2174
|
-
};
|
|
2175
|
-
}
|
|
2176
|
-
function splitToPatterns(min, max, tok, options) {
|
|
2177
|
-
let prev, ranges = splitToRanges(min, max), tokens = [], start = min;
|
|
2178
|
-
for(let i = 0; i < ranges.length; i++){
|
|
2179
|
-
let max = ranges[i], obj = rangeToPattern(String(start), String(max), options), zeros = '';
|
|
2180
|
-
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
2181
|
-
prev.count.length > 1 && prev.count.pop(), prev.count.push(obj.count[0]), prev.string = prev.pattern + toQuantifier(prev.count), start = max + 1;
|
|
2182
|
-
continue;
|
|
2183
|
-
}
|
|
2184
|
-
tok.isPadded && (zeros = padZeros(max, tok, options)), obj.string = zeros + obj.pattern + toQuantifier(obj.count), tokens.push(obj), start = max + 1, prev = obj;
|
|
2185
|
-
}
|
|
2186
|
-
return tokens;
|
|
2187
|
-
}
|
|
2188
|
-
function filterPatterns(arr, comparison, prefix, intersection, options) {
|
|
2189
|
-
let result = [];
|
|
2190
|
-
for (let ele of arr){
|
|
2191
|
-
let { string } = ele;
|
|
2192
|
-
intersection || contains(comparison, 'string', string) || result.push(prefix + string), intersection && contains(comparison, 'string', string) && result.push(prefix + string);
|
|
2193
|
-
}
|
|
2194
|
-
return result;
|
|
2195
|
-
}
|
|
2196
|
-
function zip(a, b) {
|
|
2197
|
-
let arr = [];
|
|
2198
|
-
for(let i = 0; i < a.length; i++)arr.push([
|
|
2199
|
-
a[i],
|
|
2200
|
-
b[i]
|
|
2201
|
-
]);
|
|
2202
|
-
return arr;
|
|
2203
|
-
}
|
|
2204
|
-
function compare(a, b) {
|
|
2205
|
-
return a > b ? 1 : b > a ? -1 : 0;
|
|
2206
|
-
}
|
|
2207
|
-
function contains(arr, key, val) {
|
|
2208
|
-
return arr.some((ele)=>ele[key] === val);
|
|
2209
|
-
}
|
|
2210
|
-
function countNines(min, len) {
|
|
2211
|
-
return Number(String(min).slice(0, -len) + '9'.repeat(len));
|
|
2212
|
-
}
|
|
2213
|
-
function countZeros(integer, zeros) {
|
|
2214
|
-
return integer - integer % Math.pow(10, zeros);
|
|
2215
|
-
}
|
|
2216
|
-
function toQuantifier(digits) {
|
|
2217
|
-
let [start = 0, stop = ''] = digits;
|
|
2218
|
-
return stop || start > 1 ? `{${start + (stop ? ',' + stop : '')}}` : '';
|
|
2219
|
-
}
|
|
2220
|
-
function toCharacterClass(a, b, options) {
|
|
2221
|
-
return `[${a}${b - a == 1 ? '' : '-'}${b}]`;
|
|
2222
|
-
}
|
|
2223
|
-
function hasPadding(str) {
|
|
2224
|
-
return /^-?(0+)\d/.test(str);
|
|
2225
|
-
}
|
|
2226
|
-
function padZeros(value, tok, options) {
|
|
2227
|
-
if (!tok.isPadded) return value;
|
|
2228
|
-
let diff = Math.abs(tok.maxLen - String(value).length), relax = !1 !== options.relaxZeros;
|
|
2229
|
-
switch(diff){
|
|
2230
|
-
case 0:
|
|
2231
|
-
return '';
|
|
2232
|
-
case 1:
|
|
2233
|
-
return relax ? '0?' : '0';
|
|
2234
|
-
case 2:
|
|
2235
|
-
return relax ? '0{0,2}' : '00';
|
|
2236
|
-
default:
|
|
2237
|
-
return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
toRegexRange.cache = {}, toRegexRange.clearCache = ()=>toRegexRange.cache = {}, module.exports = toRegexRange;
|
|
2241
|
-
}
|
|
2242
|
-
});
|
|
2243
|
-
let upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i, defaultAgents = {
|
|
2244
|
-
http: new node_http.Agent({
|
|
2245
|
-
keepAlive: !0,
|
|
2246
|
-
maxSockets: 256,
|
|
2247
|
-
maxFreeSockets: 64
|
|
2248
|
-
}),
|
|
2249
|
-
https: new node_https.Agent({
|
|
2250
|
-
keepAlive: !0,
|
|
2251
|
-
maxSockets: 256,
|
|
2252
|
-
maxFreeSockets: 64
|
|
2253
|
-
})
|
|
2254
|
-
}, isSSL = /^https|wss/, HTTP2_HEADER_BLACKLIST = [
|
|
2255
|
-
":method",
|
|
2256
|
-
":path",
|
|
2257
|
-
":scheme",
|
|
2258
|
-
":authority"
|
|
2259
|
-
];
|
|
2260
|
-
function setupOutgoing(outgoing, options, req, forward) {
|
|
2261
|
-
for (let e of (outgoing.port = options[forward || "target"].port || (isSSL.test(options[forward || "target"].protocol ?? "http") ? 443 : 80), [
|
|
2262
|
-
"host",
|
|
2263
|
-
"hostname",
|
|
2264
|
-
"socketPath",
|
|
2265
|
-
"pfx",
|
|
2266
|
-
"key",
|
|
2267
|
-
"passphrase",
|
|
2268
|
-
"cert",
|
|
2269
|
-
"ca",
|
|
2270
|
-
"ciphers",
|
|
2271
|
-
"secureProtocol"
|
|
2272
|
-
])){
|
|
2273
|
-
let value = options[forward || "target"][e];
|
|
2274
|
-
void 0 !== value && (outgoing[e] = value);
|
|
2275
|
-
}
|
|
2276
|
-
if (void 0 === outgoing.host && "string" == typeof outgoing.hostname) {
|
|
2277
|
-
let bracketedHost = outgoing.hostname.includes(":") && !outgoing.hostname.startsWith("[") ? `[${outgoing.hostname}]` : outgoing.hostname;
|
|
2278
|
-
outgoing.host = outgoing.port ? `${bracketedHost}:${outgoing.port}` : bracketedHost;
|
|
2279
|
-
}
|
|
2280
|
-
if (outgoing.method = options.method || req.method, outgoing.headers = {
|
|
2281
|
-
...req.headers
|
|
2282
|
-
}, req.headers?.[":authority"] && (outgoing.headers.host = req.headers[":authority"]), options.headers) for (let key of Object.keys(options.headers))outgoing.headers[key] = options.headers[key];
|
|
2283
|
-
if (req.httpVersionMajor > 1) for (let header of HTTP2_HEADER_BLACKLIST)delete outgoing.headers[header];
|
|
2284
|
-
if (options.auth && (outgoing.auth = options.auth), options.ca && (outgoing.ca = options.ca), isSSL.test(options[forward || "target"].protocol ?? "http") && (outgoing.rejectUnauthorized = void 0 === options.secure || options.secure), void 0 !== options.agent) outgoing.agent = options.agent || !1;
|
|
2285
|
-
else if (req.httpVersionMajor > 1 || upgradeHeader.test(req.headers.connection || "")) outgoing.agent = !1;
|
|
2286
|
-
else {
|
|
2287
|
-
let targetProto = options[forward || "target"].protocol ?? "http";
|
|
2288
|
-
outgoing.agent = isSSL.test(targetProto) ? defaultAgents.https : defaultAgents.http;
|
|
2289
|
-
}
|
|
2290
|
-
outgoing.localAddress = options.localAddress, !outgoing.agent && (outgoing.headers = outgoing.headers || {}, "string" == typeof outgoing.headers.connection && upgradeHeader.test(outgoing.headers.connection) || (outgoing.headers.connection = "close"));
|
|
2291
|
-
let target = options[forward || "target"], targetPath = target && !1 !== options.prependPath && target.pathname || "", targetSearch = target instanceof URL && !1 !== options.prependPath && target.search || "", reqUrl = req.url || "", qIdx = reqUrl.indexOf("?"), reqPath = -1 === qIdx ? reqUrl : reqUrl.slice(0, qIdx), reqSearch = -1 === qIdx ? "" : reqUrl.slice(qIdx), normalizedPath = reqPath ? "/" === reqPath[0] ? reqPath : "/" + reqPath : "/", outgoingPath = options.toProxy ? "/" + reqUrl : normalizedPath + reqSearch, fullPath = joinURL(targetPath, outgoingPath = options.ignorePath ? "" : outgoingPath);
|
|
2292
|
-
return targetSearch && (fullPath = fullPath.includes("?") ? fullPath.replace("?", targetSearch + "&") : fullPath + targetSearch), outgoing.path = fullPath, options.changeOrigin && (outgoing.headers.host = requiresPort(outgoing.port, options[forward || "target"].protocol) && !hasPort(outgoing.host) ? outgoing.host + ":" + outgoing.port : outgoing.host ?? void 0), outgoing;
|
|
2293
|
-
}
|
|
2294
|
-
function joinURL(base, path) {
|
|
2295
|
-
if (!base || "/" === base) return path || "/";
|
|
2296
|
-
if (!path || "/" === path) return base || "/";
|
|
2297
|
-
let baseHasTrailing = "/" === base[base.length - 1], pathHasLeading = "/" === path[0];
|
|
2298
|
-
return baseHasTrailing && pathHasLeading ? base + path.slice(1) : baseHasTrailing || pathHasLeading ? base + path : base + "/" + path;
|
|
2299
|
-
}
|
|
2300
|
-
function setupSocket(socket) {
|
|
2301
|
-
return socket.setTimeout(0), socket.setNoDelay(!0), socket.setKeepAlive(!0, 0), socket;
|
|
2302
|
-
}
|
|
2303
|
-
function getPort(req) {
|
|
2304
|
-
let hostHeader = req.headers[":authority"] || req.headers.host, res = hostHeader ? hostHeader.match(/:(\d+)/) : "";
|
|
2305
|
-
return res ? res[1] : hasEncryptedConnection(req) ? "443" : "80";
|
|
2306
|
-
}
|
|
2307
|
-
function hasEncryptedConnection(req) {
|
|
2308
|
-
let socket = req.socket;
|
|
2309
|
-
return !!socket && "encrypted" in socket && socket.encrypted;
|
|
2310
|
-
}
|
|
2311
|
-
function rewriteCookieProperty(header, config, property) {
|
|
2312
|
-
return Array.isArray(header) ? header.map(function(headerElement) {
|
|
2313
|
-
return rewriteCookieProperty(headerElement, config, property);
|
|
2314
|
-
}) : header.replace(RegExp(String.raw`(;\s*` + property + "=)([^;]+)", "i"), function(match, prefix, previousValue) {
|
|
2315
|
-
let newValue;
|
|
2316
|
-
if (previousValue in config) newValue = config[previousValue];
|
|
2317
|
-
else {
|
|
2318
|
-
if (!("*" in config)) return match;
|
|
2319
|
-
newValue = config["*"];
|
|
2320
|
-
}
|
|
2321
|
-
return newValue ? prefix + newValue : "";
|
|
2322
|
-
});
|
|
2323
|
-
}
|
|
2324
|
-
function hasPort(host) {
|
|
2325
|
-
return !!host && !!~host.indexOf(":");
|
|
2326
|
-
}
|
|
2327
|
-
function requiresPort(_port, _protocol) {
|
|
2328
|
-
let protocol = _protocol?.split(":")[0], port = +_port;
|
|
2329
|
-
if (!port) return !1;
|
|
2330
|
-
switch(protocol){
|
|
2331
|
-
case "http":
|
|
2332
|
-
case "ws":
|
|
2333
|
-
return 80 !== port;
|
|
2334
|
-
case "https":
|
|
2335
|
-
case "wss":
|
|
2336
|
-
return 443 !== port;
|
|
2337
|
-
case "ftp":
|
|
2338
|
-
return 21 !== port;
|
|
2339
|
-
case "gopher":
|
|
2340
|
-
return 70 !== port;
|
|
2341
|
-
case "file":
|
|
2342
|
-
return !1;
|
|
2343
|
-
}
|
|
2344
|
-
return 0 !== port;
|
|
2345
|
-
}
|
|
2346
|
-
let redirectRegex = /^201|30([12378])$/, webOutgoingMiddleware = [
|
|
2347
|
-
(req, res, proxyRes)=>{
|
|
2348
|
-
("1.0" === req.httpVersion || req.httpVersionMajor >= 2 || 204 === proxyRes.statusCode || 304 === proxyRes.statusCode) && delete proxyRes.headers["transfer-encoding"];
|
|
2349
|
-
},
|
|
2350
|
-
(req, res, proxyRes)=>{
|
|
2351
|
-
"1.0" === req.httpVersion ? proxyRes.headers.connection = req.headers.connection || "close" : req.httpVersionMajor < 2 && !proxyRes.headers.connection ? proxyRes.headers.connection = req.headers.connection || "keep-alive" : req.httpVersionMajor >= 2 && delete proxyRes.headers.connection;
|
|
2352
|
-
},
|
|
2353
|
-
(req, res, proxyRes, options)=>{
|
|
2354
|
-
if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite) && proxyRes.headers.location && redirectRegex.test(String(proxyRes.statusCode))) {
|
|
2355
|
-
let target = _toURL(options.target), u = new URL(proxyRes.headers.location, target);
|
|
2356
|
-
target.host === u.host && (options.hostRewrite ? u.host = options.hostRewrite : options.autoRewrite && (req.headers[":authority"] ? u.host = req.headers[":authority"] : req.headers.host && (u.host = req.headers.host)), options.protocolRewrite && (u.protocol = options.protocolRewrite), proxyRes.headers.location = u.toString());
|
|
2357
|
-
}
|
|
2358
|
-
},
|
|
2359
|
-
(req, res, proxyRes, options)=>{
|
|
2360
|
-
let rawHeaderKeyMap, rewriteCookieDomainConfig = "string" == typeof options.cookieDomainRewrite ? {
|
|
2361
|
-
"*": options.cookieDomainRewrite
|
|
2362
|
-
} : options.cookieDomainRewrite, rewriteCookiePathConfig = "string" == typeof options.cookiePathRewrite ? {
|
|
2363
|
-
"*": options.cookiePathRewrite
|
|
2364
|
-
} : options.cookiePathRewrite, preserveHeaderKeyCase = options.preserveHeaderKeyCase;
|
|
2365
|
-
if (preserveHeaderKeyCase && void 0 !== proxyRes.rawHeaders) {
|
|
2366
|
-
rawHeaderKeyMap = {};
|
|
2367
|
-
for(let i = 0; i < proxyRes.rawHeaders.length; i += 2){
|
|
2368
|
-
let key = proxyRes.rawHeaders[i];
|
|
2369
|
-
rawHeaderKeyMap[key.toLowerCase()] = key;
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
for (let key1 of Object.keys(proxyRes.headers)){
|
|
2373
|
-
let header1 = proxyRes.headers[key1];
|
|
2374
|
-
preserveHeaderKeyCase && rawHeaderKeyMap && (key1 = rawHeaderKeyMap[key1] || key1);
|
|
2375
|
-
var key = key1, header = header1;
|
|
2376
|
-
if (void 0 !== header && String(key).trim()) {
|
|
2377
|
-
rewriteCookieDomainConfig && "set-cookie" === key.toLowerCase() && (header = rewriteCookieProperty(header, rewriteCookieDomainConfig, "domain")), rewriteCookiePathConfig && "set-cookie" === key.toLowerCase() && (header = rewriteCookieProperty(header, rewriteCookiePathConfig, "path"));
|
|
2378
|
-
try {
|
|
2379
|
-
res.setHeader(String(key).trim(), header);
|
|
2380
|
-
} catch {}
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
},
|
|
2384
|
-
(req, res, proxyRes)=>{
|
|
2385
|
-
res.statusCode = proxyRes.statusCode, proxyRes.statusMessage && req.httpVersionMajor < 2 && (res.statusMessage = proxyRes.statusMessage);
|
|
2386
|
-
}
|
|
2387
|
-
];
|
|
2388
|
-
function _toURL(target) {
|
|
2389
|
-
if (target instanceof URL) return target;
|
|
2390
|
-
if ("string" == typeof target) return new URL(target);
|
|
2391
|
-
let protocol = target.protocol || "http:", host = target.host || target.hostname || "localhost", port = target.port;
|
|
2392
|
-
return new URL(`${protocol}//${host}${port ? ":" + port : ""}`);
|
|
2393
|
-
}
|
|
2394
|
-
let redirectStatuses = new Set([
|
|
2395
|
-
301,
|
|
2396
|
-
302,
|
|
2397
|
-
303,
|
|
2398
|
-
307,
|
|
2399
|
-
308
|
|
2400
|
-
]), webIncomingMiddleware = [
|
|
2401
|
-
(req)=>{
|
|
2402
|
-
"DELETE" !== req.method && "OPTIONS" !== req.method || req.headers["content-length"] || req.headers["transfer-encoding"] || (req.headers["content-length"] = "0");
|
|
2403
|
-
},
|
|
2404
|
-
(req, res, options)=>{
|
|
2405
|
-
options.timeout && req.socket.setTimeout(options.timeout, ()=>{
|
|
2406
|
-
req.socket.destroy();
|
|
2407
|
-
});
|
|
2408
|
-
},
|
|
2409
|
-
(req, res, options)=>{
|
|
2410
|
-
if (!options.xfwd) return;
|
|
2411
|
-
let encrypted = req.isSpdy || hasEncryptedConnection(req), values = {
|
|
2412
|
-
for: req.connection.remoteAddress || req.socket.remoteAddress,
|
|
2413
|
-
port: getPort(req),
|
|
2414
|
-
proto: encrypted ? "https" : "http"
|
|
2415
|
-
};
|
|
2416
|
-
for (let header of [
|
|
2417
|
-
"for",
|
|
2418
|
-
"port",
|
|
2419
|
-
"proto"
|
|
2420
|
-
]){
|
|
2421
|
-
let key = "x-forwarded-" + header;
|
|
2422
|
-
req.headers[key] || void 0 === values[header] || (req.headers[key] = values[header]);
|
|
2423
|
-
}
|
|
2424
|
-
req.headers["x-forwarded-host"] = req.headers["x-forwarded-host"] || req.headers[":authority"] || req.headers.host || "";
|
|
2425
|
-
},
|
|
2426
|
-
(req, res, options, server, head, callback)=>{
|
|
2427
|
-
let bodyBuffer;
|
|
2428
|
-
server.emit("start", req, res, options.target || options.forward);
|
|
2429
|
-
let maxRedirects = "number" == typeof options.followRedirects ? options.followRedirects : 5 * !!options.followRedirects;
|
|
2430
|
-
if (options.forward) {
|
|
2431
|
-
let forwardReq = (isSSL.test(options.forward.protocol || "http") ? node_https : node_http).request(setupOutgoing(options.ssl || {}, options, req, "forward")), forwardError = createErrorHandler(forwardReq, options.forward);
|
|
2432
|
-
if (req.on("error", forwardError), forwardReq.on("error", forwardError), (options.buffer || req).pipe(forwardReq), !options.target) return void res.end();
|
|
2433
|
-
}
|
|
2434
|
-
let proxyReq = (isSSL.test(options.target.protocol || "http") ? node_https : node_http).request(setupOutgoing(options.ssl || {}, options, req));
|
|
2435
|
-
proxyReq.on("socket", (_socket)=>{
|
|
2436
|
-
server && !proxyReq.getHeader("expect") && server.emit("proxyReq", proxyReq, req, res, options);
|
|
2437
|
-
}), options.proxyTimeout && proxyReq.setTimeout(options.proxyTimeout, function() {
|
|
2438
|
-
proxyReq.destroy();
|
|
2439
|
-
}), res.on("close", function() {
|
|
2440
|
-
res.writableFinished || proxyReq.destroy();
|
|
2441
|
-
});
|
|
2442
|
-
let proxyError = createErrorHandler(proxyReq, options.target);
|
|
2443
|
-
function createErrorHandler(proxyReq, url) {
|
|
2444
|
-
return function proxyError(err) {
|
|
2445
|
-
if (!req.socket?.writable && "ECONNRESET" === err.code) return server.emit("econnreset", err, req, res, url), proxyReq.destroy();
|
|
2446
|
-
callback ? callback(err, req, res, url) : server.emit("error", err, req, res, url);
|
|
2447
|
-
};
|
|
2448
|
-
}
|
|
2449
|
-
if (req.on("error", proxyError), proxyReq.on("error", proxyError), maxRedirects > 0) {
|
|
2450
|
-
let chunks = [], source = options.buffer || req;
|
|
2451
|
-
source.on("data", (chunk)=>{
|
|
2452
|
-
chunks.push("string" == typeof chunk ? Buffer.from(chunk) : chunk), proxyReq.write(chunk);
|
|
2453
|
-
}), source.on("end", ()=>{
|
|
2454
|
-
bodyBuffer = Buffer.concat(chunks), proxyReq.end();
|
|
2455
|
-
}), source.on("error", (err)=>{
|
|
2456
|
-
proxyReq.destroy(err);
|
|
2457
|
-
});
|
|
2458
|
-
} else proxyReq.on("socket", (socket)=>{
|
|
2459
|
-
socket.pending ? socket.on("connect", ()=>(options.buffer || req).pipe(proxyReq)) : (options.buffer || req).pipe(proxyReq);
|
|
2460
|
-
});
|
|
2461
|
-
function handleResponse(proxyRes, redirectCount, currentUrl) {
|
|
2462
|
-
let statusCode = proxyRes.statusCode;
|
|
2463
|
-
if (maxRedirects > 0 && redirectStatuses.has(statusCode) && redirectCount < maxRedirects && proxyRes.headers.location) {
|
|
2464
|
-
proxyRes.resume();
|
|
2465
|
-
let location = new URL(proxyRes.headers.location, currentUrl), preserveMethod = 307 === statusCode || 308 === statusCode, redirectMethod = preserveMethod && req.method || "GET", isHTTPS = isSSL.test(location.protocol), agent = isHTTPS ? node_https : node_http, redirectHeaders = {
|
|
2466
|
-
...req.headers
|
|
2467
|
-
};
|
|
2468
|
-
options.headers && Object.assign(redirectHeaders, options.headers), redirectHeaders.host = location.host, location.host !== currentUrl.host && (delete redirectHeaders.authorization, delete redirectHeaders.cookie), preserveMethod || (delete redirectHeaders["content-length"], delete redirectHeaders["content-type"], delete redirectHeaders["transfer-encoding"]);
|
|
2469
|
-
let redirectOpts = {
|
|
2470
|
-
hostname: location.hostname,
|
|
2471
|
-
port: location.port || (isHTTPS ? 443 : 80),
|
|
2472
|
-
path: location.pathname + location.search,
|
|
2473
|
-
method: redirectMethod,
|
|
2474
|
-
headers: redirectHeaders,
|
|
2475
|
-
agent: options.agent || !1
|
|
2476
|
-
};
|
|
2477
|
-
isHTTPS && (redirectOpts.rejectUnauthorized = void 0 === options.secure || options.secure);
|
|
2478
|
-
let redirectReq = agent.request(redirectOpts);
|
|
2479
|
-
server && !redirectReq.getHeader("expect") && server.emit("proxyReq", redirectReq, req, res, options), options.proxyTimeout && redirectReq.setTimeout(options.proxyTimeout, ()=>{
|
|
2480
|
-
redirectReq.destroy();
|
|
2481
|
-
});
|
|
2482
|
-
let redirectError = createErrorHandler(redirectReq, location);
|
|
2483
|
-
redirectReq.on("error", redirectError), redirectReq.on("response", (nextRes)=>{
|
|
2484
|
-
handleResponse(nextRes, redirectCount + 1, location);
|
|
2485
|
-
}), preserveMethod && bodyBuffer && bodyBuffer.length > 0 ? redirectReq.end(bodyBuffer) : redirectReq.end();
|
|
2486
|
-
return;
|
|
2487
|
-
}
|
|
2488
|
-
if (server && server.emit("proxyRes", proxyRes, req, res), !res.headersSent && !options.selfHandleResponse) {
|
|
2489
|
-
for (let pass of webOutgoingMiddleware)if (pass(req, res, proxyRes, options)) break;
|
|
2490
|
-
}
|
|
2491
|
-
res.finished ? server && server.emit("end", req, res, proxyRes) : (res.on("close", function() {
|
|
2492
|
-
proxyRes.destroy();
|
|
2493
|
-
}), proxyRes.on("close", function() {
|
|
2494
|
-
proxyRes.complete || res.destroyed || res.destroy();
|
|
2495
|
-
}), proxyRes.on("error", function(err) {
|
|
2496
|
-
res.destroyed || res.destroy(err), server.listenerCount("error") > 0 && server.emit("error", err, req, res, currentUrl);
|
|
2497
|
-
}), proxyRes.on("end", function() {
|
|
2498
|
-
server && server.emit("end", req, res, proxyRes);
|
|
2499
|
-
}), options.selfHandleResponse || proxyRes.pipe(res));
|
|
2500
|
-
}
|
|
2501
|
-
proxyReq.on("response", function(proxyRes) {
|
|
2502
|
-
handleResponse(proxyRes, 0, options.target);
|
|
2503
|
-
});
|
|
2504
|
-
}
|
|
2505
|
-
], websocketIncomingMiddleware = [
|
|
2506
|
-
(req, socket)=>{
|
|
2507
|
-
if ("GET" !== req.method || !req.headers.upgrade || "websocket" !== req.headers.upgrade.toLowerCase()) return socket.destroy(), !0;
|
|
2508
|
-
},
|
|
2509
|
-
(req, socket, options)=>{
|
|
2510
|
-
if (!options.xfwd) return;
|
|
2511
|
-
let values = {
|
|
2512
|
-
for: req.connection.remoteAddress || req.socket.remoteAddress,
|
|
2513
|
-
port: getPort(req),
|
|
2514
|
-
proto: hasEncryptedConnection(req) ? "wss" : "ws"
|
|
2515
|
-
};
|
|
2516
|
-
for (let header of [
|
|
2517
|
-
"for",
|
|
2518
|
-
"port",
|
|
2519
|
-
"proto"
|
|
2520
|
-
]){
|
|
2521
|
-
let key = "x-forwarded-" + header;
|
|
2522
|
-
req.headers[key] || void 0 === values[header] || (req.headers[key] = values[header]);
|
|
2523
|
-
}
|
|
2524
|
-
},
|
|
2525
|
-
(req, socket, options, server, head, callback)=>{
|
|
2526
|
-
let createHttpHeader = function(line, headers) {
|
|
2527
|
-
return Object.keys(headers).reduce(function(head, key) {
|
|
2528
|
-
let value = headers[key];
|
|
2529
|
-
if (!Array.isArray(value)) return head.push(key + ": " + value), head;
|
|
2530
|
-
for (let element of value)head.push(key + ": " + element);
|
|
2531
|
-
return head;
|
|
2532
|
-
}, [
|
|
2533
|
-
line
|
|
2534
|
-
]).join("\r\n") + "\r\n\r\n";
|
|
2535
|
-
};
|
|
2536
|
-
setupSocket(socket), head && head.length > 0 && socket.unshift(head), socket.on("error", onSocketError);
|
|
2537
|
-
let proxyReq = (isSSL.test(options.target.protocol || "http") ? node_https : node_http).request(setupOutgoing(options.ssl || {}, options, req));
|
|
2538
|
-
function onSocketError(err) {
|
|
2539
|
-
callback ? callback(err, req, socket) : server.emit("error", err, req, socket), proxyReq.destroy();
|
|
2540
|
-
}
|
|
2541
|
-
function onOutgoingError(err) {
|
|
2542
|
-
callback ? callback(err, req, socket) : server.emit("error", err, req, socket), socket.end();
|
|
2543
|
-
}
|
|
2544
|
-
server && server.emit("proxyReqWs", proxyReq, req, socket, options, head), proxyReq.on("error", onOutgoingError), proxyReq.on("response", function(res) {
|
|
2545
|
-
res.upgrade || (!socket.destroyed && socket.writable ? (socket.write(createHttpHeader("HTTP/" + res.httpVersion + " " + res.statusCode + " " + res.statusMessage, res.headers)), res.on("error", onOutgoingError), res.pipe(socket)) : res.resume());
|
|
2546
|
-
}), proxyReq.on("upgrade", function(proxyRes, proxySocket, proxyHead) {
|
|
2547
|
-
proxySocket.on("error", onOutgoingError), proxySocket.on("end", function() {
|
|
2548
|
-
server.emit("close", proxyRes, proxySocket, proxyHead);
|
|
2549
|
-
}), socket.removeListener("error", onSocketError), socket.on("error", function() {
|
|
2550
|
-
proxySocket.end();
|
|
2551
|
-
}), setupSocket(proxySocket), proxyHead && proxyHead.length > 0 && proxySocket.unshift(proxyHead), socket.write(createHttpHeader("HTTP/1.1 101 Switching Protocols", proxyRes.headers)), proxySocket.pipe(socket).pipe(proxySocket), server.emit("open", proxySocket), server.emit("proxySocket", proxySocket);
|
|
2552
|
-
}), proxyReq.end();
|
|
2553
|
-
}
|
|
2554
|
-
];
|
|
2555
|
-
var ProxyServer = class extends EventEmitter {
|
|
2556
|
-
_server;
|
|
2557
|
-
_webPasses = [
|
|
2558
|
-
...webIncomingMiddleware
|
|
2559
|
-
];
|
|
2560
|
-
_wsPasses = [
|
|
2561
|
-
...websocketIncomingMiddleware
|
|
2562
|
-
];
|
|
2563
|
-
options;
|
|
2564
|
-
web;
|
|
2565
|
-
ws;
|
|
2566
|
-
constructor(options = {}){
|
|
2567
|
-
super(), this.options = options || {}, this.options.prependPath = !1 !== options.prependPath, this.web = _createProxyFn("web", this), this.ws = _createProxyFn("ws", this);
|
|
2568
|
-
}
|
|
2569
|
-
listen(port, hostname, listeningListener) {
|
|
2570
|
-
let closure = (req, res)=>this.web(req, res);
|
|
2571
|
-
if (this.options.http2) {
|
|
2572
|
-
if (!this.options.ssl) throw Error("HTTP/2 requires ssl option");
|
|
2573
|
-
this._server = node_http2.createSecureServer({
|
|
2574
|
-
...this.options.ssl,
|
|
2575
|
-
allowHTTP1: !0
|
|
2576
|
-
}, closure);
|
|
2577
|
-
} else this.options.ssl ? this._server = node_https.createServer(this.options.ssl, closure) : this._server = node_http.createServer(closure);
|
|
2578
|
-
return this.options.ws && this._server.on("upgrade", (req, socket, head)=>{
|
|
2579
|
-
this.ws(req, socket, this.options, head).catch(()=>{});
|
|
2580
|
-
}), this._server.listen(port, hostname, listeningListener), this;
|
|
2581
|
-
}
|
|
2582
|
-
close(callback) {
|
|
2583
|
-
this._server && this._server.close((...args)=>{
|
|
2584
|
-
this._server = void 0, callback && Reflect.apply(callback, void 0, args);
|
|
2585
|
-
});
|
|
2586
|
-
}
|
|
2587
|
-
before(type, passName, pass) {
|
|
2588
|
-
if ("ws" !== type && "web" !== type) throw Error("type must be `web` or `ws`");
|
|
2589
|
-
let passes = this._getPasses(type), i = !1;
|
|
2590
|
-
for (let [idx, v] of passes.entries())v.name === passName && (i = idx);
|
|
2591
|
-
if (!1 === i) throw Error("No such pass");
|
|
2592
|
-
passes.splice(i, 0, pass);
|
|
2593
|
-
}
|
|
2594
|
-
after(type, passName, pass) {
|
|
2595
|
-
if ("ws" !== type && "web" !== type) throw Error("type must be `web` or `ws`");
|
|
2596
|
-
let passes = this._getPasses(type), i = !1;
|
|
2597
|
-
for (let [idx, v] of passes.entries())v.name === passName && (i = idx);
|
|
2598
|
-
if (!1 === i) throw Error("No such pass");
|
|
2599
|
-
passes.splice(i++, 0, pass);
|
|
2600
|
-
}
|
|
2601
|
-
_getPasses(type) {
|
|
2602
|
-
return "ws" === type ? this._wsPasses : this._webPasses;
|
|
2603
|
-
}
|
|
2604
|
-
};
|
|
2605
|
-
function createProxyServer(options = {}) {
|
|
2606
|
-
return new ProxyServer(options);
|
|
2607
|
-
}
|
|
2608
|
-
function _createProxyFn(type, server) {
|
|
2609
|
-
return function(req, res, opts, head) {
|
|
2610
|
-
let _resolve, _reject, requestOptions = {
|
|
2611
|
-
...opts,
|
|
2612
|
-
...server.options
|
|
2613
|
-
};
|
|
2614
|
-
for (let key of [
|
|
2615
|
-
"target",
|
|
2616
|
-
"forward"
|
|
2617
|
-
])"string" == typeof requestOptions[key] && (requestOptions[key] = new URL(requestOptions[key]));
|
|
2618
|
-
if (!requestOptions.target && !requestOptions.forward) return this.emit("error", Error("Must provide a proper URL as target")), Promise.resolve();
|
|
2619
|
-
let callbackPromise = new Promise((resolve, reject)=>{
|
|
2620
|
-
_resolve = resolve, _reject = reject;
|
|
2621
|
-
});
|
|
2622
|
-
for (let pass of (res.on("close", ()=>{
|
|
2623
|
-
_resolve();
|
|
2624
|
-
}), res.on("error", (error)=>{
|
|
2625
|
-
_reject(error);
|
|
2626
|
-
}), server._getPasses(type))){
|
|
2627
|
-
let stop;
|
|
2628
|
-
try {
|
|
2629
|
-
stop = pass(req, res, requestOptions, server, head, (error, _req, _res, url)=>{
|
|
2630
|
-
server.listenerCount("error") > 0 ? (server.emit("error", error, req, res, url), _resolve()) : _reject(error);
|
|
2631
|
-
});
|
|
2632
|
-
} catch (error) {
|
|
2633
|
-
server.listenerCount("error") > 0 ? (server.emit("error", error, req, res, requestOptions.target || requestOptions.forward), _resolve()) : _reject(error);
|
|
2634
|
-
break;
|
|
2635
|
-
}
|
|
2636
|
-
if (stop) {
|
|
2637
|
-
_resolve();
|
|
2638
|
-
break;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
return callbackPromise;
|
|
2642
|
-
};
|
|
2643
|
-
}
|
|
2644
|
-
class errors_HttpProxyMiddlewareError extends Error {
|
|
2645
|
-
code;
|
|
2646
|
-
constructor(message, code){
|
|
2647
|
-
super(message), this.code = code, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
function verifyConfig(options) {
|
|
2651
|
-
if (!options.target && !options.router) throw new errors_HttpProxyMiddlewareError('[HPM] Missing "target" option. Example: {target: "http://www.example.org"}', 'ERR_CONFIG_FACTORY_TARGET_MISSING');
|
|
2652
|
-
}
|
|
2653
|
-
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), BODY_PARSER_ERROR_MESSAGE = `[HPM] Connection reset (ECONNRESET) detected with non-empty "req.body" [ERR_HPM.GH40].
|
|
2
|
+
import e from"node:http";import t from"node:https";import r from"node:http2";import{EventEmitter as o}from"node:events";import"node:net";import"node:stream";import{styleText as n}from"node:util";import{URL as s}from"node:url";import{URL as i}from"url";import"node:zlib";import"node:querystring";import{__webpack_require__ as a}from"./rslib-runtime.js";import"./626.js";a.add({"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js"(e,t,r){let o=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"),n=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"),s=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"),i=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"),a=(e,t={})=>{let r=[];if(Array.isArray(e))for(let o of e){let e=a.create(o,t);Array.isArray(e)?r.push(...e):r.push(e)}else r=[].concat(a.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(r=[...new Set(r)]),r};a.parse=(e,t={})=>i(e,t),a.stringify=(e,t={})=>"string"==typeof e?o(a.parse(e,t),t):o(e,t),a.compile=(e,t={})=>("string"==typeof e&&(e=a.parse(e,t)),n(e,t)),a.expand=(e,t={})=>{"string"==typeof e&&(e=a.parse(e,t));let r=s(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},a.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?a.compile(e,t):a.expand(e,t),e.exports=a},"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"(e,t,r){let o=r("../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"),n=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");e.exports=(e,t={})=>{let r=(e,s={})=>{let i=n.isInvalidBrace(s),a=!0===e.invalid&&!0===t.escapeInvalid,u=!0===i||!0===a,l=!0===t.escapeInvalid?"\\":"",p="";if(!0===e.isOpen)return l+e.value;if(!0===e.isClose)return console.log("node.isClose",l,e.value),l+e.value;if("open"===e.type)return u?l+e.value:"(";if("close"===e.type)return u?l+e.value:")";if("comma"===e.type)return"comma"===e.prev.type?"":u?e.value:"|";if(e.value)return e.value;if(e.nodes&&e.ranges>0){let r=n.reduce(e.nodes),s=o(...r,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(0!==s.length)return r.length>1&&s.length>1?`(${s})`:s}if(e.nodes)for(let t of e.nodes)p+=r(t,e);return p};return r(e)}},"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js"(e){e.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:"\xa0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}},"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"(e,t,r){let o=r("../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"),n=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"),s=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js"),i=(e="",t="",r=!1)=>{let o=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return r?s.flatten(t).map(e=>`{${e}}`):t;for(let n of e)if(Array.isArray(n))for(let e of n)o.push(i(e,t,r));else for(let e of t)!0===r&&"string"==typeof e&&(e=`{${e}}`),o.push(Array.isArray(e)?i(n,e,r):n+e);return s.flatten(o)};e.exports=(e,t={})=>{let r=void 0===t.rangeLimit?1e3:t.rangeLimit,a=(e,u={})=>{e.queue=[];let l=u,p=u.queue;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)p=(l=l.parent).queue;if(e.invalid||e.dollar)return void p.push(i(p.pop(),n(e,t)));if("brace"===e.type&&!0!==e.invalid&&2===e.nodes.length)return void p.push(i(p.pop(),["{}"]));if(e.nodes&&e.ranges>0){let a=s.reduce(e.nodes);if(s.exceedsLimit(...a,t.step,r))throw RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=o(...a,t);0===u.length&&(u=n(e,t)),p.push(i(p.pop(),u)),e.nodes=[];return}let c=s.encloseBrace(e),d=e.queue,f=e;for(;"brace"!==f.type&&"root"!==f.type&&f.parent;)d=(f=f.parent).queue;for(let t=0;t<e.nodes.length;t++){let r=e.nodes[t];if("comma"===r.type&&"brace"===e.type){1===t&&d.push(""),d.push("");continue}if("close"===r.type){p.push(i(p.pop(),d,c));continue}if(r.value&&"open"!==r.type){d.push(i(d.pop(),r.value));continue}r.nodes&&a(r,e)}return d};return s.flatten(a(e))}},"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"(e,t,r){let o=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"),{MAX_LENGTH:n,CHAR_BACKSLASH:s,CHAR_BACKTICK:i,CHAR_COMMA:a,CHAR_DOT:u,CHAR_LEFT_PARENTHESES:l,CHAR_RIGHT_PARENTHESES:p,CHAR_LEFT_CURLY_BRACE:c,CHAR_RIGHT_CURLY_BRACE:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_RIGHT_SQUARE_BRACKET:h,CHAR_DOUBLE_QUOTE:m,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:y,CHAR_ZERO_WIDTH_NOBREAK_SPACE:b}=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js");e.exports=(e,t={})=>{let r;if("string"!=typeof e)throw TypeError("Expected a string");let _=t||{},x="number"==typeof _.maxLength?Math.min(n,_.maxLength):n;if(e.length>x)throw SyntaxError(`Input length (${e.length}), exceeds max characters (${x})`);let C={type:"root",input:e,nodes:[]},R=[C],A=C,v=C,w=0,E=e.length,S=0,$=0,O=()=>e[S++],k=e=>{if("text"===e.type&&"dot"===v.type&&(v.type="text"),v&&"text"===v.type&&"text"===e.type){v.value+=e.value;return}return A.nodes.push(e),e.parent=A,e.prev=v,v=e,e};for(k({type:"bos"});S<E;)if(A=R[R.length-1],(r=O())!==b&&r!==y){if(r===s){k({type:"text",value:(t.keepEscaping?r:"")+O()});continue}if(r===h){k({type:"text",value:"\\"+r});continue}if(r===f){let e;for(w++;S<E&&(e=O());){if(r+=e,e===f){w++;continue}if(e===s){r+=O();continue}if(e===h&&0==--w)break}k({type:"text",value:r});continue}if(r===l){A=k({type:"paren",nodes:[]}),R.push(A),k({type:"text",value:r});continue}if(r===p){if("paren"!==A.type){k({type:"text",value:r});continue}A=R.pop(),k({type:"text",value:r}),A=R[R.length-1];continue}if(r===m||r===g||r===i){let e,o=r;for(!0!==t.keepQuotes&&(r="");S<E&&(e=O());){if(e===s){r+=e+O();continue}if(e===o){!0===t.keepQuotes&&(r+=e);break}r+=e}k({type:"text",value:r});continue}if(r===c){$++,A=k({type:"brace",open:!0,close:!1,dollar:v.value&&"$"===v.value.slice(-1)||!0===A.dollar,depth:$,commas:0,ranges:0,nodes:[]}),R.push(A),k({type:"open",value:r});continue}if(r===d){if("brace"!==A.type){k({type:"text",value:r});continue}(A=R.pop()).close=!0,k({type:"close",value:r}),$--,A=R[R.length-1];continue}if(r===a&&$>0){if(A.ranges>0){A.ranges=0;let e=A.nodes.shift();A.nodes=[e,{type:"text",value:o(A)}]}k({type:"comma",value:r}),A.commas++;continue}if(r===u&&$>0&&0===A.commas){let e=A.nodes;if(0===$||0===e.length){k({type:"text",value:r});continue}if("dot"===v.type){if(A.range=[],v.value+=r,v.type="range",3!==A.nodes.length&&5!==A.nodes.length){A.invalid=!0,A.ranges=0,v.type="text";continue}A.ranges++,A.args=[];continue}if("range"===v.type){e.pop();let t=e[e.length-1];t.value+=v.value+r,v=t,A.ranges--;continue}k({type:"dot",value:r});continue}k({type:"text",value:r})}do if("root"!==(A=R.pop()).type){A.nodes.forEach(e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)});let e=R[R.length-1],t=e.nodes.indexOf(A);e.nodes.splice(t,1,...A.nodes)}while(R.length>0);return k({type:"eos"}),C}},"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"(e,t,r){let o=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js");e.exports=(e,t={})=>{let r=(e,n={})=>{let s=t.escapeInvalid&&o.isInvalidBrace(n),i=!0===e.invalid&&!0===t.escapeInvalid,a="";if(e.value)return(s||i)&&o.isOpenOrClose(e)?"\\"+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(let t of e.nodes)a+=r(t);return a};return r(e)}},"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js"(e,t){t.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),t.find=(e,t)=>e.nodes.find(e=>e.type===t),t.exceedsLimit=(e,r,o=1,n)=>!1!==n&&!!t.isInteger(e)&&!!t.isInteger(r)&&(Number(r)-Number(e))/Number(o)>=n,t.escapeNode=(e,t=0,r)=>{let o=e.nodes[t];o&&(r&&o.type===r||"open"===o.type||"close"===o.type)&&!0!==o.escaped&&(o.value="\\"+o.value,o.escaped=!0)},t.encloseBrace=e=>"brace"===e.type&&e.commas>>0+e.ranges==0&&(e.invalid=!0,!0),t.isInvalidBrace=e=>"brace"===e.type&&(!0===e.invalid||!!e.dollar||(e.commas>>0+e.ranges==0||!0!==e.open||!0!==e.close)&&(e.invalid=!0,!0)),t.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,t.reduce=e=>e.reduce((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e),[]),t.flatten=(...e)=>{let t=[],r=e=>{for(let o=0;o<e.length;o++){let n=e[o];if(Array.isArray(n)){r(n);continue}void 0!==n&&t.push(n)}return t};return r(e),t}},"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js"(e,t,r){let o;t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;t.splice(1,0,r,"color: inherit");let o=0,n=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(o++,"%c"===e&&(n=o))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&"u">typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){let e;return"u">typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"u">typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),o=!1,t.destroy=()=>{o||(o=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))},t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(t);let{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js"(e,t,r){e.exports=function(e){function t(e){let r,n,s,i=null;function a(...e){if(!a.enabled)return;let o=Number(new Date);a.diff=o-(r||o),a.prev=r,a.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let n=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return"%";n++;let s=t.formatters[o];if("function"==typeof s){let t=e[n];r=s.call(a,t),e.splice(n,1),n--}return r}),t.formatArgs.call(a,e),(a.log||t.log).apply(a,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=o,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(n!==t.namespaces&&(n=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function o(e,r){let o=t(this.namespace+(void 0===r?":":r)+e);return o.log=this.log,o}function n(e,t){let r=0,o=0,n=-1,s=0;for(;r<e.length;)if(o<t.length&&(t[o]===e[r]||"*"===t[o]))"*"===t[o]?(n=o,s=r):r++,o++;else{if(-1===n)return!1;o=n+1,r=++s}for(;o<t.length&&"*"===t[o];)o++;return o===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){for(let r of(t.save(e),t.namespaces=e,t.names=[],t.skips=[],("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===r[0]?t.skips.push(r.slice(1)):t.names.push(r)},t.enabled=function(e){for(let r of t.skips)if(n(e,r))return!1;for(let r of t.names)if(n(e,r))return!0;return!1},t.humanize=r("../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)|0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js"(e,t,r){"u"<typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=r("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js"):e.exports=r("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js")},"../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js"(e,t,r){let o=r("tty"),n=r("util");t.init=function(e){e.inspectOpts={};let r=Object.keys(t.inspectOpts);for(let o=0;o<r.length;o++)e.inspectOpts[r[o]]=t.inspectOpts[r[o]]},t.log=function(...e){return process.stderr.write(n.formatWithOptions(t.inspectOpts,...e)+"\n")},t.formatArgs=function(r){let{namespace:o,useColors:n}=this;if(n){let t=this.color,n="\x1b[3"+(t<8?t:"8;5;"+t),s=` ${n};1m${o} \u001B[0m`;r[0]=s+r[0].split("\n").join("\n"+s),r.push(n+"m+"+e.exports.humanize(this.diff)+"\x1b[0m")}else r[0]=(t.inspectOpts.hideDate?"":new Date().toISOString()+" ")+o+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:o.isatty(process.stderr.fd)},t.destroy=n.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=r("supports-color");e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),o=process.env[t];return o=!!/^(yes|on|true|enabled)$/i.test(o)||!/^(no|off|false|disabled)$/i.test(o)&&("null"===o?null:Number(o)),e[r]=o,e},{}),e.exports=r("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(t);let{formatters:s}=e.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts)}},"../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"(e,t,r){let o=r("util"),n=r("../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js"),s=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),i=e=>"number"==typeof e||"string"==typeof e&&""!==e,a=e=>{let t=`${e}`,r=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++r];);return r>0},u=(e,t,r)=>{if(t>0){let r="-"===e[0]?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return!1===r?String(e):e},l=(e,t)=>{let r="-"===e[0]?"-":"";for(r&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return r?"-"+e:e},p=(e,t,r,o)=>{if(r)return n(e,t,{wrap:!1,...o});let s=String.fromCharCode(e);if(e===t)return s;let i=String.fromCharCode(t);return`[${s}-${i}]`},c=(e,t,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,o=r.capture?"":"?:";return t?`(${o}${e.join("|")})`:e.join("|")}return n(e,t,r)},d=(...e)=>RangeError("Invalid range arguments: "+o.inspect(...e)),f=(e,t,r)=>{if(!0===r.strictRanges)throw d([e,t]);return[]},h=(e,t,r,o={})=>{if(null==t&&i(e))return[e];if(!i(e)||!i(t))return f(e,t,o);if("function"==typeof r)return h(e,t,1,{transform:r});if(s(r))return h(e,t,0,r);let n={...o};if(!0===n.capture&&(n.wrap=!0),!Number.isInteger(+(r=r||n.step||1))){if(null!=r&&!s(r)){var m=r;if(!0===n.strictRanges)throw TypeError(`Expected step "${m}" to be a number`);return[]}return h(e,t,1,r)}return Number.isInteger(+e)&&Number.isInteger(+t)?((e,t,r=1,o={})=>{let n=Number(e),s=Number(t);if(!Number.isInteger(n)||!Number.isInteger(s)){if(!0===o.strictRanges)throw d([e,t]);return[]}0===n&&(n=0),0===s&&(s=0);let i=n>s,f=String(e),h=String(t),m=String(r);r=Math.max(Math.abs(r),1);let g=a(f)||a(h)||a(m),y=g?Math.max(f.length,h.length,m.length):0,b=!1===g&&!1==("string"==typeof e||"string"==typeof t||!0===o.stringify),_=o.transform||(e=>!0===b?Number(e):String(e));if(o.toRegex&&1===r)return p(l(e,y),l(t,y),!0,o);let x={negatives:[],positives:[]},C=e=>x[e<0?"negatives":"positives"].push(Math.abs(e)),R=[],A=0;for(;i?n>=s:n<=s;)!0===o.toRegex&&r>1?C(n):R.push(u(_(n,A),y,b)),n=i?n-r:n+r,A++;if(!0===o.toRegex){let e,t,n,s;return r>1?(x.negatives.sort((e,t)=>e<t?-1:+(e>t)),x.positives.sort((e,t)=>e<t?-1:+(e>t)),t=o.capture?"":"?:",n="",s="",(x.positives.length&&(n=x.positives.map(e=>l(String(e),y)).join("|")),x.negatives.length&&(s=`-(${t}${x.negatives.map(e=>l(String(e),y)).join("|")})`),e=n&&s?`${n}|${s}`:n||s,o.wrap)?`(${t}${e})`:e):c(R,null,{wrap:!1,...o})}return R})(e,t,r,n):((e,t,r=1,o={})=>{if(!Number.isInteger(+e)&&e.length>1||!Number.isInteger(+t)&&t.length>1)return f(e,t,o);let n=o.transform||(e=>String.fromCharCode(e)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),a=s>i,u=Math.min(s,i),l=Math.max(s,i);if(o.toRegex&&1===r)return p(u,l,!1,o);let d=[],h=0;for(;a?s>=i:s<=i;)d.push(n(s,h)),s=a?s-r:s+r,h++;return!0===o.toRegex?c(d,null,{wrap:!1,options:o}):d})(e,t,Math.max(Math.abs(r),1),n)};e.exports=h},"../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"(e){e.exports=function(e){var t;if("string"!=typeof e||""===e)return!1;for(;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1}},"../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js"(e,t,r){var o=r("../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"),n={"{":"}","(":")","[":"]"},s=function(e){if("!"===e[0])return!0;for(var t=0,r=-2,o=-2,s=-2,i=-2,a=-2;t<e.length;){if("*"===e[t]||"?"===e[t+1]&&/[\].+)]/.test(e[t])||-1!==o&&"["===e[t]&&"]"!==e[t+1]&&(o<t&&(o=e.indexOf("]",t)),o>t)&&(-1===a||a>o||-1===(a=e.indexOf("\\",t))||a>o)||-1!==s&&"{"===e[t]&&"}"!==e[t+1]&&(s=e.indexOf("}",t))>t&&(-1===(a=e.indexOf("\\",t))||a>s)||-1!==i&&"("===e[t]&&"?"===e[t+1]&&/[:!=]/.test(e[t+2])&&")"!==e[t+3]&&(i=e.indexOf(")",t))>t&&(-1===(a=e.indexOf("\\",t))||a>i)||-1!==r&&"("===e[t]&&"|"!==e[t+1]&&(r<t&&(r=e.indexOf("|",t)),-1!==r&&")"!==e[r+1]&&(i=e.indexOf(")",r))>r)&&(-1===(a=e.indexOf("\\",r))||a>i))return!0;if("\\"===e[t]){var u=e[t+1];t+=2;var l=n[u];if(l){var p=e.indexOf(l,t);-1!==p&&(t=p+1)}if("!"===e[t])return!0}else t++}return!1},i=function(e){if("!"===e[0])return!0;for(var t=0;t<e.length;){if(/[*?{}()[\]]/.test(e[t]))return!0;if("\\"===e[t]){var r=e[t+1];t+=2;var o=n[r];if(o){var s=e.indexOf(o,t);-1!==s&&(t=s+1)}if("!"===e[t])return!0}else t++}return!1};e.exports=function(e,t){if("string"!=typeof e||""===e)return!1;if(o(e))return!0;var r=s;return t&&!1===t.strict&&(r=i),r(e)}},"../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js"(e){e.exports=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))}},"../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js"(e,t,r){let o=r("util"),n=r("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js"),s=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/index.js"),i=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"),a=e=>""===e||"./"===e,u=e=>{let t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},l=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,n=new Set,i=new Set,a=0,u=e=>{i.add(e.output),r&&r.onResult&&r.onResult(e)};for(let i=0;i<t.length;i++){let l=s(String(t[i]),{...r,onResult:u},!0),p=l.state.negated||l.state.negatedExtglob;for(let t of(p&&a++,e)){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),n.add(e.output)))}}let l=(a===t.length?[...i]:[...n]).filter(e=>!o.has(e));if(r&&0===l.length){if(!0===r.failglob)throw Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map(e=>e.replace(/\\/g,"")):t}return l};l.match=l,l.matcher=(e,t)=>s(e,t),l.isMatch=(e,t,r)=>s(t,r)(e),l.any=l.isMatch,l.not=(e,t,r={})=>{t=[].concat(t).map(String);let o=new Set,n=[],s=new Set(l(e,t,{...r,onResult:e=>{r.onResult&&r.onResult(e),n.push(e.output)}}));for(let e of n)s.has(e)||o.add(e);return[...o]},l.contains=(e,t,r)=>{if("string"!=typeof e)throw TypeError(`Expected a string: "${o.inspect(e)}"`);if(Array.isArray(t))return t.some(t=>l.contains(e,t,r));if("string"==typeof t){if(a(e)||a(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return l.isMatch(e,t,{...r,contains:!0})},l.matchKeys=(e,t,r)=>{if(!i.isObject(e))throw TypeError("Expected the first argument to be an object");let o=l(Object.keys(e),t,r),n={};for(let t of o)n[t]=e[t];return n},l.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=s(String(e),r);if(o.some(e=>t(e)))return!0}return!1},l.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=s(String(e),r);if(!o.every(e=>t(e)))return!1}return!0},l.all=(e,t,r)=>{if("string"!=typeof e)throw TypeError(`Expected a string: "${o.inspect(e)}"`);return[].concat(t).every(t=>s(t,r)(e))},l.capture=(e,t,r)=>{let o=i.isWindows(r),n=s.makeRe(String(e),{...r,capture:!0}).exec(o?i.toPosixSlashes(t):t);if(n)return n.slice(1).map(e=>void 0===e?"":e)},l.makeRe=(...e)=>s.makeRe(...e),l.scan=(...e)=>s.scan(...e),l.parse=(e,t)=>{let r=[];for(let o of[].concat(e||[]))for(let e of n(String(o),t))r.push(s.parse(e,t));return r},l.braces=(e,t)=>{if("string"!=typeof e)throw TypeError("Expected a string");return t&&!0===t.nobrace||!u(e)?[e]:n(e,t)},l.braceExpand=(e,t)=>{if("string"!=typeof e)throw TypeError("Expected a string");return l.braces(e,{...t,expand:!0})},l.hasBraces=u,e.exports=l},"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(e){function t(e,t,r,o){return Math.round(e/r)+" "+o+(t>=1.5*r?"s":"")}e.exports=function(e,r){r=r||{};var o,n,s,i,a=typeof e;if("string"===a&&e.length>0){var u=e;if(!((u=String(u)).length>100)){var l=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(l){var p=parseFloat(l[1]);switch((l[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*p;case"weeks":case"week":case"w":return 6048e5*p;case"days":case"day":case"d":return 864e5*p;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*p;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*p;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*p;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:break}}}return}if("number"===a&&isFinite(e)){return r.long?(n=Math.abs(o=e))>=864e5?t(o,n,864e5,"day"):n>=36e5?t(o,n,36e5,"hour"):n>=6e4?t(o,n,6e4,"minute"):n>=1e3?t(o,n,1e3,"second"):o+" ms":(i=Math.abs(s=e))>=864e5?Math.round(s/864e5)+"d":i>=36e5?Math.round(s/36e5)+"h":i>=6e4?Math.round(s/6e4)+"m":i>=1e3?Math.round(s/1e3)+"s":s+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/index.js"(e,t,r){e.exports=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js")},"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(e,t,r){let o=r("path?37f5"),n="[^\\\\/]",s="[^/]",i="(?:\\/|$)",a="(?:^|\\/)",u=`\\.{1,2}${i}`,l=`(?!${a}${u})`,p=`(?!\\.{0,1}${i})`,c=`(?!${u})`,d=`${s}*?`,f={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:i,DOTS_SLASH:u,NO_DOT:"(?!\\.)",NO_DOTS:l,NO_DOT_SLASH:p,NO_DOTS_SLASH:c,QMARK_NO_DOT:"[^.\\/]",STAR:d,START_ANCHOR:a},h={...f,SLASH_LITERAL:"[\\\\/]",QMARK:n,STAR:`${n}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"};e.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:o.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?h:f}},"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"(e,t,r){let o=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"),n=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"),{MAX_LENGTH:s,POSIX_REGEX_SOURCE:i,REGEX_NON_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_BACKREF:u,REPLACEMENTS:l}=o,p=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();let r=`[${e.join("-")}]`;try{new RegExp(r)}catch(t){return e.map(e=>n.escapeRegex(e)).join("..")}return r},c=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],r=0,o=0,n=0,s="",i=!1;for(let a of e){if(!0===i){s+=a,i=!1;continue}if("\\"===a){s+=a,i=!0;continue}if('"'===a){n=+(1!==n),s+=a;continue}if(0===n){if("["===a)r++;else if("]"===a&&r>0)r--;else if(0===r){if("("===a)o++;else if(")"===a&&o>0)o--;else if("|"===a&&0===o){t.push(s),s="";continue}}}s+=a}return t.push(s),t},f=e=>{let t=e.trim(),r=!0;for(;!0===r;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),r=!0);if((e=>{let t=!1;for(let r of e){if(!0===t){t=!1;continue}if("\\"===r){t=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0})(t))return t.replace(/\\(.)/g,"$1")},h=(e,t=!0)=>{if("+"!==e[0]&&"*"!==e[0]||"("!==e[1])return;let r=0,o=0,n=0,s=!1;for(let i=1;i<e.length;i++){let a=e[i];if(!0===s){s=!1;continue}if("\\"===a){s=!0;continue}if('"'===a){n=+(1!==n);continue}if(1!==n){if("["===a){r++;continue}if("]"===a&&r>0){r--;continue}if(!(r>0)){if("("===a){o++;continue}if(")"===a&&0==--o){if(!0===t&&i!==e.length-1)return;return{type:e[0],body:e.slice(2,i),end:i}}}}}},m=e=>{let t=0,r=[];for(;t<e.length;){let o=h(e.slice(t),!1);if(!o||"*"!==o.type)return;let n=d(o.body).map(e=>e.trim());if(1!==n.length)return;let s=f(n[0]);if(!s||1!==s.length)return;r.push(s),t+=o.end+1}if(r.length<1)return;let o=1===r.length?n.escapeRegex(r[0]):`[${r.map(e=>n.escapeRegex(e)).join("")}]`;return`${o}*`},g=e=>{let t=0,r=e.trim(),o=h(r);for(;o;)t++,o=h(r=o.body.trim());return t},y=(e,t)=>{let r;if("string"!=typeof e)throw TypeError("Expected a string");e=l[e]||e;let h={...t},b="number"==typeof h.maxLength?Math.min(s,h.maxLength):s,_=e.length;if(_>b)throw SyntaxError(`Input length: ${_}, exceeds maximum allowed length: ${b}`);let x={type:"bos",value:"",output:h.prepend||""},C=[x],R=h.capture?"":"?:",A=n.isWindows(t),v=o.globChars(A),w=o.extglobChars(v),{DOT_LITERAL:E,PLUS_LITERAL:S,SLASH_LITERAL:$,ONE_CHAR:O,DOTS_SLASH:k,NO_DOT:H,NO_DOT_SLASH:T,NO_DOTS_SLASH:L,QMARK:I,QMARK_NO_DOT:F,STAR:P,START_ANCHOR:j}=v,N=e=>`(${R}(?:(?!${j}${e.dot?k:E}).)*?)`,M=h.dot?"":H,U=h.dot?I:F,B=!0===h.bash?N(h):P;h.capture&&(B=`(${B})`),"boolean"==typeof h.noext&&(h.noextglob=h.noext);let D={input:e,index:-1,start:0,dot:!0===h.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:C};_=(e=n.removePrefix(e,D)).length;let G=[],q=[],K=[],W=x,Z=()=>D.index===_-1,z=D.peek=(t=1)=>e[D.index+t],Q=D.advance=()=>e[++D.index]||"",V=()=>e.slice(D.index+1),X=(e="",t=0)=>{D.consumed+=e,D.index+=t},Y=e=>{D.output+=null!=e.output?e.output:e.value,X(e.value)},J=()=>{let e=1;for(;"!"===z()&&("("!==z(2)||"?"===z(3));)Q(),D.start++,e++;return e%2!=0&&(D.negated=!0,D.start++,!0)},ee=e=>{D[e]++,K.push(e)},et=e=>{D[e]--,K.pop()},er=e=>{if("globstar"===W.type){let t=D.braces>0&&("comma"===e.type||"brace"===e.type),r=!0===e.extglob||G.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||r||(D.output=D.output.slice(0,-W.output.length),W.type="star",W.value="*",W.output=B,D.output+=W.output)}if(G.length&&"paren"!==e.type&&(G[G.length-1].inner+=e.value),(e.value||e.output)&&Y(e),W&&"text"===W.type&&"text"===e.type){W.value+=e.value,W.output=(W.output||"")+e.value;return}e.prev=W,C.push(e),W=e},eo=(e,t)=>{let r={...w[t],conditions:1,inner:""};r.prev=W,r.parens=D.parens,r.output=D.output,r.startIndex=D.index,r.tokensIndex=C.length;let o=(h.capture?"(":"")+r.open;ee("parens"),er({type:e,value:t,output:D.output?"":O}),er({type:"paren",extglob:!0,value:Q(),output:o}),G.push(r)},en=s=>{let i,a=e.slice(s.startIndex,D.index+1),u=((e,t)=>{if(!1===t.maxExtglobRecursion)return{risky:!1};let r="number"==typeof t.maxExtglobRecursion?t.maxExtglobRecursion:o.DEFAULT_MAX_EXTGLOB_RECURSION,n=d(e).map(e=>e.trim());if(n.length>1&&(n.some(e=>""===e)||n.some(e=>/^[*?]+$/.test(e))||(e=>{let t=e.map(f).filter(Boolean);for(let e=0;e<t.length;e++)for(let r=e+1;r<t.length;r++){let o=t[e],n=t[r],s=o[0];if(s&&o===s.repeat(o.length)&&n===s.repeat(n.length)&&(o===n||o.startsWith(n)||n.startsWith(o)))return!0}return!1})(n)))return{risky:!0};for(let e of n){let t=m(e);if(t)return{risky:!0,safeOutput:t};if(g(e)>r)return{risky:!0}}return{risky:!1}})(e.slice(s.startIndex+2,D.index),h);if(("plus"===s.type||"star"===s.type)&&u.risky){let e=u.safeOutput?(s.output?"":O)+(h.capture?`(${u.safeOutput})`:u.safeOutput):void 0,t=C[s.tokensIndex];t.type="text",t.value=a,t.output=e||n.escapeRegex(a);for(let e=s.tokensIndex+1;e<C.length;e++)C[e].value="",C[e].output="",delete C[e].suffix;D.output=s.output+t.output,D.backtrack=!0,er({type:"paren",extglob:!0,value:r,output:""}),et("parens");return}let l=s.close+(h.capture?")":"");if("negate"===s.type){let e=B;if(s.inner&&s.inner.length>1&&s.inner.includes("/")&&(e=N(h)),(e!==B||Z()||/^\)+$/.test(V()))&&(l=s.close=`)$))${e}`),s.inner.includes("*")&&(i=V())&&/^\.[^\\/.]+$/.test(i)){let r=y(i,{...t,fastpaths:!1}).output;l=s.close=`)${r})${e})`}"bos"===s.prev.type&&(D.negatedExtglob=!0)}er({type:"paren",extglob:!0,value:r,output:l}),et("parens")};if(!1!==h.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let r=!1,o=e.replace(u,(e,t,o,n,s,i)=>"\\"===n?(r=!0,e):"?"===n?t?t+n+(s?I.repeat(s.length):""):0===i?U+(s?I.repeat(s.length):""):I.repeat(o.length):"."===n?E.repeat(o.length):"*"===n?t?t+n+(s?B:""):B:t?e:`\\${e}`);return(!0===r&&(o=!0===h.unescape?o.replace(/\\/g,""):o.replace(/\\+/g,e=>e.length%2==0?"\\\\":e?"\\":"")),o===e&&!0===h.contains)?D.output=e:D.output=n.wrapOutput(o,D,t),D}for(;!Z();){if("\0"===(r=Q()))continue;if("\\"===r){let e=z();if("/"===e&&!0!==h.bash||"."===e||";"===e)continue;if(!e){er({type:"text",value:r+="\\"});continue}let t=/^\\+/.exec(V()),o=0;if(t&&t[0].length>2&&(o=t[0].length,D.index+=o,o%2!=0&&(r+="\\")),!0===h.unescape?r=Q():r+=Q(),0===D.brackets){er({type:"text",value:r});continue}}if(D.brackets>0&&("]"!==r||"["===W.value||"[^"===W.value)){if(!1!==h.posix&&":"===r){let e=W.value.slice(1);if(e.includes("[")&&(W.posix=!0,e.includes(":"))){let e=W.value.lastIndexOf("["),t=W.value.slice(0,e),r=i[W.value.slice(e+2)];if(r){W.value=t+r,D.backtrack=!0,Q(),x.output||1!==C.indexOf(W)||(x.output=O);continue}}}("["===r&&":"!==z()||"-"===r&&"]"===z())&&(r=`\\${r}`),"]"===r&&("["===W.value||"[^"===W.value)&&(r=`\\${r}`),!0===h.posix&&"!"===r&&"["===W.value&&(r="^"),W.value+=r,Y({value:r});continue}if(1===D.quotes&&'"'!==r){r=n.escapeRegex(r),W.value+=r,Y({value:r});continue}if('"'===r){D.quotes=+(1!==D.quotes),!0===h.keepQuotes&&er({type:"text",value:r});continue}if("("===r){ee("parens"),er({type:"paren",value:r});continue}if(")"===r){if(0===D.parens&&!0===h.strictBrackets)throw SyntaxError(c("opening","("));let e=G[G.length-1];if(e&&D.parens===e.parens+1){en(G.pop());continue}er({type:"paren",value:r,output:D.parens?")":"\\)"}),et("parens");continue}if("["===r){if(!0!==h.nobracket&&V().includes("]"))ee("brackets");else{if(!0!==h.nobracket&&!0===h.strictBrackets)throw SyntaxError(c("closing","]"));r=`\\${r}`}er({type:"bracket",value:r});continue}if("]"===r){if(!0===h.nobracket||W&&"bracket"===W.type&&1===W.value.length){er({type:"text",value:r,output:`\\${r}`});continue}if(0===D.brackets){if(!0===h.strictBrackets)throw SyntaxError(c("opening","["));er({type:"text",value:r,output:`\\${r}`});continue}et("brackets");let e=W.value.slice(1);if(!0===W.posix||"^"!==e[0]||e.includes("/")||(r=`/${r}`),W.value+=r,Y({value:r}),!1===h.literalBrackets||n.hasRegexChars(e))continue;let t=n.escapeRegex(W.value);if(D.output=D.output.slice(0,-W.value.length),!0===h.literalBrackets){D.output+=t,W.value=t;continue}W.value=`(${R}${t}|${W.value})`,D.output+=W.value;continue}if("{"===r&&!0!==h.nobrace){ee("braces");let e={type:"brace",value:r,output:"(",outputIndex:D.output.length,tokensIndex:D.tokens.length};q.push(e),er(e);continue}if("}"===r){let e=q[q.length-1];if(!0===h.nobrace||!e){er({type:"text",value:r,output:r});continue}let t=")";if(!0===e.dots){let e=C.slice(),r=[];for(let t=e.length-1;t>=0&&(C.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&r.unshift(e[t].value);t=p(r,h),D.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){let o=D.output.slice(0,e.outputIndex),n=D.tokens.slice(e.tokensIndex);for(let s of(e.value=e.output="\\{",r=t="\\}",D.output=o,n))D.output+=s.output||s.value}er({type:"brace",value:r,output:t}),et("braces"),q.pop();continue}if("|"===r){G.length>0&&G[G.length-1].conditions++,er({type:"text",value:r});continue}if(","===r){let e=r,t=q[q.length-1];t&&"braces"===K[K.length-1]&&(t.comma=!0,e="|"),er({type:"comma",value:r,output:e});continue}if("/"===r){if("dot"===W.type&&D.index===D.start+1){D.start=D.index+1,D.consumed="",D.output="",C.pop(),W=x;continue}er({type:"slash",value:r,output:$});continue}if("."===r){if(D.braces>0&&"dot"===W.type){"."===W.value&&(W.output=E);let e=q[q.length-1];W.type="dots",W.output+=r,W.value+=r,e.dots=!0;continue}if(D.braces+D.parens===0&&"bos"!==W.type&&"slash"!==W.type){er({type:"text",value:r,output:E});continue}er({type:"dot",value:r,output:E});continue}if("?"===r){if(!(W&&"("===W.value)&&!0!==h.noextglob&&"("===z()&&"?"!==z(2)){eo("qmark",r);continue}if(W&&"paren"===W.type){let e=z(),t=r;if("<"===e&&!n.supportsLookbehinds())throw Error("Node.js v10 or higher is required for regex lookbehinds");("("!==W.value||/[!=<:]/.test(e))&&("<"!==e||/<([!=]|\w+>)/.test(V()))||(t=`\\${r}`),er({type:"text",value:r,output:t});continue}if(!0!==h.dot&&("slash"===W.type||"bos"===W.type)){er({type:"qmark",value:r,output:F});continue}er({type:"qmark",value:r,output:I});continue}if("!"===r){if(!0!==h.noextglob&&"("===z()&&("?"!==z(2)||!/[!=<:]/.test(z(3)))){eo("negate",r);continue}if(!0!==h.nonegate&&0===D.index){J();continue}}if("+"===r){if(!0!==h.noextglob&&"("===z()&&"?"!==z(2)){eo("plus",r);continue}if(W&&"("===W.value||!1===h.regex){er({type:"plus",value:r,output:S});continue}if(W&&("bracket"===W.type||"paren"===W.type||"brace"===W.type)||D.parens>0){er({type:"plus",value:r});continue}er({type:"plus",value:S});continue}if("@"===r){if(!0!==h.noextglob&&"("===z()&&"?"!==z(2)){er({type:"at",extglob:!0,value:r,output:""});continue}er({type:"text",value:r});continue}if("*"!==r){("$"===r||"^"===r)&&(r=`\\${r}`);let e=a.exec(V());e&&(r+=e[0],D.index+=e[0].length),er({type:"text",value:r});continue}if(W&&("globstar"===W.type||!0===W.star)){W.type="star",W.star=!0,W.value+=r,W.output=B,D.backtrack=!0,D.globstar=!0,X(r);continue}let t=V();if(!0!==h.noextglob&&/^\([^?]/.test(t)){eo("star",r);continue}if("star"===W.type){if(!0===h.noglobstar){X(r);continue}let o=W.prev,n=o.prev,s="slash"===o.type||"bos"===o.type,i=n&&("star"===n.type||"globstar"===n.type);if(!0===h.bash&&(!s||t[0]&&"/"!==t[0])){er({type:"star",value:r,output:""});continue}let a=D.braces>0&&("comma"===o.type||"brace"===o.type),u=G.length&&("pipe"===o.type||"paren"===o.type);if(!s&&"paren"!==o.type&&!a&&!u){er({type:"star",value:r,output:""});continue}for(;"/**"===t.slice(0,3);){let r=e[D.index+4];if(r&&"/"!==r)break;t=t.slice(3),X("/**",3)}if("bos"===o.type&&Z()){W.type="globstar",W.value+=r,W.output=N(h),D.output=W.output,D.globstar=!0,X(r);continue}if("slash"===o.type&&"bos"!==o.prev.type&&!i&&Z()){D.output=D.output.slice(0,-(o.output+W.output).length),o.output=`(?:${o.output}`,W.type="globstar",W.output=N(h)+(h.strictSlashes?")":"|$)"),W.value+=r,D.globstar=!0,D.output+=o.output+W.output,X(r);continue}if("slash"===o.type&&"bos"!==o.prev.type&&"/"===t[0]){let e=void 0!==t[1]?"|$":"";D.output=D.output.slice(0,-(o.output+W.output).length),o.output=`(?:${o.output}`,W.type="globstar",W.output=`${N(h)}${$}|${$}${e})`,W.value+=r,D.output+=o.output+W.output,D.globstar=!0,X(r+Q()),er({type:"slash",value:"/",output:""});continue}if("bos"===o.type&&"/"===t[0]){W.type="globstar",W.value+=r,W.output=`(?:^|${$}|${N(h)}${$})`,D.output=W.output,D.globstar=!0,X(r+Q()),er({type:"slash",value:"/",output:""});continue}D.output=D.output.slice(0,-W.output.length),W.type="globstar",W.output=N(h),W.value+=r,D.output+=W.output,D.globstar=!0,X(r);continue}let o={type:"star",value:r,output:B};if(!0===h.bash){o.output=".*?",("bos"===W.type||"slash"===W.type)&&(o.output=M+o.output),er(o);continue}if(W&&("bracket"===W.type||"paren"===W.type)&&!0===h.regex){o.output=r,er(o);continue}(D.index===D.start||"slash"===W.type||"dot"===W.type)&&("dot"===W.type?(D.output+=T,W.output+=T):!0===h.dot?(D.output+=L,W.output+=L):(D.output+=M,W.output+=M),"*"!==z()&&(D.output+=O,W.output+=O)),er(o)}for(;D.brackets>0;){if(!0===h.strictBrackets)throw SyntaxError(c("closing","]"));D.output=n.escapeLast(D.output,"["),et("brackets")}for(;D.parens>0;){if(!0===h.strictBrackets)throw SyntaxError(c("closing",")"));D.output=n.escapeLast(D.output,"("),et("parens")}for(;D.braces>0;){if(!0===h.strictBrackets)throw SyntaxError(c("closing","}"));D.output=n.escapeLast(D.output,"{"),et("braces")}if(!0!==h.strictSlashes&&("star"===W.type||"bracket"===W.type)&&er({type:"maybe_slash",value:"",output:`${$}?`}),!0===D.backtrack)for(let e of(D.output="",D.tokens))D.output+=null!=e.output?e.output:e.value,e.suffix&&(D.output+=e.suffix);return D};y.fastpaths=(e,t)=>{let r={...t},i="number"==typeof r.maxLength?Math.min(s,r.maxLength):s,a=e.length;if(a>i)throw SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${i}`);e=l[e]||e;let u=n.isWindows(t),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:h,NO_DOTS:m,NO_DOTS_SLASH:g,STAR:y,START_ANCHOR:b}=o.globChars(u),_=r.dot?m:h,x=r.dot?g:h,C=r.capture?"":"?:",R=!0===r.bash?".*?":y;r.capture&&(R=`(${R})`);let A=e=>!0===e.noglobstar?R:`(${C}(?:(?!${b}${e.dot?f:p}).)*?)`,v=e=>{switch(e){case"*":return`${_}${d}${R}`;case".*":return`${p}${d}${R}`;case"*.*":return`${_}${R}${p}${d}${R}`;case"*/*":return`${_}${R}${c}${d}${x}${R}`;case"**":return _+A(r);case"**/*":return`(?:${_}${A(r)}${c})?${x}${d}${R}`;case"**/*.*":return`(?:${_}${A(r)}${c})?${x}${R}${p}${d}${R}`;case"**/.*":return`(?:${_}${A(r)}${c})?${p}${d}${R}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let r=v(t[1]);if(!r)return;return r+p+t[2]}}},w=v(n.removePrefix(e,{negated:!1,prefix:""}));return w&&!0!==r.strictSlashes&&(w+=`${c}?`),w},e.exports=y},"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(e,t,r){let o=r("path?37f5"),n=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"),s=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"),i=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"),a=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"),u=(e,t,r=!1)=>{if(Array.isArray(e)){let o=e.map(e=>u(e,t,r));return e=>{for(let t of o){let r=t(e);if(r)return r}return!1}}let o=e&&"object"==typeof e&&!Array.isArray(e)&&e.tokens&&e.input;if(""===e||"string"!=typeof e&&!o)throw TypeError("Expected pattern to be a non-empty string");let n=t||{},s=i.isWindows(t),a=o?u.compileRe(e,t):u.makeRe(e,t,!1,!0),l=a.state;delete a.state;let p=()=>!1;if(n.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};p=u(n.ignore,e,r)}let c=(r,o=!1)=>{let{isMatch:i,match:c,output:d}=u.test(r,a,t,{glob:e,posix:s}),f={glob:e,state:l,regex:a,posix:s,input:r,output:d,match:c,isMatch:i};return("function"==typeof n.onResult&&n.onResult(f),!1===i)?(f.isMatch=!1,!!o&&f):p(r)?("function"==typeof n.onIgnore&&n.onIgnore(f),f.isMatch=!1,!!o&&f):("function"==typeof n.onMatch&&n.onMatch(f),!o||f)};return r&&(c.state=l),c};u.test=(e,t,r,{glob:o,posix:n}={})=>{if("string"!=typeof e)throw TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};let s=r||{},a=s.format||(n?i.toPosixSlashes:null),l=e===o,p=l&&a?a(e):e;return!1===l&&(l=(p=a?a(e):e)===o),(!1===l||!0===s.capture)&&(l=!0===s.matchBase||!0===s.basename?u.matchBase(e,t,r,n):t.exec(p)),{isMatch:!!l,match:l,output:p}},u.matchBase=(e,t,r,n=i.isWindows(r))=>(t instanceof RegExp?t:u.makeRe(t,r)).test(o.basename(e)),u.isMatch=(e,t,r)=>u(t,r)(e),u.parse=(e,t)=>Array.isArray(e)?e.map(e=>u.parse(e,t)):s(e,{...t,fastpaths:!1}),u.scan=(e,t)=>n(e,t),u.compileRe=(e,t,r=!1,o=!1)=>{if(!0===r)return e.output;let n=t||{},s=n.contains?"":"^",i=n.contains?"":"$",a=`${s}(?:${e.output})${i}`;e&&!0===e.negated&&(a=`^(?!${a}).*$`);let l=u.toRegex(a,t);return!0===o&&(l.state=e),l},u.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return!1!==t.fastpaths&&("."===e[0]||"*"===e[0])&&(n.output=s.fastpaths(e,t)),n.output||(n=s(e,t)),u.compileRe(n,t,r,o)},u.toRegex=(e,t)=>{try{let r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},u.constants=a,e.exports=u},"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"(e,t,r){let o=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"),{CHAR_ASTERISK:n,CHAR_AT:s,CHAR_BACKWARD_SLASH:i,CHAR_COMMA:a,CHAR_DOT:u,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:p,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:h,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:b}=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"),_=e=>e===p||e===i,x=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};e.exports=(e,t)=>{let r,C,R=t||{},A=e.length-1,v=!0===R.parts||!0===R.scanToEnd,w=[],E=[],S=[],$=e,O=-1,k=0,H=0,T=!1,L=!1,I=!1,F=!1,P=!1,j=!1,N=!1,M=!1,U=!1,B=!1,D=0,G={value:"",depth:0,isGlob:!1},q=()=>O>=A,K=()=>$.charCodeAt(O+1),W=()=>(r=C,$.charCodeAt(++O));for(;O<A;){let e;if((C=W())===i){N=G.backslashes=!0,(C=W())===c&&(j=!0);continue}if(!0===j||C===c){for(D++;!0!==q()&&(C=W());){if(C===i){N=G.backslashes=!0,W();continue}if(C===c){D++;continue}if(!0!==j&&C===u&&(C=W())===u||!0!==j&&C===a){if(T=G.isBrace=!0,I=G.isGlob=!0,B=!0,!0===v)continue;break}if(C===g&&0==--D){j=!1,T=G.isBrace=!0,B=!0;break}}if(!0===v)continue;break}if(C===p){if(w.push(O),E.push(G),G={value:"",depth:0,isGlob:!1},!0===B)continue;if(r===u&&O===k+1){k+=2;continue}H=O+1;continue}if(!0!==R.noext&&!0==(C===h||C===s||C===n||C===m||C===l)&&K()===d){if(I=G.isGlob=!0,F=G.isExtglob=!0,B=!0,C===l&&O===k&&(U=!0),!0===v){for(;!0!==q()&&(C=W());){if(C===i){N=G.backslashes=!0,C=W();continue}if(C===y){I=G.isGlob=!0,B=!0;break}}continue}break}if(C===n){if(r===n&&(P=G.isGlobstar=!0),I=G.isGlob=!0,B=!0,!0===v)continue;break}if(C===m){if(I=G.isGlob=!0,B=!0,!0===v)continue;break}if(C===f){for(;!0!==q()&&(e=W());){if(e===i){N=G.backslashes=!0,W();continue}if(e===b){L=G.isBracket=!0,I=G.isGlob=!0,B=!0;break}}if(!0===v)continue;break}if(!0!==R.nonegate&&C===l&&O===k){M=G.negated=!0,k++;continue}if(!0!==R.noparen&&C===d){if(I=G.isGlob=!0,!0===v){for(;!0!==q()&&(C=W());){if(C===d){N=G.backslashes=!0,C=W();continue}if(C===y){B=!0;break}}continue}break}if(!0===I){if(B=!0,!0===v)continue;break}}!0===R.noext&&(F=!1,I=!1);let Z=$,z="",Q="";k>0&&(z=$.slice(0,k),$=$.slice(k),H-=k),Z&&!0===I&&H>0?(Z=$.slice(0,H),Q=$.slice(H)):!0===I?(Z="",Q=$):Z=$,Z&&""!==Z&&"/"!==Z&&Z!==$&&_(Z.charCodeAt(Z.length-1))&&(Z=Z.slice(0,-1)),!0===R.unescape&&(Q&&(Q=o.removeBackslashes(Q)),Z&&!0===N&&(Z=o.removeBackslashes(Z)));let V={prefix:z,input:e,start:k,base:Z,glob:Q,isBrace:T,isBracket:L,isGlob:I,isExtglob:F,isGlobstar:P,negated:M,negatedExtglob:U};if(!0===R.tokens&&(V.maxDepth=0,_(C)||E.push(G),V.tokens=E),!0===R.parts||!0===R.tokens){let t;for(let r=0;r<w.length;r++){let o=t?t+1:k,n=w[r],s=e.slice(o,n);R.tokens&&(0===r&&0!==k?(E[r].isPrefix=!0,E[r].value=z):E[r].value=s,x(E[r]),V.maxDepth+=E[r].depth),(0!==r||""!==s)&&S.push(s),t=n}if(t&&t+1<e.length){let r=e.slice(t+1);S.push(r),R.tokens&&(E[E.length-1].value=r,x(E[E.length-1]),V.maxDepth+=E[E.length-1].depth)}V.slashes=w,V.parts=S}return V}},"../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(e,t,r){let o=r("path?37f5"),n="win32"===process.platform,{REGEX_BACKSLASH:s,REGEX_REMOVE_BACKSLASH:i,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:u}=r("../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js");t.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),t.hasRegexChars=e=>a.test(e),t.isRegexChar=e=>1===e.length&&t.hasRegexChars(e),t.escapeRegex=e=>e.replace(u,"\\$1"),t.toPosixSlashes=e=>e.replace(s,"/"),t.removeBackslashes=e=>e.replace(i,e=>"\\"===e?"":e),t.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return 3===e.length&&!!(e[0]>=9)||8===e[0]&&!!(e[1]>=10)},t.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===o.sep,t.escapeLast=(e,r,o)=>{let n=e.lastIndexOf(r,o);return -1===n?e:"\\"===e[n-1]?t.escapeLast(e,r,n-1):`${e.slice(0,n)}\\${e.slice(n)}`},t.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r},t.wrapOutput=(e,t={},r={})=>{let o=r.contains?"":"^",n=r.contains?"":"$",s=`${o}(?:${e})${n}`;return!0===t.negated&&(s=`(?:^(?!${s}).*$)`),s}},"../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js"(e,t,r){let o=r("../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js"),n=(e,t,r)=>{var a,u,l;let p,c,f;if(!1===o(e))throw TypeError("toRegexRange: expected the first argument to be a number");if(void 0===t||e===t)return String(e);if(!1===o(t))throw TypeError("toRegexRange: expected the second argument to be a number.");let h={relaxZeros:!0,...r};"boolean"==typeof h.strictZeros&&(h.relaxZeros=!1===h.strictZeros);let m=e+":"+t+"="+String(h.relaxZeros)+String(h.shorthand)+String(h.capture)+String(h.wrap);if(n.cache.hasOwnProperty(m))return n.cache[m].result;let g=Math.min(e,t),y=Math.max(e,t);if(1===Math.abs(g-y)){let r=e+"|"+t;return h.capture?`(${r})`:!1===h.wrap?r:`(?:${r})`}let b=d(e)||d(t),_={min:e,max:t,a:g,b:y},x=[],C=[];return b&&(_.isPadded=b,_.maxLen=String(_.max).length),g<0&&(C=s(y<0?Math.abs(y):1,Math.abs(g),_,h),g=_.a=0),y>=0&&(x=s(g,y,_,h)),_.negatives=C,_.positives=x,p=i(a=C,u=x,"-",!1,l=h)||[],c=i(u,a,"",!1,l)||[],f=i(a,u,"-?",!0,l)||[],_.result=p.concat(f).concat(c).join("|"),!0===h.capture?_.result=`(${_.result})`:!1!==h.wrap&&x.length+C.length>1&&(_.result=`(?:${_.result})`),n.cache[m]=_,_.result};function s(e,t,r,o){let n,s=function(e,t){let r=1,o=1,n=l(e,1),s=new Set([t]);for(;e<=n&&n<=t;)s.add(n),r+=1,n=l(e,r);for(n=p(t+1,o)-1;e<n&&n<=t;)s.add(n),o+=1,n=p(t+1,o)-1;return(s=[...s]).sort(a),s}(e,t),i=[],u=e;for(let e=0;e<s.length;e++){let t=s[e],a=function(e,t,r){if(e===t)return{pattern:e,count:[],digits:0};let o=function(e,t){let r=[];for(let o=0;o<e.length;o++)r.push([e[o],t[o]]);return r}(e,t),n=o.length,s="",i=0;for(let e=0;e<n;e++){var a,u;let[t,r]=o[e];t===r?s+=t:"0"!==t||"9"!==r?s+=(a=t,u=r,`[${a}${u-a==1?"":"-"}${u}]`):i++}return i&&(s+=!0===r.shorthand?"\\d":"[0-9]"),{pattern:s,count:[i],digits:n}}(String(u),String(t),o),l="";if(!r.isPadded&&n&&n.pattern===a.pattern){n.count.length>1&&n.count.pop(),n.count.push(a.count[0]),n.string=n.pattern+c(n.count),u=t+1;continue}r.isPadded&&(l=function(e,t,r){if(!t.isPadded)return e;let o=Math.abs(t.maxLen-String(e).length),n=!1!==r.relaxZeros;switch(o){case 0:return"";case 1:return n?"0?":"0";case 2:return n?"0{0,2}":"00";default:return n?`0{0,${o}}`:`0{${o}}`}}(t,r,o)),a.string=l+a.pattern+c(a.count),i.push(a),u=t+1,n=a}return i}function i(e,t,r,o,n){let s=[];for(let n of e){let{string:e}=n;o||u(t,"string",e)||s.push(r+e),o&&u(t,"string",e)&&s.push(r+e)}return s}function a(e,t){return e>t?1:t>e?-1:0}function u(e,t,r){return e.some(e=>e[t]===r)}function l(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function p(e,t){return e-e%Math.pow(10,t)}function c(e){let[t=0,r=""]=e;return r||t>1?`{${t+(r?","+r:"")}}`:""}function d(e){return/^-?(0+)\d/.test(e)}n.cache={},n.clearCache=()=>n.cache={},e.exports=n}});let u=/(^|,)\s*upgrade\s*($|,)/i,l={http:new e.Agent({keepAlive:!0,maxSockets:256,maxFreeSockets:64}),https:new t.Agent({keepAlive:!0,maxSockets:256,maxFreeSockets:64})},p=/^https|wss/,c=[":method",":path",":scheme",":authority"];function d(e,t,r,o){var n;for(let r of(e.port=t[o||"target"].port||(p.test(t[o||"target"].protocol??"http")?443:80),["host","hostname","socketPath","pfx","key","passphrase","cert","ca","ciphers","secureProtocol"])){let n=t[o||"target"][r];void 0!==n&&(e[r]=n)}if(void 0===e.host&&"string"==typeof e.hostname){let t=e.hostname.includes(":")&&!e.hostname.startsWith("[")?`[${e.hostname}]`:e.hostname;e.host=e.port?`${t}:${e.port}`:t}if(e.method=t.method||r.method,e.headers={...r.headers},r.headers?.[":authority"]&&(e.headers.host=r.headers[":authority"]),t.headers)for(let r of Object.keys(t.headers))e.headers[r]=t.headers[r];if(r.httpVersionMajor>1)for(let t of c)delete e.headers[t];if(t.auth&&(e.auth=t.auth),t.ca&&(e.ca=t.ca),p.test(t[o||"target"].protocol??"http")&&(e.rejectUnauthorized=void 0===t.secure||t.secure),void 0!==t.agent)e.agent=t.agent||!1;else if(r.httpVersionMajor>1||u.test(r.headers.connection||""))e.agent=!1;else{let r=t[o||"target"].protocol??"http";e.agent=p.test(r)?l.https:l.http}e.localAddress=t.localAddress,!e.agent&&(e.headers=e.headers||{},"string"==typeof e.headers.connection&&u.test(e.headers.connection)||(e.headers.connection="close"));let s=t[o||"target"],i=s&&!1!==t.prependPath&&s.pathname||"",a=s instanceof URL&&!1!==t.prependPath&&s.search||"",d=r.url||"",f=d.indexOf("?"),h=-1===f?d:d.slice(0,f),m=-1===f?"":d.slice(f),g=h?"/"===h[0]?h:"/"+h:"/",y=t.toProxy?"/"+d:g+m,b=function(e,t){if(!e||"/"===e)return t||"/";if(!t||"/"===t)return e||"/";let r="/"===e[e.length-1],o="/"===t[0];return r&&o?e+t.slice(1):r||o?e+t:e+"/"+t}(i,y=t.ignorePath?"":y);return a&&(b=b.includes("?")?b.replace("?",a+"&"):b+a),e.path=b,t.changeOrigin&&(e.headers.host=function(e,t){let r=t?.split(":")[0],o=+e;if(!o)return!1;switch(r){case"http":case"ws":return 80!==o;case"https":case"wss":return 443!==o;case"ftp":return 21!==o;case"gopher":return 70!==o;case"file":return!1}return 0!==o}(e.port,t[o||"target"].protocol)&&!((n=e.host)&&~n.indexOf(":"))?e.host+":"+e.port:e.host??void 0),e}function f(e){return e.setTimeout(0),e.setNoDelay(!0),e.setKeepAlive(!0,0),e}function h(e){let t=e.headers[":authority"]||e.headers.host,r=t?t.match(/:(\d+)/):"";return r?r[1]:m(e)?"443":"80"}function m(e){let t=e.socket;return!!t&&"encrypted"in t&&t.encrypted}function g(e,t,r){return Array.isArray(e)?e.map(function(e){return g(e,t,r)}):e.replace(RegExp(String.raw`(;\s*`+r+"=)([^;]+)","i"),function(e,r,o){let n;if(o in t)n=t[o];else{if(!("*"in t))return e;n=t["*"]}return n?r+n:""})}let y=/^201|30([12378])$/,b=[(e,t,r)=>{("1.0"===e.httpVersion||e.httpVersionMajor>=2||204===r.statusCode||304===r.statusCode)&&delete r.headers["transfer-encoding"]},(e,t,r)=>{"1.0"===e.httpVersion?r.headers.connection=e.headers.connection||"close":e.httpVersionMajor<2&&!r.headers.connection?r.headers.connection=e.headers.connection||"keep-alive":e.httpVersionMajor>=2&&delete r.headers.connection},(e,t,r,o)=>{if((o.hostRewrite||o.autoRewrite||o.protocolRewrite)&&r.headers.location&&y.test(String(r.statusCode))){let t=function(e){if(e instanceof URL)return e;if("string"==typeof e)return new URL(e);let t=e.protocol||"http:",r=e.host||e.hostname||"localhost",o=e.port;return new URL(`${t}//${r}${o?":"+o:""}`)}(o.target),n=new URL(r.headers.location,t);t.host===n.host&&(o.hostRewrite?n.host=o.hostRewrite:o.autoRewrite&&(e.headers[":authority"]?n.host=e.headers[":authority"]:e.headers.host&&(n.host=e.headers.host)),o.protocolRewrite&&(n.protocol=o.protocolRewrite),r.headers.location=n.toString())}},(e,t,r,o)=>{let n,s="string"==typeof o.cookieDomainRewrite?{"*":o.cookieDomainRewrite}:o.cookieDomainRewrite,i="string"==typeof o.cookiePathRewrite?{"*":o.cookiePathRewrite}:o.cookiePathRewrite,a=o.preserveHeaderKeyCase;if(a&&void 0!==r.rawHeaders){n={};for(let e=0;e<r.rawHeaders.length;e+=2){let t=r.rawHeaders[e];n[t.toLowerCase()]=t}}for(let e of Object.keys(r.headers)){let o=r.headers[e];a&&n&&(e=n[e]||e);var u=e,l=o;if(void 0!==l&&String(u).trim()){s&&"set-cookie"===u.toLowerCase()&&(l=g(l,s,"domain")),i&&"set-cookie"===u.toLowerCase()&&(l=g(l,i,"path"));try{t.setHeader(String(u).trim(),l)}catch{}}}},(e,t,r)=>{t.statusCode=r.statusCode,r.statusMessage&&e.httpVersionMajor<2&&(t.statusMessage=r.statusMessage)}],_=new Set([301,302,303,307,308]),x=[e=>{"DELETE"!==e.method&&"OPTIONS"!==e.method||e.headers["content-length"]||e.headers["transfer-encoding"]||(e.headers["content-length"]="0")},(e,t,r)=>{r.timeout&&e.socket.setTimeout(r.timeout,()=>{e.socket.destroy()})},(e,t,r)=>{if(!r.xfwd)return;let o=e.isSpdy||m(e),n={for:e.connection.remoteAddress||e.socket.remoteAddress,port:h(e),proto:o?"https":"http"};for(let t of["for","port","proto"]){let r="x-forwarded-"+t;e.headers[r]||void 0===n[t]||(e.headers[r]=n[t])}e.headers["x-forwarded-host"]=e.headers["x-forwarded-host"]||e.headers[":authority"]||e.headers.host||""},(r,o,n,s,i,a)=>{let u;s.emit("start",r,o,n.target||n.forward);let l="number"==typeof n.followRedirects?n.followRedirects:5*!!n.followRedirects;if(n.forward){let s=(p.test(n.forward.protocol||"http")?t:e).request(d(n.ssl||{},n,r,"forward")),i=h(s,n.forward);if(r.on("error",i),s.on("error",i),(n.buffer||r).pipe(s),!n.target)return void o.end()}let c=(p.test(n.target.protocol||"http")?t:e).request(d(n.ssl||{},n,r));c.on("socket",e=>{s&&!c.getHeader("expect")&&s.emit("proxyReq",c,r,o,n)}),n.proxyTimeout&&c.setTimeout(n.proxyTimeout,function(){c.destroy()}),o.on("close",function(){o.writableFinished||c.destroy()});let f=h(c,n.target);function h(e,t){return function(n){if(!r.socket?.writable&&"ECONNRESET"===n.code)return s.emit("econnreset",n,r,o,t),e.destroy();a?a(n,r,o,t):s.emit("error",n,r,o,t)}}if(r.on("error",f),c.on("error",f),l>0){let e=[],t=n.buffer||r;t.on("data",t=>{e.push("string"==typeof t?Buffer.from(t):t),c.write(t)}),t.on("end",()=>{u=Buffer.concat(e),c.end()}),t.on("error",e=>{c.destroy(e)})}else c.on("socket",e=>{e.pending?e.on("connect",()=>(n.buffer||r).pipe(c)):(n.buffer||r).pipe(c)});c.on("response",function(i){!function i(a,c,d){let f=a.statusCode;if(l>0&&_.has(f)&&c<l&&a.headers.location){a.resume();let l=new URL(a.headers.location,d),m=307===f||308===f,g=m&&r.method||"GET",y=p.test(l.protocol),b=y?t:e,_={...r.headers};n.headers&&Object.assign(_,n.headers),_.host=l.host,l.host!==d.host&&(delete _.authorization,delete _.cookie),m||(delete _["content-length"],delete _["content-type"],delete _["transfer-encoding"]);let x={hostname:l.hostname,port:l.port||(y?443:80),path:l.pathname+l.search,method:g,headers:_,agent:n.agent||!1};y&&(x.rejectUnauthorized=void 0===n.secure||n.secure);let C=b.request(x);s&&!C.getHeader("expect")&&s.emit("proxyReq",C,r,o,n),n.proxyTimeout&&C.setTimeout(n.proxyTimeout,()=>{C.destroy()});let R=h(C,l);C.on("error",R),C.on("response",e=>{i(e,c+1,l)}),m&&u&&u.length>0?C.end(u):C.end();return}if(s&&s.emit("proxyRes",a,r,o),!o.headersSent&&!n.selfHandleResponse){for(let e of b)if(e(r,o,a,n))break}o.finished?s&&s.emit("end",r,o,a):(o.on("close",function(){a.destroy()}),a.on("close",function(){a.complete||o.destroyed||o.destroy()}),a.on("error",function(e){o.destroyed||o.destroy(e),s.listenerCount("error")>0&&s.emit("error",e,r,o,d)}),a.on("end",function(){s&&s.emit("end",r,o,a)}),n.selfHandleResponse||a.pipe(o))}(i,0,n.target)})}],C=[(e,t)=>{if("GET"!==e.method||!e.headers.upgrade||"websocket"!==e.headers.upgrade.toLowerCase())return t.destroy(),!0},(e,t,r)=>{if(!r.xfwd)return;let o={for:e.connection.remoteAddress||e.socket.remoteAddress,port:h(e),proto:m(e)?"wss":"ws"};for(let t of["for","port","proto"]){let r="x-forwarded-"+t;e.headers[r]||void 0===o[t]||(e.headers[r]=o[t])}},(r,o,n,s,i,a)=>{let u=function(e,t){return Object.keys(t).reduce(function(e,r){let o=t[r];if(!Array.isArray(o))return e.push(r+": "+o),e;for(let t of o)e.push(r+": "+t);return e},[e]).join("\r\n")+"\r\n\r\n"};f(o),i&&i.length>0&&o.unshift(i),o.on("error",c);let l=(p.test(n.target.protocol||"http")?t:e).request(d(n.ssl||{},n,r));function c(e){a?a(e,r,o):s.emit("error",e,r,o),l.destroy()}function h(e){a?a(e,r,o):s.emit("error",e,r,o),o.end()}s&&s.emit("proxyReqWs",l,r,o,n,i),l.on("error",h),l.on("response",function(e){e.upgrade||(!o.destroyed&&o.writable?(o.write(u("HTTP/"+e.httpVersion+" "+e.statusCode+" "+e.statusMessage,e.headers)),e.on("error",h),e.pipe(o)):e.resume())}),l.on("upgrade",function(e,t,r){t.on("error",h),t.on("end",function(){s.emit("close",e,t,r)}),o.removeListener("error",c),o.on("error",function(){t.end()}),f(t),r&&r.length>0&&t.unshift(r),o.write(u("HTTP/1.1 101 Switching Protocols",e.headers)),t.pipe(o).pipe(t),s.emit("open",t),s.emit("proxySocket",t)}),l.end()}];var R=class extends o{_server;_webPasses=[...x];_wsPasses=[...C];options;web;ws;constructor(e={}){super(),this.options=e||{},this.options.prependPath=!1!==e.prependPath,this.web=A("web",this),this.ws=A("ws",this)}listen(o,n,s){let i=(e,t)=>this.web(e,t);if(this.options.http2){if(!this.options.ssl)throw Error("HTTP/2 requires ssl option");this._server=r.createSecureServer({...this.options.ssl,allowHTTP1:!0},i)}else this.options.ssl?this._server=t.createServer(this.options.ssl,i):this._server=e.createServer(i);return this.options.ws&&this._server.on("upgrade",(e,t,r)=>{this.ws(e,t,this.options,r).catch(()=>{})}),this._server.listen(o,n,s),this}close(e){this._server&&this._server.close((...t)=>{this._server=void 0,e&&Reflect.apply(e,void 0,t)})}before(e,t,r){if("ws"!==e&&"web"!==e)throw Error("type must be `web` or `ws`");let o=this._getPasses(e),n=!1;for(let[e,r]of o.entries())r.name===t&&(n=e);if(!1===n)throw Error("No such pass");o.splice(n,0,r)}after(e,t,r){if("ws"!==e&&"web"!==e)throw Error("type must be `web` or `ws`");let o=this._getPasses(e),n=!1;for(let[e,r]of o.entries())r.name===t&&(n=e);if(!1===n)throw Error("No such pass");o.splice(n++,0,r)}_getPasses(e){return"ws"===e?this._wsPasses:this._webPasses}};function A(e,t){return function(r,o,n,s){let i,a,u={...n,...t.options};for(let e of["target","forward"])"string"==typeof u[e]&&(u[e]=new URL(u[e]));if(!u.target&&!u.forward)return this.emit("error",Error("Must provide a proper URL as target")),Promise.resolve();let l=new Promise((e,t)=>{i=e,a=t});for(let n of(o.on("close",()=>{i()}),o.on("error",e=>{a(e)}),t._getPasses(e))){let e;try{e=n(r,o,u,t,s,(e,n,s,u)=>{t.listenerCount("error")>0?(t.emit("error",e,r,o,u),i()):a(e)})}catch(e){t.listenerCount("error")>0?(t.emit("error",e,r,o,u.target||u.forward),i()):a(e);break}if(e){i();break}}return l}}class v extends Error{code;constructor(e,t){super(e),this.code=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let w=a("../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js")("http-proxy-middleware"),E=w.extend("debug-proxy-errors-plugin"),S=`[HPM] Connection reset (ECONNRESET) detected with non-empty "req.body" [ERR_HPM.GH40].
|
|
2654
3
|
|
|
2655
4
|
This usually means that the POST request body (req.body) was already parsed before reaching the proxy.
|
|
2656
5
|
When bodyParser runs first, it consumes the request stream, leaving the proxy unable to forward the body data to the target server.
|
|
@@ -2659,361 +8,7 @@ let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3_supports-c
|
|
|
2659
8
|
- Option 1: Place the proxy middleware before the bodyParser middleware.
|
|
2660
9
|
- Option 2: Use 'fixRequestBody()' helper to fix this issue.
|
|
2661
10
|
|
|
2662
|
-
For more details, see: https://github.com/chimurai/http-proxy-middleware/issues/40
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
}
|
|
2666
|
-
let debugProxyErrorsPlugin = (proxyServer, options)=>{
|
|
2667
|
-
proxyServer.on('error', (error, req, res, target)=>{
|
|
2668
|
-
debug(`httpxy error event: \n%O`, error), 'ECONNRESET' === error.code && hasParsedBody(req) && console.error(styleText('red', BODY_PARSER_ERROR_MESSAGE));
|
|
2669
|
-
}), proxyServer.on('proxyReq', (proxyReq, req, socket)=>{
|
|
2670
|
-
socket.on('error', (error)=>{
|
|
2671
|
-
debug('Socket error in proxyReq event: \n%O', error);
|
|
2672
|
-
});
|
|
2673
|
-
}), proxyServer.on('proxyRes', (proxyRes, req, res)=>{
|
|
2674
|
-
res.on('close', ()=>{
|
|
2675
|
-
res.writableEnded || (debug('Destroying proxyRes in proxyRes close event'), proxyRes.destroy());
|
|
2676
|
-
});
|
|
2677
|
-
}), proxyServer.on('proxyReqWs', (proxyReq, req, socket)=>{
|
|
2678
|
-
socket.on('error', (error)=>{
|
|
2679
|
-
debug('Socket error in proxyReqWs event: \n%O', error);
|
|
2680
|
-
});
|
|
2681
|
-
}), proxyServer.on('open', (proxySocket)=>{
|
|
2682
|
-
proxySocket.on('error', (error)=>{
|
|
2683
|
-
debug('Socket error in open event: \n%O', error);
|
|
2684
|
-
});
|
|
2685
|
-
}), proxyServer.on('close', (req, socket, head)=>{
|
|
2686
|
-
socket.on('error', (error)=>{
|
|
2687
|
-
debug('Socket error in close event: \n%O', error);
|
|
2688
|
-
});
|
|
2689
|
-
}), proxyServer.on('econnreset', (error, req, res, target)=>{
|
|
2690
|
-
debug(`httpxy econnreset event: \n%O`, error);
|
|
2691
|
-
});
|
|
2692
|
-
};
|
|
2693
|
-
function getStatusCode(errorCode) {
|
|
2694
|
-
let statusCode;
|
|
2695
|
-
if (/HPE_INVALID/.test(errorCode)) return 502;
|
|
2696
|
-
if (/HPM_ERR_INVALID_MULTIPART_/.test(errorCode)) return 400;
|
|
2697
|
-
switch(errorCode){
|
|
2698
|
-
case 'ECONNRESET':
|
|
2699
|
-
case 'ENOTFOUND':
|
|
2700
|
-
case 'ECONNREFUSED':
|
|
2701
|
-
case 'ETIMEDOUT':
|
|
2702
|
-
statusCode = 504;
|
|
2703
|
-
break;
|
|
2704
|
-
default:
|
|
2705
|
-
statusCode = 500;
|
|
2706
|
-
}
|
|
2707
|
-
return statusCode;
|
|
2708
|
-
}
|
|
2709
|
-
function sanitize(input) {
|
|
2710
|
-
return input?.replace(/[<>]/g, (i)=>encodeURIComponent(i)) ?? '';
|
|
2711
|
-
}
|
|
2712
|
-
function isResponseLike(obj) {
|
|
2713
|
-
return obj && 'function' == typeof obj.writeHead;
|
|
2714
|
-
}
|
|
2715
|
-
function isSocketLike(obj) {
|
|
2716
|
-
return obj && 'function' == typeof obj.write && !('writeHead' in obj);
|
|
2717
|
-
}
|
|
2718
|
-
let errorResponsePlugin = (proxyServer, options)=>{
|
|
2719
|
-
proxyServer.on('error', (err, req, res, target)=>{
|
|
2720
|
-
if (!req || !res) throw err;
|
|
2721
|
-
if (isResponseLike(res)) {
|
|
2722
|
-
if (!res.headersSent) {
|
|
2723
|
-
let statusCode = getStatusCode(err.code);
|
|
2724
|
-
res.writeHead(statusCode);
|
|
2725
|
-
}
|
|
2726
|
-
let host = req.headers && req.headers.host;
|
|
2727
|
-
res.end(`Error occurred while trying to proxy: ${sanitize(host)}${sanitize(req.url)}`);
|
|
2728
|
-
} else isSocketLike(res) && res.destroy();
|
|
2729
|
-
});
|
|
2730
|
-
}, noopLogger = {
|
|
2731
|
-
info: ()=>{},
|
|
2732
|
-
warn: ()=>{},
|
|
2733
|
-
error: ()=>{}
|
|
2734
|
-
};
|
|
2735
|
-
function createUrl({ protocol, host, port, path }) {
|
|
2736
|
-
let ipv6Host = host?.includes(':') ? `[${host}]` : host, url = new external_url_URL(`${protocol || 'undefined:'}//${ipv6Host || '[::]'}`);
|
|
2737
|
-
return port && (url.port = port), path && (url.pathname = path), url;
|
|
2738
|
-
}
|
|
2739
|
-
function logger_plugin_getPort(sockets) {
|
|
2740
|
-
return Object.keys(sockets || {})?.[0]?.split(':')[1];
|
|
2741
|
-
}
|
|
2742
|
-
let loggerPlugin = (proxyServer, options)=>{
|
|
2743
|
-
let logger = options.logger || noopLogger;
|
|
2744
|
-
proxyServer.on('error', (err, req, res, target)=>{
|
|
2745
|
-
let hostname = req?.headers?.host, requestHref = `${hostname}${req?.url}`, targetHref = `${target?.href}`;
|
|
2746
|
-
logger.error('[HPM] Error occurred while proxying request %s to %s [%s] (%s)', requestHref, targetHref, err.code || err, 'https://nodejs.org/api/errors.html#errors_common_system_errors');
|
|
2747
|
-
}), proxyServer.on('proxyRes', (proxyRes, req, res)=>{
|
|
2748
|
-
let target, originalUrl = req.originalUrl ?? `${req.baseUrl || ''}${req.url}`;
|
|
2749
|
-
try {
|
|
2750
|
-
let port = logger_plugin_getPort(proxyRes.req?.agent?.sockets), { protocol, host, path } = proxyRes.req;
|
|
2751
|
-
target = createUrl({
|
|
2752
|
-
protocol,
|
|
2753
|
-
host,
|
|
2754
|
-
port,
|
|
2755
|
-
path
|
|
2756
|
-
});
|
|
2757
|
-
} catch (err) {
|
|
2758
|
-
console.error('[HPM] Unexpected error while creating target URL', err), (target = new external_node_url_URL(options.target)).pathname = proxyRes.req.path;
|
|
2759
|
-
}
|
|
2760
|
-
let targetUrl = target.toString(), exchange = `[HPM] ${req.method} ${originalUrl} -> ${targetUrl} [${proxyRes.statusCode}]`;
|
|
2761
|
-
logger.info(exchange);
|
|
2762
|
-
}), proxyServer.on('open', (socket)=>{
|
|
2763
|
-
logger.info('[HPM] Client connected: %o', socket.address());
|
|
2764
|
-
}), proxyServer.on('close', (req, proxySocket, proxyHead)=>{
|
|
2765
|
-
logger.info('[HPM] Client disconnected: %o', proxySocket.address());
|
|
2766
|
-
});
|
|
2767
|
-
};
|
|
2768
|
-
function function_getFunctionName(fn) {
|
|
2769
|
-
return fn.name || '[anonymous Function]';
|
|
2770
|
-
}
|
|
2771
|
-
let proxy_events_debug = Debug.extend('proxy-events-plugin'), proxyEventsPlugin = (proxyServer, options)=>{
|
|
2772
|
-
let eventName;
|
|
2773
|
-
if (options.on) {
|
|
2774
|
-
for(eventName in options.on)if (Object.prototype.hasOwnProperty.call(options.on, eventName)) {
|
|
2775
|
-
let handler = options.on[eventName];
|
|
2776
|
-
if (!handler) continue;
|
|
2777
|
-
proxy_events_debug(`register event handler: "${eventName}" -> "${function_getFunctionName(handler)}"`), proxyServer.on(eventName, handler);
|
|
2778
|
-
}
|
|
2779
|
-
}
|
|
2780
|
-
};
|
|
2781
|
-
function getPlugins(options) {
|
|
2782
|
-
let maybeErrorResponsePlugin = options.on?.error ? [] : [
|
|
2783
|
-
errorResponsePlugin
|
|
2784
|
-
];
|
|
2785
|
-
return [
|
|
2786
|
-
...options.ejectPlugins ? [] : [
|
|
2787
|
-
debugProxyErrorsPlugin,
|
|
2788
|
-
proxyEventsPlugin,
|
|
2789
|
-
loggerPlugin,
|
|
2790
|
-
...maybeErrorResponsePlugin
|
|
2791
|
-
],
|
|
2792
|
-
...options.plugins ?? []
|
|
2793
|
-
];
|
|
2794
|
-
}
|
|
2795
|
-
let is_glob = __webpack_require__("../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js"), micromatch = __webpack_require__("../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js");
|
|
2796
|
-
function matchPathFilter(pathFilter = '/', uri, req) {
|
|
2797
|
-
if (isStringPath(pathFilter)) return matchSingleStringPath(pathFilter, uri);
|
|
2798
|
-
if (isGlobPath(pathFilter)) return matchSingleGlobPath(pathFilter, uri);
|
|
2799
|
-
if (Array.isArray(pathFilter)) {
|
|
2800
|
-
if (pathFilter.every(isStringPath)) return matchMultiPath(pathFilter, uri);
|
|
2801
|
-
if (pathFilter.every(isGlobPath)) return matchMultiGlobPath(pathFilter, uri);
|
|
2802
|
-
throw new errors_HttpProxyMiddlewareError('[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"].', 'HPM_INVALID_PATH_FILTER_ARRAY_CONFIG');
|
|
2803
|
-
}
|
|
2804
|
-
if ('function' == typeof pathFilter) return !!pathFilter(getUrlPathName(uri), req);
|
|
2805
|
-
throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathFilter. Expecting something like: "/api" or ["/api", "/ajax"]', 'HPM_INVALID_PATH_FILTER_CONFIG');
|
|
2806
|
-
}
|
|
2807
|
-
function matchSingleStringPath(pathFilter, uri) {
|
|
2808
|
-
let pathname = getUrlPathName(uri);
|
|
2809
|
-
return pathname?.indexOf(pathFilter) === 0;
|
|
2810
|
-
}
|
|
2811
|
-
function matchSingleGlobPath(pattern, uri) {
|
|
2812
|
-
let matches = micromatch([
|
|
2813
|
-
getUrlPathName(uri)
|
|
2814
|
-
], pattern);
|
|
2815
|
-
return matches && matches.length > 0;
|
|
2816
|
-
}
|
|
2817
|
-
function matchMultiGlobPath(patternList, uri) {
|
|
2818
|
-
return matchSingleGlobPath(patternList, uri);
|
|
2819
|
-
}
|
|
2820
|
-
function matchMultiPath(pathFilterList, uri) {
|
|
2821
|
-
let isMultiPath = !1;
|
|
2822
|
-
for (let context of pathFilterList)if (matchSingleStringPath(context, uri)) {
|
|
2823
|
-
isMultiPath = !0;
|
|
2824
|
-
break;
|
|
2825
|
-
}
|
|
2826
|
-
return isMultiPath;
|
|
2827
|
-
}
|
|
2828
|
-
function getUrlPathName(uri) {
|
|
2829
|
-
return uri && new URL(uri, 'http://0.0.0.0').pathname;
|
|
2830
|
-
}
|
|
2831
|
-
function isStringPath(pathFilter) {
|
|
2832
|
-
return 'string' == typeof pathFilter && !is_glob(pathFilter);
|
|
2833
|
-
}
|
|
2834
|
-
function isGlobPath(pathFilter) {
|
|
2835
|
-
return is_glob(pathFilter);
|
|
2836
|
-
}
|
|
2837
|
-
function isPlainObject(value) {
|
|
2838
|
-
if ('object' != typeof value || null === value) return !1;
|
|
2839
|
-
let prototype = Object.getPrototypeOf(value);
|
|
2840
|
-
return (null === prototype || prototype === Object.prototype || null === Object.getPrototypeOf(prototype)) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
2841
|
-
}
|
|
2842
|
-
let path_rewriter_debug = Debug.extend('path-rewriter');
|
|
2843
|
-
function createPathRewriter(rewriteConfig) {
|
|
2844
|
-
let rulesCache;
|
|
2845
|
-
if (isValidRewriteConfig(rewriteConfig)) if ('function' == typeof rewriteConfig) return rewriteConfig;
|
|
2846
|
-
else return rulesCache = parsePathRewriteRules(rewriteConfig), rewritePath;
|
|
2847
|
-
function rewritePath(path) {
|
|
2848
|
-
let result = path;
|
|
2849
|
-
for (let rule of rulesCache)if (rule.regex.test(path)) {
|
|
2850
|
-
path_rewriter_debug('rewriting path from "%s" to "%s"', path, result = result.replace(rule.regex, rule.value));
|
|
2851
|
-
break;
|
|
2852
|
-
}
|
|
2853
|
-
return result;
|
|
2854
|
-
}
|
|
2855
|
-
}
|
|
2856
|
-
function isValidRewriteConfig(rewriteConfig) {
|
|
2857
|
-
if ('function' == typeof rewriteConfig) return !0;
|
|
2858
|
-
if (isPlainObject(rewriteConfig)) return 0 !== Object.keys(rewriteConfig).length;
|
|
2859
|
-
if (null == rewriteConfig) return !1;
|
|
2860
|
-
throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function', 'HPM_INVALID_PATH_REWRITER_CONFIG');
|
|
2861
|
-
}
|
|
2862
|
-
function parsePathRewriteRules(rewriteConfig) {
|
|
2863
|
-
let rules = [];
|
|
2864
|
-
if (isPlainObject(rewriteConfig)) for (let [key, value] of Object.entries(rewriteConfig))rules.push({
|
|
2865
|
-
regex: new RegExp(key),
|
|
2866
|
-
value: value
|
|
2867
|
-
}), path_rewriter_debug('rewrite rule created: "%s" ~> "%s"', key, value);
|
|
2868
|
-
return rules;
|
|
2869
|
-
}
|
|
2870
|
-
let router_debug = Debug.extend('router');
|
|
2871
|
-
async function getTarget(req, res, config) {
|
|
2872
|
-
let newTarget, router = config.router;
|
|
2873
|
-
return isPlainObject(router) ? newTarget = getTargetFromProxyTable(req, router) : 'function' == typeof router && (newTarget = await router(req, res, config)), newTarget;
|
|
2874
|
-
}
|
|
2875
|
-
function getTargetFromProxyTable(req, table) {
|
|
2876
|
-
let result, host = req.headers.host ?? '', path = req.url ?? '';
|
|
2877
|
-
for (let [key, value] of Object.entries(table))if (containsPath(key)) {
|
|
2878
|
-
if (isHostAndPathKey(key)) {
|
|
2879
|
-
let [keyHost, keyPath] = splitHostAndPathKey(key);
|
|
2880
|
-
if (host === keyHost && path.startsWith(keyPath)) {
|
|
2881
|
-
router_debug('match: "%s" -> "%s"', key, result = value);
|
|
2882
|
-
break;
|
|
2883
|
-
}
|
|
2884
|
-
} else if (path.startsWith(key)) {
|
|
2885
|
-
router_debug('match: "%s" -> "%s"', key, result = value);
|
|
2886
|
-
break;
|
|
2887
|
-
}
|
|
2888
|
-
} else if (key === host) {
|
|
2889
|
-
router_debug('match: "%s" -> "%s"', host, result = value);
|
|
2890
|
-
break;
|
|
2891
|
-
}
|
|
2892
|
-
return result;
|
|
2893
|
-
}
|
|
2894
|
-
function containsPath(v) {
|
|
2895
|
-
return v.indexOf('/') > -1;
|
|
2896
|
-
}
|
|
2897
|
-
function isHostAndPathKey(v) {
|
|
2898
|
-
return containsPath(v) && !v.startsWith('/');
|
|
2899
|
-
}
|
|
2900
|
-
function splitHostAndPathKey(v) {
|
|
2901
|
-
let firstSlash = v.indexOf('/');
|
|
2902
|
-
return [
|
|
2903
|
-
v.slice(0, firstSlash),
|
|
2904
|
-
v.slice(firstSlash)
|
|
2905
|
-
];
|
|
2906
|
-
}
|
|
2907
|
-
let ipv6_debug = Debug.extend('ipv6');
|
|
2908
|
-
function normalizeIPv6LiteralTargets(options) {
|
|
2909
|
-
options.target = normalizeIPv6ProxyTarget(options.target, 'target'), options.forward = normalizeIPv6ProxyTarget(options.forward, 'forward');
|
|
2910
|
-
}
|
|
2911
|
-
function normalizeIPv6ProxyTarget(target, optionName) {
|
|
2912
|
-
let targetUrl = toTargetUrl(target);
|
|
2913
|
-
if (targetUrl && isBracketedIPv6Hostname(targetUrl.hostname)) {
|
|
2914
|
-
let normalizedHostname = normalizeIPv6DestinationHostname(stripBrackets(targetUrl.hostname));
|
|
2915
|
-
return ipv6_debug('normalized IPv6 "%s" %s', optionName, target), {
|
|
2916
|
-
hostname: normalizedHostname,
|
|
2917
|
-
auth: targetUrl.username || targetUrl.password ? `${targetUrl.username}:${targetUrl.password}` : void 0,
|
|
2918
|
-
pathname: targetUrl.pathname,
|
|
2919
|
-
port: targetUrl.port,
|
|
2920
|
-
protocol: targetUrl.protocol,
|
|
2921
|
-
search: targetUrl.search
|
|
2922
|
-
};
|
|
2923
|
-
}
|
|
2924
|
-
return target;
|
|
2925
|
-
}
|
|
2926
|
-
function toTargetUrl(target) {
|
|
2927
|
-
return 'string' == typeof target ? new URL(target) : target instanceof URL ? target : void 0;
|
|
2928
|
-
}
|
|
2929
|
-
function isBracketedIPv6Hostname(hostname) {
|
|
2930
|
-
return hostname.startsWith('[') && hostname.endsWith(']');
|
|
2931
|
-
}
|
|
2932
|
-
function stripBrackets(hostname) {
|
|
2933
|
-
return hostname.replace(/^\[|\]$/g, '');
|
|
2934
|
-
}
|
|
2935
|
-
function normalizeIPv6DestinationHostname(hostname) {
|
|
2936
|
-
return '::' === hostname ? (ipv6_debug('normalizing hostname unspecified IPv6 address (::) to loopback (::1)'), '::1') : hostname;
|
|
2937
|
-
}
|
|
2938
|
-
class HttpProxyMiddleware {
|
|
2939
|
-
wsInternalSubscribedServers = new WeakSet();
|
|
2940
|
-
activeServers = new Set();
|
|
2941
|
-
proxyOptions;
|
|
2942
|
-
proxy;
|
|
2943
|
-
pathRewriter;
|
|
2944
|
-
logger;
|
|
2945
|
-
constructor(options){
|
|
2946
|
-
verifyConfig(options), this.proxyOptions = options, this.logger = options.logger || noopLogger, Debug("create proxy server"), this.proxy = createProxyServer({}), this.registerPlugins(this.proxy, this.proxyOptions), this.pathRewriter = createPathRewriter(this.proxyOptions.pathRewrite), this.middleware.upgrade = (req, socket, head)=>{
|
|
2947
|
-
let server = this.#getServer(req);
|
|
2948
|
-
server && !this.wsInternalSubscribedServers.has(server) && this.handleUpgrade(req, socket, head);
|
|
2949
|
-
};
|
|
2950
|
-
}
|
|
2951
|
-
#getServer(req) {
|
|
2952
|
-
return req.socket?.server;
|
|
2953
|
-
}
|
|
2954
|
-
middleware = async (req, res, next)=>{
|
|
2955
|
-
if (this.shouldProxy(this.proxyOptions.pathFilter, req)) {
|
|
2956
|
-
let activeProxyOptions;
|
|
2957
|
-
try {
|
|
2958
|
-
if (!(activeProxyOptions = await this.prepareProxyRequest(req, res)).target && !activeProxyOptions.forward) throw Error('Must provide a proper URL as target');
|
|
2959
|
-
} catch (err) {
|
|
2960
|
-
next?.(err);
|
|
2961
|
-
return;
|
|
2962
|
-
}
|
|
2963
|
-
try {
|
|
2964
|
-
Debug("proxy request to target: %O", activeProxyOptions.target), await this.proxy.web(req, res, activeProxyOptions);
|
|
2965
|
-
} catch (err) {
|
|
2966
|
-
this.proxy.emit('error', err, req, res, activeProxyOptions.target), next?.(err);
|
|
2967
|
-
}
|
|
2968
|
-
} else next?.();
|
|
2969
|
-
let server = this.#getServer(req);
|
|
2970
|
-
server && !this.activeServers.has(server) && (Debug('registering server close listener'), this.activeServers.add(server), server.on('close', ()=>{
|
|
2971
|
-
(Debug('server close signal received.'), this.activeServers.delete(server), this.activeServers.size > 0) ? Debug(`proxy server not closed: ${this.activeServers.size} server(s) still active`) : (Debug('closing proxy server'), this.proxy.close(()=>Debug('proxy server closed')));
|
|
2972
|
-
})), !0 === this.proxyOptions.ws && server && this.catchUpgradeRequest(server);
|
|
2973
|
-
};
|
|
2974
|
-
registerPlugins(proxy, options) {
|
|
2975
|
-
getPlugins(options).forEach((plugin)=>{
|
|
2976
|
-
Debug(`register plugin: "${function_getFunctionName(plugin)}"`), plugin(proxy, options);
|
|
2977
|
-
});
|
|
2978
|
-
}
|
|
2979
|
-
catchUpgradeRequest = (server)=>{
|
|
2980
|
-
this.wsInternalSubscribedServers.has(server) || (Debug('subscribing to server upgrade event'), server.on('upgrade', this.handleUpgrade), this.wsInternalSubscribedServers.add(server));
|
|
2981
|
-
};
|
|
2982
|
-
handleUpgrade = async (req, socket, head)=>{
|
|
2983
|
-
try {
|
|
2984
|
-
if (this.shouldProxy(this.proxyOptions.pathFilter, req)) {
|
|
2985
|
-
let activeProxyOptions = await this.prepareProxyRequest(req, void 0);
|
|
2986
|
-
await this.proxy.ws(req, socket, activeProxyOptions, head), Debug('server upgrade event received. Proxying WebSocket');
|
|
2987
|
-
}
|
|
2988
|
-
} catch (err) {
|
|
2989
|
-
this.proxy.emit('error', err, req, socket);
|
|
2990
|
-
}
|
|
2991
|
-
};
|
|
2992
|
-
shouldProxy = (pathFilter, req)=>{
|
|
2993
|
-
try {
|
|
2994
|
-
return matchPathFilter(pathFilter, req.url, req);
|
|
2995
|
-
} catch (err) {
|
|
2996
|
-
return Debug('Error: matchPathFilter() called with request url: ', `"${req.url}"`), this.logger.error(err), !1;
|
|
2997
|
-
}
|
|
2998
|
-
};
|
|
2999
|
-
prepareProxyRequest = async (req, res)=>{
|
|
3000
|
-
let newProxyOptions = Object.assign({}, this.proxyOptions);
|
|
3001
|
-
return await this.applyRouter(req, res, newProxyOptions), normalizeIPv6LiteralTargets(newProxyOptions), await this.applyPathRewrite(req, res, this.pathRewriter, newProxyOptions), newProxyOptions;
|
|
3002
|
-
};
|
|
3003
|
-
applyRouter = async (req, res, options)=>{
|
|
3004
|
-
let newTarget;
|
|
3005
|
-
options.router && (newTarget = await getTarget(req, res, options)) && (Debug('router new target: "%s"', newTarget), options.target = newTarget);
|
|
3006
|
-
};
|
|
3007
|
-
applyPathRewrite = async (req, res, pathRewriter, options)=>{
|
|
3008
|
-
if (req.url && pathRewriter) {
|
|
3009
|
-
let path = await pathRewriter(req.url, req, res, options);
|
|
3010
|
-
'string' == typeof path ? (Debug('pathRewrite new path: %s', path), req.url = path) : Debug('pathRewrite: no rewritten path found: %s', req.url);
|
|
3011
|
-
}
|
|
3012
|
-
};
|
|
3013
|
-
}
|
|
3014
|
-
function createProxyMiddleware(options) {
|
|
3015
|
-
let { middleware } = new HttpProxyMiddleware(options);
|
|
3016
|
-
return middleware;
|
|
3017
|
-
}
|
|
3018
|
-
Debug.extend('response-interceptor');
|
|
3019
|
-
export { createProxyMiddleware };
|
|
11
|
+
For more details, see: https://github.com/chimurai/http-proxy-middleware/issues/40
|
|
12
|
+
`,$=(e,t)=>{e.on("error",(e,t,r,o)=>{E(`httpxy error event:
|
|
13
|
+
%O`,e),"ECONNRESET"===e.code&&t&&"POST"===t.method&&"body"in t&&t.body&&console.error(n("red",S))}),e.on("proxyReq",(e,t,r)=>{r.on("error",e=>{E("Socket error in proxyReq event: \n%O",e)})}),e.on("proxyRes",(e,t,r)=>{r.on("close",()=>{r.writableEnded||(E("Destroying proxyRes in proxyRes close event"),e.destroy())})}),e.on("proxyReqWs",(e,t,r)=>{r.on("error",e=>{E("Socket error in proxyReqWs event: \n%O",e)})}),e.on("open",e=>{e.on("error",e=>{E("Socket error in open event: \n%O",e)})}),e.on("close",(e,t,r)=>{t.on("error",e=>{E("Socket error in close event: \n%O",e)})}),e.on("econnreset",(e,t,r,o)=>{E(`httpxy econnreset event:
|
|
14
|
+
%O`,e)})};function O(e){return e?.replace(/[<>]/g,e=>encodeURIComponent(e))??""}let k=(e,t)=>{e.on("error",(e,t,r,o)=>{if(!t||!r)throw e;if(r&&"function"==typeof r.writeHead){if(!r.headersSent){let t=function(e){let t;if(/HPE_INVALID/.test(e))return 502;if(/HPM_ERR_INVALID_MULTIPART_/.test(e))return 400;switch(e){case"ECONNRESET":case"ENOTFOUND":case"ECONNREFUSED":case"ETIMEDOUT":t=504;break;default:t=500}return t}(e.code);r.writeHead(t)}let o=t.headers&&t.headers.host;r.end(`Error occurred while trying to proxy: ${O(o)}${O(t.url)}`)}else!r||"function"!=typeof r.write||"writeHead"in r||r.destroy()})},H={info:()=>{},warn:()=>{},error:()=>{}},T=(e,t)=>{let r=t.logger||H;e.on("error",(e,t,o,n)=>{let s=t?.headers?.host,i=`${s}${t?.url}`,a=`${n?.href}`;r.error("[HPM] Error occurred while proxying request %s to %s [%s] (%s)",i,a,e.code||e,"https://nodejs.org/api/errors.html#errors_common_system_errors")}),e.on("proxyRes",(e,o,n)=>{let a,u=o.originalUrl??`${o.baseUrl||""}${o.url}`;try{var l;let t=(l=e.req?.agent?.sockets,Object.keys(l||{})?.[0]?.split(":")[1]),{protocol:r,host:o,path:n}=e.req;a=function({protocol:e,host:t,port:r,path:o}){let n=t?.includes(":")?`[${t}]`:t,s=new i(`${e||"undefined:"}//${n||"[::]"}`);return r&&(s.port=r),o&&(s.pathname=o),s}({protocol:r,host:o,port:t,path:n})}catch(r){console.error("[HPM] Unexpected error while creating target URL",r),(a=new s(t.target)).pathname=e.req.path}let p=a.toString(),c=`[HPM] ${o.method} ${u} -> ${p} [${e.statusCode}]`;r.info(c)}),e.on("open",e=>{r.info("[HPM] Client connected: %o",e.address())}),e.on("close",(e,t,o)=>{r.info("[HPM] Client disconnected: %o",t.address())})};function L(e){return e.name||"[anonymous Function]"}let I=w.extend("proxy-events-plugin"),F=(e,t)=>{let r;if(t.on){for(r in t.on)if(Object.prototype.hasOwnProperty.call(t.on,r)){let o=t.on[r];if(!o)continue;I(`register event handler: "${r}" -> "${L(o)}"`),e.on(r,o)}}},P=a("../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js"),j=a("../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js");function N(e,t){let r=U(t);return r?.indexOf(e)===0}function M(e,t){let r=j([U(t)],e);return r&&r.length>0}function U(e){return e&&new URL(e,"http://0.0.0.0").pathname}function B(e){return"string"==typeof e&&!P(e)}function D(e){return P(e)}function G(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let q=w.extend("path-rewriter"),K=w.extend("router");async function W(e,t,r){let o,n=r.router;return G(n)?o=function(e,t){let r,o=e.headers.host??"",n=e.url??"";for(let[e,i]of Object.entries(t))if(Z(e)){var s;if(Z(s=e)&&!s.startsWith("/")){let[t,s]=function(e){let t=e.indexOf("/");return[e.slice(0,t),e.slice(t)]}(e);if(o===t&&n.startsWith(s)){K('match: "%s" -> "%s"',e,r=i);break}}else if(n.startsWith(e)){K('match: "%s" -> "%s"',e,r=i);break}}else if(e===o){K('match: "%s" -> "%s"',o,r=i);break}return r}(e,n):"function"==typeof n&&(o=await n(e,t,r)),o}function Z(e){return e.indexOf("/")>-1}let z=w.extend("ipv6");function Q(e,t){var r,o,n;let s="string"==typeof(r=e)?new URL(r):r instanceof URL?r:void 0;if(s&&(o=s.hostname).startsWith("[")&&o.endsWith("]")){let r="::"===(n=s.hostname.replace(/^\[|\]$/g,""))?(z("normalizing hostname unspecified IPv6 address (::) to loopback (::1)"),"::1"):n;return z('normalized IPv6 "%s" %s',t,e),{hostname:r,auth:s.username||s.password?`${s.username}:${s.password}`:void 0,pathname:s.pathname,port:s.port,protocol:s.protocol,search:s.search}}return e}class V{wsInternalSubscribedServers=new WeakSet;activeServers=new Set;proxyOptions;proxy;pathRewriter;logger;constructor(e){if(!e.target&&!e.router)throw new v('[HPM] Missing "target" option. Example: {target: "http://www.example.org"}',"ERR_CONFIG_FACTORY_TARGET_MISSING");this.proxyOptions=e,this.logger=e.logger||H,w("create proxy server"),this.proxy=function(e={}){return new R(e)}({}),this.registerPlugins(this.proxy,this.proxyOptions),this.pathRewriter=function(e){let t;if(function(e){if("function"==typeof e)return!0;if(G(e))return 0!==Object.keys(e).length;if(null==e)return!1;throw new v("[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function","HPM_INVALID_PATH_REWRITER_CONFIG")}(e))if("function"==typeof e)return e;else return t=function(e){let t=[];if(G(e))for(let[r,o]of Object.entries(e))t.push({regex:new RegExp(r),value:o}),q('rewrite rule created: "%s" ~> "%s"',r,o);return t}(e),function(e){let r=e;for(let o of t)if(o.regex.test(e)){q('rewriting path from "%s" to "%s"',e,r=r.replace(o.regex,o.value));break}return r}}(this.proxyOptions.pathRewrite),this.middleware.upgrade=(e,t,r)=>{let o=this.#e(e);o&&!this.wsInternalSubscribedServers.has(o)&&this.handleUpgrade(e,t,r)}}#e(e){return e.socket?.server}middleware=async(e,t,r)=>{if(this.shouldProxy(this.proxyOptions.pathFilter,e)){let o;try{if(!(o=await this.prepareProxyRequest(e,t)).target&&!o.forward)throw Error("Must provide a proper URL as target")}catch(e){r?.(e);return}try{w("proxy request to target: %O",o.target),await this.proxy.web(e,t,o)}catch(n){this.proxy.emit("error",n,e,t,o.target),r?.(n)}}else r?.();let o=this.#e(e);o&&!this.activeServers.has(o)&&(w("registering server close listener"),this.activeServers.add(o),o.on("close",()=>{(w("server close signal received."),this.activeServers.delete(o),this.activeServers.size>0)?w(`proxy server not closed: ${this.activeServers.size} server(s) still active`):(w("closing proxy server"),this.proxy.close(()=>w("proxy server closed")))})),!0===this.proxyOptions.ws&&o&&this.catchUpgradeRequest(o)};registerPlugins(e,t){let r;(r=t.on?.error?[]:[k],[...t.ejectPlugins?[]:[$,F,T,...r],...t.plugins??[]]).forEach(r=>{w(`register plugin: "${L(r)}"`),r(e,t)})}catchUpgradeRequest=e=>{this.wsInternalSubscribedServers.has(e)||(w("subscribing to server upgrade event"),e.on("upgrade",this.handleUpgrade),this.wsInternalSubscribedServers.add(e))};handleUpgrade=async(e,t,r)=>{try{if(this.shouldProxy(this.proxyOptions.pathFilter,e)){let o=await this.prepareProxyRequest(e,void 0);await this.proxy.ws(e,t,o,r),w("server upgrade event received. Proxying WebSocket")}}catch(r){this.proxy.emit("error",r,e,t)}};shouldProxy=(e,t)=>{try{return function(e="/",t,r){if(B(e))return N(e,t);if(D(e))return M(e,t);if(Array.isArray(e)){if(e.every(B)){var o,n,s=e,i=t;let r=!1;for(let e of s)if(N(e,i)){r=!0;break}return r}if(e.every(D)){return o=e,n=t,M(o,n)}throw new v('[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"].',"HPM_INVALID_PATH_FILTER_ARRAY_CONFIG")}if("function"==typeof e)return!!e(U(t),r);throw new v('[HPM] Invalid pathFilter. Expecting something like: "/api" or ["/api", "/ajax"]',"HPM_INVALID_PATH_FILTER_CONFIG")}(e,t.url,t)}catch(e){return w("Error: matchPathFilter() called with request url: ",`"${t.url}"`),this.logger.error(e),!1}};prepareProxyRequest=async(e,t)=>{let r=Object.assign({},this.proxyOptions);return await this.applyRouter(e,t,r),r.target=Q(r.target,"target"),r.forward=Q(r.forward,"forward"),await this.applyPathRewrite(e,t,this.pathRewriter,r),r};applyRouter=async(e,t,r)=>{let o;r.router&&(o=await W(e,t,r))&&(w('router new target: "%s"',o),r.target=o)};applyPathRewrite=async(e,t,r,o)=>{if(e.url&&r){let n=await r(e.url,e,t,o);"string"==typeof n?(w("pathRewrite new path: %s",n),e.url=n):w("pathRewrite: no rewritten path found: %s",e.url)}}}function X(e){let{middleware:t}=new V(e);return t}w.extend("response-interceptor");export{X as createProxyMiddleware};
|