@rsbuild/core 2.0.11 → 2.0.12
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/connect-next/package.json +1 -1
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +80 -8
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.d.ts +4 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -1
- package/dist/756.js +610 -139
- package/dist/client/hmr.js +8 -3
- package/dist/connect-next.js +29 -26
- package/dist/http-proxy-middleware.js +64 -34
- package/dist/launch-editor-middleware.js +53 -44
- package/dist/manifest-plugin.js +7 -6
- package/dist/memfs.js +95 -95
- package/dist/sirv.js +1 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +8 -3
- package/dist-types/types/config.d.ts +10 -5
- package/package.json +35 -35
- package/types.d.ts +3 -2
- package/dist/mrmime.js +0 -445
package/dist/client/hmr.js
CHANGED
|
@@ -38,7 +38,7 @@ const registerOverlay = (createFn, clearFn)=>{
|
|
|
38
38
|
createOverlay = createFn;
|
|
39
39
|
clearOverlay = clearFn;
|
|
40
40
|
};
|
|
41
|
-
function init(token, config, serverHost, serverPort, serverBase, liveReload, browserLogs, logLevel) {
|
|
41
|
+
function init(token, config, serverHost, serverPort, serverBase, liveReload, browserLogs, logLevel, resolveWebSocketUrl) {
|
|
42
42
|
logger.level = logLevel;
|
|
43
43
|
const queuedMessages = [];
|
|
44
44
|
const clientErrors = [];
|
|
@@ -64,6 +64,10 @@ function init(token, config, serverHost, serverPort, serverBase, liveReload, bro
|
|
|
64
64
|
const colon = -1 === protocol.indexOf(':') ? ':' : '';
|
|
65
65
|
return `${protocol}${colon}//${hostname}:${port}${pathname}?token=${token}`;
|
|
66
66
|
}
|
|
67
|
+
function getSocketURL(fallback) {
|
|
68
|
+
const url = formatURL(fallback);
|
|
69
|
+
return resolveWebSocketUrl ? resolveWebSocketUrl(url) : url;
|
|
70
|
+
}
|
|
67
71
|
function clearBuildErrors() {
|
|
68
72
|
if (console.clear && hasBuildErrors) console.clear();
|
|
69
73
|
hasBuildErrors = false;
|
|
@@ -189,7 +193,8 @@ function init(token, config, serverHost, serverPort, serverBase, liveReload, bro
|
|
|
189
193
|
setTimeout(connect, 1000 * 1.5 ** reconnectCount);
|
|
190
194
|
}
|
|
191
195
|
function onSocketError() {
|
|
192
|
-
if (
|
|
196
|
+
if (resolveWebSocketUrl) return;
|
|
197
|
+
if (getSocketURL() !== getSocketURL(true)) {
|
|
193
198
|
logger.error('[rsbuild] WebSocket connection failed. Trying direct connection fallback.');
|
|
194
199
|
removeListeners();
|
|
195
200
|
socket = null;
|
|
@@ -225,7 +230,7 @@ function init(token, config, serverHost, serverPort, serverBase, liveReload, bro
|
|
|
225
230
|
}
|
|
226
231
|
function connect(fallback = false) {
|
|
227
232
|
if (0 === reconnectCount) logger.info('[rsbuild] WebSocket connecting...');
|
|
228
|
-
const socketUrl =
|
|
233
|
+
const socketUrl = getSocketURL(fallback);
|
|
229
234
|
socket = new WebSocket(socketUrl);
|
|
230
235
|
socket.addEventListener('open', onOpen);
|
|
231
236
|
socket.addEventListener('close', onClose);
|
package/dist/connect-next.js
CHANGED
|
@@ -17,15 +17,18 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
17
17
|
return __nested_rspack_require_364__.d(getter, {
|
|
18
18
|
a: getter
|
|
19
19
|
}), getter;
|
|
20
|
-
}, __nested_rspack_require_364__.d = (exports,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
}, __nested_rspack_require_364__.d = (exports, getters, values)=>{
|
|
21
|
+
var define = (defs, kind)=>{
|
|
22
|
+
for(var key in defs)__nested_rspack_require_364__.o(defs, key) && !__nested_rspack_require_364__.o(exports, key) && Object.defineProperty(exports, key, {
|
|
23
|
+
enumerable: !0,
|
|
24
|
+
[kind]: defs[key]
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
define(getters, "get"), define(values, "value");
|
|
25
28
|
}, __nested_rspack_require_364__.add = function(modules) {
|
|
26
29
|
Object.assign(__nested_rspack_require_364__.m, modules);
|
|
27
30
|
}, __nested_rspack_require_364__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __nested_rspack_require_364__.add({
|
|
28
|
-
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js" (module, exports,
|
|
31
|
+
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js" (module, exports, __nested_rspack_require_1796_1815__) {
|
|
29
32
|
let warned;
|
|
30
33
|
function useColors() {
|
|
31
34
|
let m;
|
|
@@ -136,7 +139,7 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
136
139
|
'#FF9933',
|
|
137
140
|
'#FFCC00',
|
|
138
141
|
'#FFCC33'
|
|
139
|
-
], exports.log = console.debug || console.log || (()=>{}), module.exports =
|
|
142
|
+
], exports.log = console.debug || console.log || (()=>{}), module.exports = __nested_rspack_require_1796_1815__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
|
|
140
143
|
let { formatters } = module.exports;
|
|
141
144
|
formatters.j = function(v) {
|
|
142
145
|
try {
|
|
@@ -146,7 +149,7 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
146
149
|
}
|
|
147
150
|
};
|
|
148
151
|
},
|
|
149
|
-
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js" (module, __unused_rspack_exports,
|
|
152
|
+
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js" (module, __unused_rspack_exports, __nested_rspack_require_6962_6981__) {
|
|
150
153
|
module.exports = function setup(env) {
|
|
151
154
|
function selectColor(namespace) {
|
|
152
155
|
let hash = 0;
|
|
@@ -215,16 +218,16 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
215
218
|
function destroy() {
|
|
216
219
|
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
217
220
|
}
|
|
218
|
-
return createDebug.debug = createDebug, createDebug.default = createDebug, createDebug.coerce = coerce, createDebug.disable = disable, createDebug.enable = enable, createDebug.enabled = enabled, createDebug.humanize =
|
|
221
|
+
return createDebug.debug = createDebug, createDebug.default = createDebug, createDebug.coerce = coerce, createDebug.disable = disable, createDebug.enable = enable, createDebug.enabled = enabled, createDebug.humanize = __nested_rspack_require_6962_6981__("./node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"), createDebug.destroy = destroy, Object.keys(env).forEach((key)=>{
|
|
219
222
|
createDebug[key] = env[key];
|
|
220
223
|
}), createDebug.names = [], createDebug.skips = [], createDebug.formatters = {}, createDebug.selectColor = selectColor, createDebug.enable(createDebug.load()), createDebug;
|
|
221
224
|
};
|
|
222
225
|
},
|
|
223
|
-
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js" (module, __unused_rspack_exports,
|
|
224
|
-
"u" < typeof process || 'renderer' === process.type || !0 === process.browser || process.__nwjs ? module.exports =
|
|
226
|
+
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js" (module, __unused_rspack_exports, __nested_rspack_require_13710_13729__) {
|
|
227
|
+
"u" < typeof process || 'renderer' === process.type || !0 === process.browser || process.__nwjs ? module.exports = __nested_rspack_require_13710_13729__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js") : module.exports = __nested_rspack_require_13710_13729__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js");
|
|
225
228
|
},
|
|
226
|
-
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js" (module, exports,
|
|
227
|
-
let tty =
|
|
229
|
+
"./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js" (module, exports, __nested_rspack_require_14228_14247__) {
|
|
230
|
+
let tty = __nested_rspack_require_14228_14247__("tty"), util = __nested_rspack_require_14228_14247__("util");
|
|
228
231
|
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 = [
|
|
229
232
|
6,
|
|
230
233
|
2,
|
|
@@ -234,7 +237,7 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
234
237
|
1
|
|
235
238
|
];
|
|
236
239
|
try {
|
|
237
|
-
let supportsColor =
|
|
240
|
+
let supportsColor = __nested_rspack_require_14228_14247__("./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js");
|
|
238
241
|
supportsColor && (supportsColor.stderr || supportsColor).level >= 2 && (exports.colors = [
|
|
239
242
|
20,
|
|
240
243
|
21,
|
|
@@ -344,7 +347,7 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
344
347
|
exports.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{
|
|
345
348
|
let prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase()), val = process.env[key];
|
|
346
349
|
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;
|
|
347
|
-
}, {}), module.exports =
|
|
350
|
+
}, {}), module.exports = __nested_rspack_require_14228_14247__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
|
|
348
351
|
let { formatters } = module.exports;
|
|
349
352
|
formatters.o = function(v) {
|
|
350
353
|
return this.inspectOpts.colors = this.useColors, util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' ');
|
|
@@ -423,8 +426,8 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
423
426
|
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
|
424
427
|
};
|
|
425
428
|
},
|
|
426
|
-
"./node_modules/.pnpm/finalhandler@2.1.1/node_modules/finalhandler/index.js" (module, __unused_rspack_exports,
|
|
427
|
-
var debug =
|
|
429
|
+
"./node_modules/.pnpm/finalhandler@2.1.1/node_modules/finalhandler/index.js" (module, __unused_rspack_exports, __nested_rspack_require_23493_23512__) {
|
|
430
|
+
var debug = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js")('finalhandler'), encodeUrl = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/encodeurl@2.0.0/node_modules/encodeurl/index.js"), escapeHtml = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/escape-html@1.0.3/node_modules/escape-html/index.js"), onFinished = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js"), parseUrl = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js"), statuses = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js"), isFinished = onFinished.isFinished;
|
|
428
431
|
function createHtmlDocument(message) {
|
|
429
432
|
return '<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>' + escapeHtml(message).replaceAll('\n', '<br>').replaceAll(' ', ' ') + "</pre>\n</body>\n</html>\n";
|
|
430
433
|
}
|
|
@@ -548,9 +551,9 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
548
551
|
throw Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
549
552
|
};
|
|
550
553
|
},
|
|
551
|
-
"./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js" (module, __unused_rspack_exports,
|
|
554
|
+
"./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js" (module, __unused_rspack_exports, __nested_rspack_require_32097_32116__) {
|
|
552
555
|
module.exports = onFinished, module.exports.isFinished = isFinished;
|
|
553
|
-
var asyncHooks = tryRequireAsyncHooks(), first =
|
|
556
|
+
var asyncHooks = tryRequireAsyncHooks(), first = __nested_rspack_require_32097_32116__("./node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js"), defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
|
|
554
557
|
process.nextTick(fn.bind.apply(fn, arguments));
|
|
555
558
|
};
|
|
556
559
|
function onFinished(msg, listener) {
|
|
@@ -604,7 +607,7 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
604
607
|
}
|
|
605
608
|
function tryRequireAsyncHooks() {
|
|
606
609
|
try {
|
|
607
|
-
return
|
|
610
|
+
return __nested_rspack_require_32097_32116__("async_hooks");
|
|
608
611
|
} catch (e) {
|
|
609
612
|
return {};
|
|
610
613
|
}
|
|
@@ -614,8 +617,8 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
614
617
|
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
615
618
|
}
|
|
616
619
|
},
|
|
617
|
-
"./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js" (module, __unused_rspack_exports,
|
|
618
|
-
var url =
|
|
620
|
+
"./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js" (module, __unused_rspack_exports, __nested_rspack_require_36017_36036__) {
|
|
621
|
+
var url = __nested_rspack_require_36017_36036__("url"), parse = url.parse, Url = url.Url;
|
|
619
622
|
function parseurl(req) {
|
|
620
623
|
var url = req.url;
|
|
621
624
|
if (void 0 !== url) {
|
|
@@ -653,8 +656,8 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
653
656
|
}
|
|
654
657
|
module.exports = parseurl, module.exports.original = originalurl;
|
|
655
658
|
},
|
|
656
|
-
"./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js" (module, __unused_rspack_exports,
|
|
657
|
-
var codes =
|
|
659
|
+
"./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js" (module, __unused_rspack_exports, __nested_rspack_require_38488_38507__) {
|
|
660
|
+
var codes = __nested_rspack_require_38488_38507__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json");
|
|
658
661
|
function createMessageToStatusCodeMap(codes) {
|
|
659
662
|
var map = {};
|
|
660
663
|
return Object.keys(codes).forEach(function(code) {
|
|
@@ -700,8 +703,8 @@ __nested_rspack_require_364__.m = __webpack_modules__, __nested_rspack_require_3
|
|
|
700
703
|
504: !0
|
|
701
704
|
};
|
|
702
705
|
},
|
|
703
|
-
"./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js" (module, __unused_rspack_exports,
|
|
704
|
-
let flagForceColor, os =
|
|
706
|
+
"./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js" (module, __unused_rspack_exports, __nested_rspack_require_40780_40799__) {
|
|
707
|
+
let flagForceColor, os = __nested_rspack_require_40780_40799__("os"), tty = __nested_rspack_require_40780_40799__("tty"), hasFlag = __nested_rspack_require_40780_40799__("./node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"), { env } = process;
|
|
705
708
|
function envForceColor() {
|
|
706
709
|
if ('FORCE_COLOR' in env) return 'true' === env.FORCE_COLOR ? 1 : 'false' === env.FORCE_COLOR ? 0 : 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
707
710
|
}
|
|
@@ -2272,6 +2272,10 @@ function setupOutgoing(outgoing, options, req, forward) {
|
|
|
2272
2272
|
let value = options[forward || "target"][e];
|
|
2273
2273
|
void 0 !== value && (outgoing[e] = value);
|
|
2274
2274
|
}
|
|
2275
|
+
if (void 0 === outgoing.host && "string" == typeof outgoing.hostname) {
|
|
2276
|
+
let bracketedHost = outgoing.hostname.includes(":") && !outgoing.hostname.startsWith("[") ? `[${outgoing.hostname}]` : outgoing.hostname;
|
|
2277
|
+
outgoing.host = outgoing.port ? `${bracketedHost}:${outgoing.port}` : bracketedHost;
|
|
2278
|
+
}
|
|
2275
2279
|
if (outgoing.method = options.method || req.method, outgoing.headers = {
|
|
2276
2280
|
...req.headers
|
|
2277
2281
|
}, 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];
|
|
@@ -2621,11 +2625,11 @@ function _createProxyFn(type, server) {
|
|
|
2621
2625
|
}), server._getPasses(type))){
|
|
2622
2626
|
let stop;
|
|
2623
2627
|
try {
|
|
2624
|
-
stop = pass(req, res, requestOptions, server, head, (error)=>{
|
|
2625
|
-
server.listenerCount("error") > 0 ? (server.emit("error", error, req, res), _resolve()) : _reject(error);
|
|
2628
|
+
stop = pass(req, res, requestOptions, server, head, (error, _req, _res, url)=>{
|
|
2629
|
+
server.listenerCount("error") > 0 ? (server.emit("error", error, req, res, url), _resolve()) : _reject(error);
|
|
2626
2630
|
});
|
|
2627
2631
|
} catch (error) {
|
|
2628
|
-
server.listenerCount("error") > 0 ? (server.emit("error", error, req, res), _resolve()) : _reject(error);
|
|
2632
|
+
server.listenerCount("error") > 0 ? (server.emit("error", error, req, res, requestOptions.target || requestOptions.forward), _resolve()) : _reject(error);
|
|
2629
2633
|
break;
|
|
2630
2634
|
}
|
|
2631
2635
|
if (stop) {
|
|
@@ -2640,7 +2644,7 @@ function verifyConfig(options) {
|
|
|
2640
2644
|
if (!options.target && !options.router) throw Error(errors_ERRORS.ERR_CONFIG_FACTORY_TARGET_MISSING);
|
|
2641
2645
|
}
|
|
2642
2646
|
(ERRORS = errors_ERRORS || (errors_ERRORS = {})).ERR_CONFIG_FACTORY_TARGET_MISSING = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}", ERRORS.ERR_CONTEXT_MATCHER_GENERIC = "[HPM] Invalid pathFilter. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]", ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY = "[HPM] Invalid pathFilter. Plain paths (e.g. \"/api\") can not be mixed with globs (e.g. \"/api/**\"). Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"].", ERRORS.ERR_PATH_REWRITER_CONFIG = "[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function";
|
|
2643
|
-
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), debugProxyErrorsPlugin = (proxyServer)=>{
|
|
2647
|
+
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), debugProxyErrorsPlugin = (proxyServer, options)=>{
|
|
2644
2648
|
proxyServer.on('error', (error, req, res, target)=>{
|
|
2645
2649
|
debug(`httpxy error event: \n%O`, error);
|
|
2646
2650
|
}), proxyServer.on('proxyReq', (proxyReq, req, socket)=>{
|
|
@@ -2777,7 +2781,7 @@ function matchPathFilter(pathFilter = '/', uri, req) {
|
|
|
2777
2781
|
if (pathFilter.every(isGlobPath)) return matchMultiGlobPath(pathFilter, uri);
|
|
2778
2782
|
throw Error(errors_ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY);
|
|
2779
2783
|
}
|
|
2780
|
-
if ('function' == typeof pathFilter) return pathFilter(getUrlPathName(uri), req);
|
|
2784
|
+
if ('function' == typeof pathFilter) return !!pathFilter(getUrlPathName(uri), req);
|
|
2781
2785
|
throw Error(errors_ERRORS.ERR_CONTEXT_MATCHER_GENERIC);
|
|
2782
2786
|
}
|
|
2783
2787
|
function matchSingleStringPath(pathFilter, uri) {
|
|
@@ -2844,14 +2848,20 @@ function parsePathRewriteRules(rewriteConfig) {
|
|
|
2844
2848
|
return rules;
|
|
2845
2849
|
}
|
|
2846
2850
|
let router_debug = Debug.extend('router');
|
|
2847
|
-
async function getTarget(req, config) {
|
|
2851
|
+
async function getTarget(req, res, config) {
|
|
2848
2852
|
let newTarget, router = config.router;
|
|
2849
|
-
return isPlainObject(router) ? newTarget = getTargetFromProxyTable(req, router) : 'function' == typeof router && (newTarget = await router(req)), newTarget;
|
|
2853
|
+
return isPlainObject(router) ? newTarget = getTargetFromProxyTable(req, router) : 'function' == typeof router && (newTarget = await router(req, res, config)), newTarget;
|
|
2850
2854
|
}
|
|
2851
2855
|
function getTargetFromProxyTable(req, table) {
|
|
2852
|
-
let result, host = req.headers.host ?? '',
|
|
2856
|
+
let result, host = req.headers.host ?? '', path = req.url ?? '';
|
|
2853
2857
|
for (let [key, value] of Object.entries(table))if (containsPath(key)) {
|
|
2854
|
-
if (
|
|
2858
|
+
if (isHostAndPathKey(key)) {
|
|
2859
|
+
let [keyHost, keyPath] = splitHostAndPathKey(key);
|
|
2860
|
+
if (host === keyHost && path.startsWith(keyPath)) {
|
|
2861
|
+
router_debug('match: "%s" -> "%s"', key, result = value);
|
|
2862
|
+
break;
|
|
2863
|
+
}
|
|
2864
|
+
} else if (path.startsWith(key)) {
|
|
2855
2865
|
router_debug('match: "%s" -> "%s"', key, result = value);
|
|
2856
2866
|
break;
|
|
2857
2867
|
}
|
|
@@ -2864,19 +2874,34 @@ function getTargetFromProxyTable(req, table) {
|
|
|
2864
2874
|
function containsPath(v) {
|
|
2865
2875
|
return v.indexOf('/') > -1;
|
|
2866
2876
|
}
|
|
2877
|
+
function isHostAndPathKey(v) {
|
|
2878
|
+
return containsPath(v) && !v.startsWith('/');
|
|
2879
|
+
}
|
|
2880
|
+
function splitHostAndPathKey(v) {
|
|
2881
|
+
let firstSlash = v.indexOf('/');
|
|
2882
|
+
return [
|
|
2883
|
+
v.slice(0, firstSlash),
|
|
2884
|
+
v.slice(firstSlash)
|
|
2885
|
+
];
|
|
2886
|
+
}
|
|
2867
2887
|
let ipv6_debug = Debug.extend('ipv6');
|
|
2868
2888
|
function normalizeIPv6LiteralTargets(options) {
|
|
2869
2889
|
options.target = normalizeIPv6ProxyTarget(options.target, 'target'), options.forward = normalizeIPv6ProxyTarget(options.forward, 'forward');
|
|
2870
2890
|
}
|
|
2871
2891
|
function normalizeIPv6ProxyTarget(target, optionName) {
|
|
2872
2892
|
let targetUrl = toTargetUrl(target);
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2893
|
+
if (targetUrl && isBracketedIPv6Hostname(targetUrl.hostname)) {
|
|
2894
|
+
let normalizedHostname = normalizeIPv6DestinationHostname(stripBrackets(targetUrl.hostname));
|
|
2895
|
+
return ipv6_debug('normalized IPv6 "%s" %s', optionName, target), {
|
|
2896
|
+
hostname: normalizedHostname,
|
|
2897
|
+
auth: targetUrl.username || targetUrl.password ? `${targetUrl.username}:${targetUrl.password}` : void 0,
|
|
2898
|
+
pathname: targetUrl.pathname,
|
|
2899
|
+
port: targetUrl.port,
|
|
2900
|
+
protocol: targetUrl.protocol,
|
|
2901
|
+
search: targetUrl.search
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
return target;
|
|
2880
2905
|
}
|
|
2881
2906
|
function toTargetUrl(target) {
|
|
2882
2907
|
return 'string' == typeof target ? new URL(target) : target instanceof URL ? target : void 0;
|
|
@@ -2887,23 +2912,30 @@ function isBracketedIPv6Hostname(hostname) {
|
|
|
2887
2912
|
function stripBrackets(hostname) {
|
|
2888
2913
|
return hostname.replace(/^\[|\]$/g, '');
|
|
2889
2914
|
}
|
|
2915
|
+
function normalizeIPv6DestinationHostname(hostname) {
|
|
2916
|
+
return '::' === hostname ? (ipv6_debug('normalizing hostname unspecified IPv6 address (::) to loopback (::1)'), '::1') : hostname;
|
|
2917
|
+
}
|
|
2890
2918
|
class HttpProxyMiddleware {
|
|
2891
|
-
|
|
2892
|
-
|
|
2919
|
+
wsInternalSubscribedServers = new WeakSet();
|
|
2920
|
+
activeServers = new Set();
|
|
2893
2921
|
proxyOptions;
|
|
2894
2922
|
proxy;
|
|
2895
2923
|
pathRewriter;
|
|
2896
2924
|
logger;
|
|
2897
2925
|
constructor(options){
|
|
2898
2926
|
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)=>{
|
|
2899
|
-
|
|
2927
|
+
let server = this.#getServer(req);
|
|
2928
|
+
server && !this.wsInternalSubscribedServers.has(server) && this.handleUpgrade(req, socket, head);
|
|
2900
2929
|
};
|
|
2901
2930
|
}
|
|
2931
|
+
#getServer(req) {
|
|
2932
|
+
return req.socket?.server;
|
|
2933
|
+
}
|
|
2902
2934
|
middleware = async (req, res, next)=>{
|
|
2903
2935
|
if (this.shouldProxy(this.proxyOptions.pathFilter, req)) {
|
|
2904
2936
|
let activeProxyOptions;
|
|
2905
2937
|
try {
|
|
2906
|
-
if (!(activeProxyOptions = await this.prepareProxyRequest(req)).target && !activeProxyOptions.forward) throw Error('Must provide a proper URL as target');
|
|
2938
|
+
if (!(activeProxyOptions = await this.prepareProxyRequest(req, res)).target && !activeProxyOptions.forward) throw Error('Must provide a proper URL as target');
|
|
2907
2939
|
} catch (err) {
|
|
2908
2940
|
next?.(err);
|
|
2909
2941
|
return;
|
|
@@ -2914,12 +2946,10 @@ class HttpProxyMiddleware {
|
|
|
2914
2946
|
this.proxy.emit('error', err, req, res, activeProxyOptions.target), next?.(err);
|
|
2915
2947
|
}
|
|
2916
2948
|
} else next?.();
|
|
2917
|
-
let server = req
|
|
2918
|
-
server && !this.
|
|
2919
|
-
Debug('server close signal received: closing proxy server'), this.proxy.close(()=>
|
|
2920
|
-
|
|
2921
|
-
});
|
|
2922
|
-
}), this.serverOnCloseSubscribed = !0), !0 === this.proxyOptions.ws && server && this.catchUpgradeRequest(server);
|
|
2949
|
+
let server = this.#getServer(req);
|
|
2950
|
+
server && !this.activeServers.has(server) && (Debug('registering server close listener'), this.activeServers.add(server), server.on('close', ()=>{
|
|
2951
|
+
(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')));
|
|
2952
|
+
})), !0 === this.proxyOptions.ws && server && this.catchUpgradeRequest(server);
|
|
2923
2953
|
};
|
|
2924
2954
|
registerPlugins(proxy, options) {
|
|
2925
2955
|
getPlugins(options).forEach((plugin)=>{
|
|
@@ -2927,12 +2957,12 @@ class HttpProxyMiddleware {
|
|
|
2927
2957
|
});
|
|
2928
2958
|
}
|
|
2929
2959
|
catchUpgradeRequest = (server)=>{
|
|
2930
|
-
this.
|
|
2960
|
+
this.wsInternalSubscribedServers.has(server) || (Debug('subscribing to server upgrade event'), server.on('upgrade', this.handleUpgrade), this.wsInternalSubscribedServers.add(server));
|
|
2931
2961
|
};
|
|
2932
2962
|
handleUpgrade = async (req, socket, head)=>{
|
|
2933
2963
|
try {
|
|
2934
2964
|
if (this.shouldProxy(this.proxyOptions.pathFilter, req)) {
|
|
2935
|
-
let activeProxyOptions = await this.prepareProxyRequest(req);
|
|
2965
|
+
let activeProxyOptions = await this.prepareProxyRequest(req, void 0);
|
|
2936
2966
|
await this.proxy.ws(req, socket, activeProxyOptions, head), Debug('server upgrade event received. Proxying WebSocket');
|
|
2937
2967
|
}
|
|
2938
2968
|
} catch (err) {
|
|
@@ -2946,17 +2976,17 @@ class HttpProxyMiddleware {
|
|
|
2946
2976
|
return Debug('Error: matchPathFilter() called with request url: ', `"${req.url}"`), this.logger.error(err), !1;
|
|
2947
2977
|
}
|
|
2948
2978
|
};
|
|
2949
|
-
prepareProxyRequest = async (req)=>{
|
|
2979
|
+
prepareProxyRequest = async (req, res)=>{
|
|
2950
2980
|
let newProxyOptions = Object.assign({}, this.proxyOptions);
|
|
2951
|
-
return await this.applyRouter(req, newProxyOptions), normalizeIPv6LiteralTargets(newProxyOptions), await this.applyPathRewrite(req, this.pathRewriter), newProxyOptions;
|
|
2981
|
+
return await this.applyRouter(req, res, newProxyOptions), normalizeIPv6LiteralTargets(newProxyOptions), await this.applyPathRewrite(req, res, this.pathRewriter, newProxyOptions), newProxyOptions;
|
|
2952
2982
|
};
|
|
2953
|
-
applyRouter = async (req, options)=>{
|
|
2983
|
+
applyRouter = async (req, res, options)=>{
|
|
2954
2984
|
let newTarget;
|
|
2955
|
-
options.router && (newTarget = await getTarget(req, options)) && (Debug('router new target: "%s"', newTarget), options.target = newTarget);
|
|
2985
|
+
options.router && (newTarget = await getTarget(req, res, options)) && (Debug('router new target: "%s"', newTarget), options.target = newTarget);
|
|
2956
2986
|
};
|
|
2957
|
-
applyPathRewrite = async (req, pathRewriter)=>{
|
|
2987
|
+
applyPathRewrite = async (req, res, pathRewriter, options)=>{
|
|
2958
2988
|
if (req.url && pathRewriter) {
|
|
2959
|
-
let path = await pathRewriter(req.url, req);
|
|
2989
|
+
let path = await pathRewriter(req.url, req, res, options);
|
|
2960
2990
|
'string' == typeof path ? (Debug('pathRewrite new path: %s', path), req.url = path) : Debug('pathRewrite: no rewritten path found: %s', req.url);
|
|
2961
2991
|
}
|
|
2962
2992
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
2
2
|
import "./756.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
|
-
"../../node_modules/.pnpm/launch-editor-middleware@2.14.
|
|
5
|
-
let path = __webpack_require__("path?aeb1"), launch = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.
|
|
4
|
+
"../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
5
|
+
let path = __webpack_require__("path?aeb1"), launch = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js");
|
|
6
6
|
module.exports = (specifiedEditor, srcRoot, onErrorCallback)=>('function' == typeof specifiedEditor && (onErrorCallback = specifiedEditor, specifiedEditor = void 0), 'function' == typeof srcRoot && (onErrorCallback = srcRoot, srcRoot = void 0), srcRoot = srcRoot || process.cwd(), function launchEditorMiddleware(req, res) {
|
|
7
7
|
let url;
|
|
8
8
|
try {
|
|
@@ -16,7 +16,7 @@ __webpack_require__.add({
|
|
|
16
16
|
file ? (launch(file.startsWith('file://') ? file : path.resolve(srcRoot, file), specifiedEditor, onErrorCallback), res.end()) : (res.statusCode = 500, res.end('launch-editor-middleware: required query param "file" is missing.'));
|
|
17
17
|
});
|
|
18
18
|
},
|
|
19
|
-
"../../node_modules/.pnpm/launch-editor@2.14.
|
|
19
|
+
"../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js" (module) {
|
|
20
20
|
module.exports = {
|
|
21
21
|
atom: 'atom',
|
|
22
22
|
Brackets: 'brackets',
|
|
@@ -48,7 +48,7 @@ __webpack_require__.add({
|
|
|
48
48
|
zed: 'zed'
|
|
49
49
|
};
|
|
50
50
|
},
|
|
51
|
-
"../../node_modules/.pnpm/launch-editor@2.14.
|
|
51
|
+
"../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js" (module) {
|
|
52
52
|
module.exports = {
|
|
53
53
|
'/Applications/Atom.app/Contents/MacOS/Atom': 'atom',
|
|
54
54
|
'/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',
|
|
@@ -81,7 +81,7 @@ __webpack_require__.add({
|
|
|
81
81
|
'/Applications/Zed.app/Contents/MacOS/zed': 'zed'
|
|
82
82
|
};
|
|
83
83
|
},
|
|
84
|
-
"../../node_modules/.pnpm/launch-editor@2.14.
|
|
84
|
+
"../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js" (module) {
|
|
85
85
|
module.exports = [
|
|
86
86
|
'Brackets.exe',
|
|
87
87
|
'Code.exe',
|
|
@@ -112,7 +112,7 @@ __webpack_require__.add({
|
|
|
112
112
|
'Antigravity.exe'
|
|
113
113
|
];
|
|
114
114
|
},
|
|
115
|
-
"../../node_modules/.pnpm/launch-editor@2.14.
|
|
115
|
+
"../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
116
116
|
let path = __webpack_require__("path?aeb1");
|
|
117
117
|
module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
|
|
118
118
|
switch(path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '')){
|
|
@@ -209,8 +209,35 @@ __webpack_require__.add({
|
|
|
209
209
|
];
|
|
210
210
|
};
|
|
211
211
|
},
|
|
212
|
-
"../../node_modules/.pnpm/launch-editor@2.14.
|
|
213
|
-
let path = __webpack_require__("path?aeb1"), shellQuote = __webpack_require__("../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js"), childProcess = __webpack_require__("child_process"), COMMON_EDITORS_MACOS = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.
|
|
212
|
+
"../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
213
|
+
let path = __webpack_require__("path?aeb1"), shellQuote = __webpack_require__("../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js"), childProcess = __webpack_require__("child_process"), COMMON_EDITORS_MACOS = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js"), COMMON_EDITORS_LINUX = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js"), COMMON_EDITORS_WIN = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js");
|
|
214
|
+
function getEditorFromMacProcesses(output) {
|
|
215
|
+
let processNames = Object.keys(COMMON_EDITORS_MACOS), processList = output.split('\n');
|
|
216
|
+
for(let i = 0; i < processNames.length; i++){
|
|
217
|
+
let processName = processNames[i];
|
|
218
|
+
if (processList.includes(processName)) return COMMON_EDITORS_MACOS[processName];
|
|
219
|
+
let processNameWithoutApplications = processName.replace('/Applications', '');
|
|
220
|
+
if (-1 !== output.indexOf(processNameWithoutApplications)) {
|
|
221
|
+
if (processName !== COMMON_EDITORS_MACOS[processName]) return COMMON_EDITORS_MACOS[processName];
|
|
222
|
+
let runningProcess = processList.find((procName)=>procName.endsWith(processNameWithoutApplications));
|
|
223
|
+
if (void 0 !== runningProcess) return runningProcess;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function getEditorFromWindowsProcesses(output) {
|
|
228
|
+
let runningProcesses = output.split('\r\n');
|
|
229
|
+
for(let i = 0; i < runningProcesses.length; i++){
|
|
230
|
+
let fullProcessPath = runningProcesses[i].trim(), shortProcessName = path.win32.basename(fullProcessPath);
|
|
231
|
+
if (-1 !== COMMON_EDITORS_WIN.indexOf(shortProcessName)) return fullProcessPath;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function getEditorFromLinuxProcesses(output) {
|
|
235
|
+
let processNames = Object.keys(COMMON_EDITORS_LINUX);
|
|
236
|
+
for(let i = 0; i < processNames.length; i++){
|
|
237
|
+
let processName = processNames[i];
|
|
238
|
+
if (-1 !== output.indexOf(processName)) return COMMON_EDITORS_LINUX[processName];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
214
241
|
module.exports = function guessEditor(specifiedEditor) {
|
|
215
242
|
if (specifiedEditor) return shellQuote.parse(specifiedEditor);
|
|
216
243
|
if (process.env.LAUNCH_EDITOR) return [
|
|
@@ -227,37 +254,21 @@ __webpack_require__.add({
|
|
|
227
254
|
'pipe',
|
|
228
255
|
'ignore'
|
|
229
256
|
]
|
|
230
|
-
}).toString(),
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
COMMON_EDITORS_MACOS[processName]
|
|
235
|
-
];
|
|
236
|
-
let processNameWithoutApplications = processName.replace('/Applications', '');
|
|
237
|
-
if (-1 !== output.indexOf(processNameWithoutApplications)) {
|
|
238
|
-
if (processName !== COMMON_EDITORS_MACOS[processName]) return [
|
|
239
|
-
COMMON_EDITORS_MACOS[processName]
|
|
240
|
-
];
|
|
241
|
-
let runningProcess = processList.find((procName)=>procName.endsWith(processNameWithoutApplications));
|
|
242
|
-
if (void 0 !== runningProcess) return [
|
|
243
|
-
runningProcess
|
|
244
|
-
];
|
|
245
|
-
}
|
|
246
|
-
}
|
|
257
|
+
}).toString(), editor = getEditorFromMacProcesses(output);
|
|
258
|
+
if (void 0 !== editor) return [
|
|
259
|
+
editor
|
|
260
|
+
];
|
|
247
261
|
} else if ('win32' === process.platform) {
|
|
248
|
-
let
|
|
262
|
+
let output = childProcess.execSync('powershell -NoProfile -Command "[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"', {
|
|
249
263
|
stdio: [
|
|
250
264
|
'pipe',
|
|
251
265
|
'pipe',
|
|
252
266
|
'ignore'
|
|
253
267
|
]
|
|
254
|
-
}).toString()
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
fullProcessPath
|
|
259
|
-
];
|
|
260
|
-
}
|
|
268
|
+
}).toString(), editor = getEditorFromWindowsProcesses(output);
|
|
269
|
+
if (void 0 !== editor) return [
|
|
270
|
+
editor
|
|
271
|
+
];
|
|
261
272
|
} else if ('linux' === process.platform) {
|
|
262
273
|
let output = childProcess.execSync('ps x --no-heading -o comm --sort=comm', {
|
|
263
274
|
stdio: [
|
|
@@ -265,13 +276,10 @@ __webpack_require__.add({
|
|
|
265
276
|
'pipe',
|
|
266
277
|
'ignore'
|
|
267
278
|
]
|
|
268
|
-
}).toString(),
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
COMMON_EDITORS_LINUX[processName]
|
|
273
|
-
];
|
|
274
|
-
}
|
|
279
|
+
}).toString(), editor = getEditorFromLinuxProcesses(output);
|
|
280
|
+
if (void 0 !== editor) return [
|
|
281
|
+
editor
|
|
282
|
+
];
|
|
275
283
|
}
|
|
276
284
|
} catch (ignoreError) {}
|
|
277
285
|
return process.env.VISUAL ? [
|
|
@@ -281,10 +289,10 @@ __webpack_require__.add({
|
|
|
281
289
|
] : [
|
|
282
290
|
null
|
|
283
291
|
];
|
|
284
|
-
};
|
|
292
|
+
}, module.exports.getEditorFromMacProcesses = getEditorFromMacProcesses, module.exports.getEditorFromWindowsProcesses = getEditorFromWindowsProcesses, module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
|
|
285
293
|
},
|
|
286
|
-
"../../node_modules/.pnpm/launch-editor@2.14.
|
|
287
|
-
let fs = __webpack_require__("fs?8b28"), os = __webpack_require__("os"), path = __webpack_require__("path?aeb1"), colors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"), childProcess = __webpack_require__("child_process"), guessEditor = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.
|
|
294
|
+
"../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
295
|
+
let fs = __webpack_require__("fs?8b28"), os = __webpack_require__("os"), path = __webpack_require__("path?aeb1"), colors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"), childProcess = __webpack_require__("child_process"), guessEditor = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js"), getArgumentsForPosition = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js");
|
|
288
296
|
function wrapErrorCallback(cb) {
|
|
289
297
|
return (fileName, errorMessage)=>{
|
|
290
298
|
console.log(), console.log(colors.red('Could not open ' + path.basename(fileName) + ' in the editor.')), errorMessage && ('.' !== errorMessage[errorMessage.length - 1] && (errorMessage += '.'), console.log(colors.red('The editor process exited with an error: ' + errorMessage))), console.log(), cb && cb(fileName, errorMessage);
|
|
@@ -312,6 +320,7 @@ __webpack_require__.add({
|
|
|
312
320
|
let currentChildProcess = null;
|
|
313
321
|
module.exports = function launchEditor(file, specifiedEditor, onErrorCallback) {
|
|
314
322
|
let parsed = parseFile(file), { fileName } = parsed, { lineNumber, columnNumber } = parsed;
|
|
323
|
+
if ('win32' === process.platform && path.resolve(fileName).startsWith('\\\\')) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
|
|
315
324
|
if (!fs.existsSync(fileName)) return;
|
|
316
325
|
'function' == typeof specifiedEditor && (onErrorCallback = specifiedEditor, specifiedEditor = void 0), onErrorCallback = wrapErrorCallback(onErrorCallback);
|
|
317
326
|
let [editor, ...args] = guessEditor(specifiedEditor);
|
|
@@ -532,4 +541,4 @@ __webpack_require__.add({
|
|
|
532
541
|
}).join(' ');
|
|
533
542
|
};
|
|
534
543
|
}
|
|
535
|
-
}), __webpack_require__("../../node_modules/.pnpm/launch-editor-middleware@2.14.
|
|
544
|
+
}), __webpack_require__("../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js");
|