elit 3.6.8 → 3.7.0
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/Cargo.lock +380 -449
- package/Cargo.toml +3 -3
- package/dist/build.cjs +1 -1
- package/dist/build.d.ts +1 -1
- package/dist/build.js +14 -10
- package/dist/build.mjs +1 -1
- package/dist/cli.cjs +1838 -6399
- package/dist/cli.d.ts +10 -3
- package/dist/cli.mjs +1858 -6419
- package/dist/config.cjs +7 -2
- package/dist/config.d.ts +4 -4
- package/dist/config.js +20 -11
- package/dist/config.mjs +7 -2
- package/dist/{contracts-D7KIS-TK.d.ts → contracts-Av9yuqDM.d.ts} +11 -4
- package/dist/dev-build.d.ts +2 -1
- package/dist/dev-build.js +13 -9
- package/dist/https.cjs +7 -2
- package/dist/https.js +7 -2
- package/dist/https.mjs +7 -2
- package/dist/index.cjs +340 -52
- package/dist/index.d.ts +1 -1
- package/dist/index.js +340 -52
- package/dist/index.mjs +340 -52
- package/dist/native.cjs +340 -52
- package/dist/native.js +340 -52
- package/dist/native.mjs +340 -52
- package/dist/pm.cjs +316 -48
- package/dist/pm.d.ts +3 -3
- package/dist/pm.js +329 -57
- package/dist/pm.mjs +316 -48
- package/dist/preview-build.d.ts +2 -2
- package/dist/preview-build.js +13 -9
- package/dist/server.cjs +861 -5998
- package/dist/server.d.ts +3 -2
- package/dist/server.js +12178 -4468
- package/dist/server.mjs +861 -5998
- package/dist/smtp-server.js +514 -44
- package/dist/test-runtime.cjs +20 -0
- package/dist/test-runtime.js +33 -9
- package/dist/test-runtime.mjs +20 -0
- package/dist/test.cjs +27 -2
- package/dist/test.js +40 -11
- package/dist/test.mjs +27 -2
- package/dist/{types-BayMVo_k.d.ts → types-CLGrLRTl.d.ts} +8 -2
- package/dist/{types-fiLday0L.d.ts → types-CYEpzeEi.d.ts} +10 -0
- package/dist/types.d.ts +52 -36
- package/dist/wss.cjs +7 -2
- package/dist/wss.js +7 -2
- package/dist/wss.mjs +7 -2
- package/package.json +7 -2
package/dist/pm.mjs
CHANGED
|
@@ -7,8 +7,13 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
8
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
9
|
});
|
|
10
|
-
var __esm = (fn, res) => function __init() {
|
|
11
|
-
|
|
10
|
+
var __esm = (fn, res, err) => function __init() {
|
|
11
|
+
if (err) throw err[0];
|
|
12
|
+
try {
|
|
13
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
throw err = [e], e;
|
|
16
|
+
}
|
|
12
17
|
};
|
|
13
18
|
var __export = (target, all) => {
|
|
14
19
|
for (var name in all)
|
|
@@ -2678,6 +2683,217 @@ function watch(paths, options) {
|
|
|
2678
2683
|
import { createServer, request as httpRequest } from "http";
|
|
2679
2684
|
import { request as httpsRequest } from "https";
|
|
2680
2685
|
import { createServer as createNetServer } from "net";
|
|
2686
|
+
import { lookup as dnsLookup } from "dns/promises";
|
|
2687
|
+
var BLOCKED_IPV4_PREFIXES = [
|
|
2688
|
+
"0.",
|
|
2689
|
+
"10.",
|
|
2690
|
+
"100.64.",
|
|
2691
|
+
"100.65.",
|
|
2692
|
+
"100.66.",
|
|
2693
|
+
"100.67.",
|
|
2694
|
+
"100.68.",
|
|
2695
|
+
"100.69.",
|
|
2696
|
+
"100.70.",
|
|
2697
|
+
"100.71.",
|
|
2698
|
+
"100.72.",
|
|
2699
|
+
"100.73.",
|
|
2700
|
+
"100.74.",
|
|
2701
|
+
"100.75.",
|
|
2702
|
+
"100.76.",
|
|
2703
|
+
"100.77.",
|
|
2704
|
+
"100.78.",
|
|
2705
|
+
"100.79.",
|
|
2706
|
+
"100.80.",
|
|
2707
|
+
"100.81.",
|
|
2708
|
+
"100.82.",
|
|
2709
|
+
"100.83.",
|
|
2710
|
+
"100.84.",
|
|
2711
|
+
"100.85.",
|
|
2712
|
+
"100.86.",
|
|
2713
|
+
"100.87.",
|
|
2714
|
+
"100.88.",
|
|
2715
|
+
"100.89.",
|
|
2716
|
+
"100.90.",
|
|
2717
|
+
"100.91.",
|
|
2718
|
+
"100.92.",
|
|
2719
|
+
"100.93.",
|
|
2720
|
+
"100.94.",
|
|
2721
|
+
"100.95.",
|
|
2722
|
+
"100.96.",
|
|
2723
|
+
"100.97.",
|
|
2724
|
+
"100.98.",
|
|
2725
|
+
"100.99.",
|
|
2726
|
+
"100.100.",
|
|
2727
|
+
"100.101.",
|
|
2728
|
+
"100.102.",
|
|
2729
|
+
"100.103.",
|
|
2730
|
+
"100.104.",
|
|
2731
|
+
"100.105.",
|
|
2732
|
+
"100.106.",
|
|
2733
|
+
"100.107.",
|
|
2734
|
+
"100.108.",
|
|
2735
|
+
"100.109.",
|
|
2736
|
+
"100.110.",
|
|
2737
|
+
"100.111.",
|
|
2738
|
+
"100.112.",
|
|
2739
|
+
"100.113.",
|
|
2740
|
+
"100.114.",
|
|
2741
|
+
"100.115.",
|
|
2742
|
+
"100.116.",
|
|
2743
|
+
"100.117.",
|
|
2744
|
+
"100.118.",
|
|
2745
|
+
"100.119.",
|
|
2746
|
+
"100.120.",
|
|
2747
|
+
"100.121.",
|
|
2748
|
+
"100.122.",
|
|
2749
|
+
"100.123.",
|
|
2750
|
+
"100.124.",
|
|
2751
|
+
"100.125.",
|
|
2752
|
+
"100.126.",
|
|
2753
|
+
"100.127.",
|
|
2754
|
+
"127.",
|
|
2755
|
+
"169.254.",
|
|
2756
|
+
"172.16.",
|
|
2757
|
+
"172.17.",
|
|
2758
|
+
"172.18.",
|
|
2759
|
+
"172.19.",
|
|
2760
|
+
"172.20.",
|
|
2761
|
+
"172.21.",
|
|
2762
|
+
"172.22.",
|
|
2763
|
+
"172.23.",
|
|
2764
|
+
"172.24.",
|
|
2765
|
+
"172.25.",
|
|
2766
|
+
"172.26.",
|
|
2767
|
+
"172.27.",
|
|
2768
|
+
"172.28.",
|
|
2769
|
+
"172.29.",
|
|
2770
|
+
"172.30.",
|
|
2771
|
+
"172.31.",
|
|
2772
|
+
"192.0.2.",
|
|
2773
|
+
"192.88.99.",
|
|
2774
|
+
"192.168.",
|
|
2775
|
+
"198.18.",
|
|
2776
|
+
"198.19.",
|
|
2777
|
+
"198.51.100.",
|
|
2778
|
+
"203.0.113.",
|
|
2779
|
+
"224.",
|
|
2780
|
+
"225.",
|
|
2781
|
+
"226.",
|
|
2782
|
+
"227.",
|
|
2783
|
+
"228.",
|
|
2784
|
+
"229.",
|
|
2785
|
+
"230.",
|
|
2786
|
+
"231.",
|
|
2787
|
+
"232.",
|
|
2788
|
+
"233.",
|
|
2789
|
+
"234.",
|
|
2790
|
+
"235.",
|
|
2791
|
+
"236.",
|
|
2792
|
+
"237.",
|
|
2793
|
+
"238.",
|
|
2794
|
+
"239.",
|
|
2795
|
+
"240.",
|
|
2796
|
+
"241.",
|
|
2797
|
+
"242.",
|
|
2798
|
+
"243.",
|
|
2799
|
+
"244.",
|
|
2800
|
+
"245.",
|
|
2801
|
+
"246.",
|
|
2802
|
+
"247.",
|
|
2803
|
+
"248.",
|
|
2804
|
+
"249.",
|
|
2805
|
+
"250.",
|
|
2806
|
+
"251.",
|
|
2807
|
+
"252.",
|
|
2808
|
+
"253.",
|
|
2809
|
+
"254.",
|
|
2810
|
+
"255."
|
|
2811
|
+
];
|
|
2812
|
+
var ALLOWED_PROXY_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
2813
|
+
function isBlockedIpv4(hostname) {
|
|
2814
|
+
const octets = hostname.split(".");
|
|
2815
|
+
if (octets.length !== 4) return false;
|
|
2816
|
+
const joined = hostname;
|
|
2817
|
+
return BLOCKED_IPV4_PREFIXES.some((prefix) => joined.startsWith(prefix));
|
|
2818
|
+
}
|
|
2819
|
+
function isBlockedIpv6(hostname) {
|
|
2820
|
+
const lower = hostname.toLowerCase();
|
|
2821
|
+
if (lower === "::1" || lower === "::" || lower === "0:0:0:0:0:0:0:1" || lower === "0:0:0:0:0:0:0:0") {
|
|
2822
|
+
return true;
|
|
2823
|
+
}
|
|
2824
|
+
const ffffMatch = lower.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);
|
|
2825
|
+
if (ffffMatch) {
|
|
2826
|
+
return isBlockedIpv4(ffffMatch[1]);
|
|
2827
|
+
}
|
|
2828
|
+
const compatMatch = lower.match(/^::(\d+\.\d+\.\d+\.\d+)$/);
|
|
2829
|
+
if (compatMatch) {
|
|
2830
|
+
return isBlockedIpv4(compatMatch[1]);
|
|
2831
|
+
}
|
|
2832
|
+
return false;
|
|
2833
|
+
}
|
|
2834
|
+
function isSafeHostname(hostname) {
|
|
2835
|
+
if (!hostname) return false;
|
|
2836
|
+
if (/^\d{1,3}(\.\d{1,3}){3}$/.test(hostname)) return !isBlockedIpv4(hostname);
|
|
2837
|
+
if (/^\[.*\]$/.test(hostname)) return !isBlockedIpv6(hostname.slice(1, -1));
|
|
2838
|
+
if (hostname.includes(":")) return !isBlockedIpv6(hostname);
|
|
2839
|
+
return true;
|
|
2840
|
+
}
|
|
2841
|
+
async function safeResolveHostname(hostname) {
|
|
2842
|
+
try {
|
|
2843
|
+
const result = await dnsLookup(hostname);
|
|
2844
|
+
const ip = result.address;
|
|
2845
|
+
if (isBlockedIpv4(ip) || isBlockedIpv6(ip)) {
|
|
2846
|
+
throw new Error(`PM proxy target resolved to a blocked address: ${ip}`);
|
|
2847
|
+
}
|
|
2848
|
+
return ip;
|
|
2849
|
+
} catch (error) {
|
|
2850
|
+
if (error instanceof Error && error.message.includes("blocked address")) {
|
|
2851
|
+
throw error;
|
|
2852
|
+
}
|
|
2853
|
+
throw new Error(`PM proxy failed to resolve target hostname "${hostname}": ${error instanceof Error ? error.message : String(error)}`);
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
async function validateProxyTargetUrl(target) {
|
|
2857
|
+
if (!ALLOWED_PROXY_PROTOCOLS.has(target.protocol)) {
|
|
2858
|
+
throw new Error(`PM proxy target protocol "${target.protocol}" is not allowed. Only http: and https: are permitted.`);
|
|
2859
|
+
}
|
|
2860
|
+
const hostname = target.hostname;
|
|
2861
|
+
if (!isSafeHostname(hostname)) {
|
|
2862
|
+
throw new Error(`PM proxy target "${hostname}" resolves to a blocked address and is not allowed.`);
|
|
2863
|
+
}
|
|
2864
|
+
if (!/^\d{1,3}(\.\d{1,3}){3}$/.test(hostname) && !/^\[.*\]$/.test(hostname)) {
|
|
2865
|
+
await safeResolveHostname(hostname);
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
function sanitizeProxyRequestPath(requestUrl) {
|
|
2869
|
+
if (!requestUrl || requestUrl === "/") return "/";
|
|
2870
|
+
try {
|
|
2871
|
+
const normalizedInput = requestUrl.replace(/\\/g, "/");
|
|
2872
|
+
const parsed = new URL(normalizedInput, "http://placeholder");
|
|
2873
|
+
if (parsed.username || parsed.password || parsed.hostname !== "placeholder" || parsed.port) {
|
|
2874
|
+
return "/";
|
|
2875
|
+
}
|
|
2876
|
+
const pathname = parsed.pathname || "/";
|
|
2877
|
+
let decodedPathname = pathname;
|
|
2878
|
+
try {
|
|
2879
|
+
decodedPathname = decodeURIComponent(pathname);
|
|
2880
|
+
} catch {
|
|
2881
|
+
return "/";
|
|
2882
|
+
}
|
|
2883
|
+
const lowerPath = pathname.toLowerCase();
|
|
2884
|
+
if (lowerPath.includes("%2f") || lowerPath.includes("%5c") || lowerPath.includes("%40") || lowerPath.includes("%00")) {
|
|
2885
|
+
return "/";
|
|
2886
|
+
}
|
|
2887
|
+
const segments = decodedPathname.split("/");
|
|
2888
|
+
if (segments.some((segment) => segment === "." || segment === "..")) {
|
|
2889
|
+
return "/";
|
|
2890
|
+
}
|
|
2891
|
+
const sanitized = pathname + parsed.search;
|
|
2892
|
+
return sanitized.startsWith("/") ? sanitized || "/" : `/${sanitized}`;
|
|
2893
|
+
} catch {
|
|
2894
|
+
return "/";
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2681
2897
|
function resolvePmProxyHost(proxy) {
|
|
2682
2898
|
return proxy.host?.trim() || "0.0.0.0";
|
|
2683
2899
|
}
|
|
@@ -2767,6 +2983,9 @@ async function createPmProxyController(proxy) {
|
|
|
2767
2983
|
nextTargetIndex = (nextTargetIndex + 1) % targets.length;
|
|
2768
2984
|
return target;
|
|
2769
2985
|
};
|
|
2986
|
+
const validateTarget = async (target) => {
|
|
2987
|
+
await validateProxyTargetUrl(target);
|
|
2988
|
+
};
|
|
2770
2989
|
const server = createServer((req, res) => {
|
|
2771
2990
|
const target = pickTarget();
|
|
2772
2991
|
if (!target) {
|
|
@@ -2774,29 +2993,45 @@ async function createPmProxyController(proxy) {
|
|
|
2774
2993
|
res.end("PM proxy target is not ready.");
|
|
2775
2994
|
return;
|
|
2776
2995
|
}
|
|
2996
|
+
const sanitizedPath = sanitizeProxyRequestPath(req.url || "/");
|
|
2777
2997
|
const requestLib = target.protocol === "https:" ? httpsRequest : httpRequest;
|
|
2778
|
-
const targetUrl = new URL(req.url || "/", target);
|
|
2779
2998
|
const headers = buildPmProxyHeaders(req.headers, target.host);
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2999
|
+
if (!ALLOWED_PROXY_PROTOCOLS.has(target.protocol)) {
|
|
3000
|
+
res.statusCode = 400;
|
|
3001
|
+
res.end("PM proxy rejected unsafe target protocol.");
|
|
3002
|
+
return;
|
|
3003
|
+
}
|
|
3004
|
+
validateTarget(target).then(() => {
|
|
3005
|
+
const proxyReq = requestLib({
|
|
3006
|
+
protocol: target.protocol,
|
|
3007
|
+
hostname: target.hostname,
|
|
3008
|
+
port: target.port || void 0,
|
|
3009
|
+
path: sanitizedPath,
|
|
3010
|
+
method: req.method,
|
|
3011
|
+
headers
|
|
3012
|
+
}, (proxyRes) => {
|
|
3013
|
+
const outgoingHeaders = {};
|
|
3014
|
+
for (const [key, value] of Object.entries(proxyRes.headers)) {
|
|
3015
|
+
if (value !== void 0) {
|
|
3016
|
+
outgoingHeaders[key] = value;
|
|
3017
|
+
}
|
|
2788
3018
|
}
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
3019
|
+
res.writeHead(proxyRes.statusCode || 200, outgoingHeaders);
|
|
3020
|
+
proxyRes.pipe(res);
|
|
3021
|
+
});
|
|
3022
|
+
proxyReq.on("error", (error) => {
|
|
3023
|
+
if (!res.headersSent) {
|
|
3024
|
+
res.statusCode = 502;
|
|
3025
|
+
}
|
|
3026
|
+
res.end(`PM proxy error: ${error.message}`);
|
|
3027
|
+
});
|
|
3028
|
+
req.pipe(proxyReq);
|
|
3029
|
+
}).catch((error) => {
|
|
2794
3030
|
if (!res.headersSent) {
|
|
2795
|
-
res.statusCode =
|
|
3031
|
+
res.statusCode = 403;
|
|
2796
3032
|
}
|
|
2797
|
-
res.end(`PM proxy
|
|
3033
|
+
res.end(`PM proxy blocked target: ${error instanceof Error ? error.message : String(error)}`);
|
|
2798
3034
|
});
|
|
2799
|
-
req.pipe(proxyReq);
|
|
2800
3035
|
});
|
|
2801
3036
|
server.on("upgrade", (req, socket, head) => {
|
|
2802
3037
|
const target = pickTarget();
|
|
@@ -2808,38 +3043,56 @@ async function createPmProxyController(proxy) {
|
|
|
2808
3043
|
socket.destroy();
|
|
2809
3044
|
return;
|
|
2810
3045
|
}
|
|
3046
|
+
const sanitizedPath = sanitizeProxyRequestPath(req.url || "/");
|
|
2811
3047
|
const requestLib = target.protocol === "https:" ? httpsRequest : httpRequest;
|
|
2812
|
-
const targetUrl = new URL(
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
3048
|
+
const targetUrl = new URL(sanitizedPath, target);
|
|
3049
|
+
if (targetUrl.hostname !== target.hostname || targetUrl.port !== target.port || !ALLOWED_PROXY_PROTOCOLS.has(targetUrl.protocol)) {
|
|
3050
|
+
writeRawHttpResponse(socket, 400, "Bad Request", {
|
|
3051
|
+
connection: "close",
|
|
3052
|
+
"content-length": 0
|
|
3053
|
+
});
|
|
3054
|
+
socket.destroy();
|
|
3055
|
+
return;
|
|
3056
|
+
}
|
|
3057
|
+
validateTarget(target).then(() => {
|
|
3058
|
+
const proxyReq = requestLib(targetUrl, {
|
|
3059
|
+
method: req.method,
|
|
3060
|
+
headers: buildPmProxyHeaders(req.headers, target.host)
|
|
3061
|
+
});
|
|
3062
|
+
proxyReq.on("upgrade", (proxyRes, proxySocket, proxyHead) => {
|
|
3063
|
+
writeRawHttpResponse(socket, proxyRes.statusCode || 101, proxyRes.statusMessage || "Switching Protocols", proxyRes.headers);
|
|
3064
|
+
if (head.length > 0) {
|
|
3065
|
+
proxySocket.write(head);
|
|
3066
|
+
}
|
|
3067
|
+
if (proxyHead.length > 0) {
|
|
3068
|
+
socket.write(proxyHead);
|
|
3069
|
+
}
|
|
3070
|
+
socket.on("error", () => proxySocket.destroy());
|
|
3071
|
+
proxySocket.on("error", () => socket.destroy());
|
|
3072
|
+
proxySocket.pipe(socket);
|
|
3073
|
+
socket.pipe(proxySocket);
|
|
3074
|
+
});
|
|
3075
|
+
proxyReq.on("response", (proxyRes) => {
|
|
3076
|
+
writeRawHttpResponse(socket, proxyRes.statusCode || 502, proxyRes.statusMessage || "Bad Gateway", proxyRes.headers);
|
|
3077
|
+
proxyRes.pipe(socket);
|
|
3078
|
+
});
|
|
3079
|
+
proxyReq.on("error", (error) => {
|
|
3080
|
+
writeRawHttpResponse(socket, 502, "Bad Gateway", {
|
|
3081
|
+
connection: "close",
|
|
3082
|
+
"content-type": "text/plain; charset=utf-8",
|
|
3083
|
+
"content-length": Buffer.byteLength(`PM proxy error: ${error.message}`)
|
|
3084
|
+
});
|
|
3085
|
+
socket.end(`PM proxy error: ${error.message}`);
|
|
3086
|
+
});
|
|
3087
|
+
proxyReq.end();
|
|
3088
|
+
}).catch((error) => {
|
|
3089
|
+
writeRawHttpResponse(socket, 403, "Forbidden", {
|
|
2836
3090
|
connection: "close",
|
|
2837
3091
|
"content-type": "text/plain; charset=utf-8",
|
|
2838
|
-
"content-length": Buffer.byteLength(`PM proxy
|
|
3092
|
+
"content-length": Buffer.byteLength(`PM proxy blocked target: ${error instanceof Error ? error.message : String(error)}`)
|
|
2839
3093
|
});
|
|
2840
|
-
socket.end(`PM proxy
|
|
3094
|
+
socket.end(`PM proxy blocked target: ${error instanceof Error ? error.message : String(error)}`);
|
|
2841
3095
|
});
|
|
2842
|
-
proxyReq.end();
|
|
2843
3096
|
});
|
|
2844
3097
|
await new Promise((resolve7, reject) => {
|
|
2845
3098
|
server.once("error", reject);
|
|
@@ -2847,10 +3100,25 @@ async function createPmProxyController(proxy) {
|
|
|
2847
3100
|
});
|
|
2848
3101
|
return {
|
|
2849
3102
|
setTarget(targetUrl) {
|
|
2850
|
-
|
|
3103
|
+
if (targetUrl) {
|
|
3104
|
+
const parsed = new URL(targetUrl);
|
|
3105
|
+
validateProxyTargetUrl(parsed).then(() => {
|
|
3106
|
+
setResolvedTargets([parsed]);
|
|
3107
|
+
}).catch((error) => {
|
|
3108
|
+
console.error(`[PM proxy] Blocked setTarget: ${error instanceof Error ? error.message : String(error)}`);
|
|
3109
|
+
setResolvedTargets([]);
|
|
3110
|
+
});
|
|
3111
|
+
} else {
|
|
3112
|
+
setResolvedTargets([]);
|
|
3113
|
+
}
|
|
2851
3114
|
},
|
|
2852
3115
|
setTargets(targetUrls) {
|
|
2853
|
-
|
|
3116
|
+
Promise.all(targetUrls.map((url) => validateProxyTargetUrl(new URL(url)))).then(() => {
|
|
3117
|
+
setResolvedTargets(targetUrls.map((targetUrl) => new URL(targetUrl)));
|
|
3118
|
+
}).catch((error) => {
|
|
3119
|
+
console.error(`[PM proxy] Blocked setTargets: ${error instanceof Error ? error.message : String(error)}`);
|
|
3120
|
+
setResolvedTargets([]);
|
|
3121
|
+
});
|
|
2854
3122
|
},
|
|
2855
3123
|
close() {
|
|
2856
3124
|
return new Promise((resolve7, reject) => {
|
package/dist/preview-build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BuildOptions } from './contracts-
|
|
2
|
-
import { P as PreviewOptions } from './types-
|
|
1
|
+
import { B as BuildOptions } from './contracts-Av9yuqDM.js';
|
|
2
|
+
import { P as PreviewOptions } from './types-CYEpzeEi.js';
|
|
3
3
|
import './types-DPOgoGs-.js';
|
|
4
4
|
import 'node:events';
|
|
5
5
|
import './websocket-BLBEAnhp.js';
|
package/dist/preview-build.js
CHANGED
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
14
|
});
|
|
15
15
|
var __commonJS = (cb, mod) => function __require2() {
|
|
16
|
-
|
|
16
|
+
try {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw mod = 0, e;
|
|
20
|
+
}
|
|
17
21
|
};
|
|
18
22
|
var __copyProps = (to, from, except, desc) => {
|
|
19
23
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -943,8 +947,8 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
943
947
|
if (isFirstPacket) {
|
|
944
948
|
isFirstPacket = false;
|
|
945
949
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
946
|
-
if (binaryVersion !== "0.
|
|
947
|
-
throw new Error(`Cannot start service: Host version "${"0.
|
|
950
|
+
if (binaryVersion !== "0.28.1") {
|
|
951
|
+
throw new Error(`Cannot start service: Host version "${"0.28.1"}" does not match binary version ${quote(binaryVersion)}`);
|
|
948
952
|
}
|
|
949
953
|
return;
|
|
950
954
|
}
|
|
@@ -2077,7 +2081,7 @@ for your current platform.`);
|
|
|
2077
2081
|
"node_modules",
|
|
2078
2082
|
".cache",
|
|
2079
2083
|
"esbuild",
|
|
2080
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.
|
|
2084
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.28.1"}-${path.basename(subpath)}`
|
|
2081
2085
|
);
|
|
2082
2086
|
if (!fs2.existsSync(binTargetPath)) {
|
|
2083
2087
|
fs2.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
|
@@ -2110,7 +2114,7 @@ for your current platform.`);
|
|
|
2110
2114
|
}
|
|
2111
2115
|
}
|
|
2112
2116
|
var _a;
|
|
2113
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.
|
|
2117
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.28.1";
|
|
2114
2118
|
var esbuildCommandAndArgs = () => {
|
|
2115
2119
|
if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
|
2116
2120
|
throw new Error(
|
|
@@ -2177,7 +2181,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
2177
2181
|
}
|
|
2178
2182
|
}
|
|
2179
2183
|
};
|
|
2180
|
-
var version = "0.
|
|
2184
|
+
var version = "0.28.1";
|
|
2181
2185
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
2182
2186
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
2183
2187
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -2280,7 +2284,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
2280
2284
|
var ensureServiceIsRunning = () => {
|
|
2281
2285
|
if (longLivedService) return longLivedService;
|
|
2282
2286
|
let [command, args] = esbuildCommandAndArgs();
|
|
2283
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.
|
|
2287
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.28.1"}`, "--ping"), {
|
|
2284
2288
|
windowsHide: true,
|
|
2285
2289
|
stdio: ["pipe", "pipe", "inherit"],
|
|
2286
2290
|
cwd: defaultWD
|
|
@@ -2384,7 +2388,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
2384
2388
|
esbuild: node_exports
|
|
2385
2389
|
});
|
|
2386
2390
|
callback(service);
|
|
2387
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.
|
|
2391
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.28.1"}`), {
|
|
2388
2392
|
cwd: defaultWD,
|
|
2389
2393
|
windowsHide: true,
|
|
2390
2394
|
input: stdin,
|
|
@@ -2404,7 +2408,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
2404
2408
|
var startWorkerThreadService = (worker_threads2) => {
|
|
2405
2409
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
2406
2410
|
let worker = new worker_threads2.Worker(__filename, {
|
|
2407
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.
|
|
2411
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.28.1" },
|
|
2408
2412
|
transferList: [workerPort],
|
|
2409
2413
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
2410
2414
|
//
|