vite-plugin-rpx 0.11.36 → 0.11.38
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/dist/index.js +124 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -23267,7 +23267,7 @@ async function proxyViaPool(reqOpts) {
|
|
|
23267
23267
|
const written = conn.socket.write(payload);
|
|
23268
23268
|
if (written < payload.length)
|
|
23269
23269
|
await conn.writeAll(payload.subarray(written));
|
|
23270
|
-
return await readResponse(pool, conn, isHead);
|
|
23270
|
+
return await readResponse(pool, conn, isHead, reqOpts.signal);
|
|
23271
23271
|
} catch (err) {
|
|
23272
23272
|
const retryable = err === STALE && attempt < MAX_STALE_RETRIES && (conn.fresh || isIdempotent(method));
|
|
23273
23273
|
pool.destroy(conn);
|
|
@@ -23296,7 +23296,7 @@ async function waitForHead(conn) {
|
|
|
23296
23296
|
}
|
|
23297
23297
|
return headerEnd;
|
|
23298
23298
|
}
|
|
23299
|
-
async function readResponse(pool, conn, isHead) {
|
|
23299
|
+
async function readResponse(pool, conn, isHead, signal) {
|
|
23300
23300
|
let head;
|
|
23301
23301
|
for (;; ) {
|
|
23302
23302
|
const headerEnd = await waitForHead(conn);
|
|
@@ -23316,7 +23316,10 @@ async function readResponse(pool, conn, isHead) {
|
|
|
23316
23316
|
return new Response(null, { status: head.status, headers: responseHeaders });
|
|
23317
23317
|
}
|
|
23318
23318
|
if (head.chunked)
|
|
23319
|
-
return new Response(chunkedStream(pool, conn, head.closeConn), {
|
|
23319
|
+
return new Response(chunkedStream(pool, conn, head.closeConn, signal), {
|
|
23320
|
+
status: head.status,
|
|
23321
|
+
headers: responseHeaders
|
|
23322
|
+
});
|
|
23320
23323
|
if (head.contentLength >= 0) {
|
|
23321
23324
|
const available = conn.len - conn.pos;
|
|
23322
23325
|
if (available >= head.contentLength) {
|
|
@@ -23430,11 +23433,22 @@ function untilCloseStream(conn) {
|
|
|
23430
23433
|
}
|
|
23431
23434
|
});
|
|
23432
23435
|
}
|
|
23433
|
-
function chunkedStream(pool, conn, closeConn) {
|
|
23436
|
+
function chunkedStream(pool, conn, closeConn, signal) {
|
|
23434
23437
|
conn.streamingBody = true;
|
|
23435
23438
|
let remaining = 0;
|
|
23436
23439
|
let needTrailerCrlf = false;
|
|
23437
23440
|
let cancelled = false;
|
|
23441
|
+
let downstreamController;
|
|
23442
|
+
const cleanupSignal = () => signal?.removeEventListener("abort", abortDownstream);
|
|
23443
|
+
const abortDownstream = () => {
|
|
23444
|
+
if (cancelled)
|
|
23445
|
+
return;
|
|
23446
|
+
cancelled = true;
|
|
23447
|
+
pool.destroy(conn);
|
|
23448
|
+
try {
|
|
23449
|
+
downstreamController?.close();
|
|
23450
|
+
} catch {}
|
|
23451
|
+
};
|
|
23438
23452
|
async function readLine() {
|
|
23439
23453
|
for (;; ) {
|
|
23440
23454
|
for (let i2 = conn.pos;i2 + 1 < conn.len; i2++) {
|
|
@@ -23452,6 +23466,13 @@ function chunkedStream(pool, conn, closeConn) {
|
|
|
23452
23466
|
}
|
|
23453
23467
|
}
|
|
23454
23468
|
return new ReadableStream({
|
|
23469
|
+
start(controller) {
|
|
23470
|
+
downstreamController = controller;
|
|
23471
|
+
if (signal?.aborted)
|
|
23472
|
+
abortDownstream();
|
|
23473
|
+
else
|
|
23474
|
+
signal?.addEventListener("abort", abortDownstream, { once: true });
|
|
23475
|
+
},
|
|
23455
23476
|
async pull(controller) {
|
|
23456
23477
|
try {
|
|
23457
23478
|
for (;; ) {
|
|
@@ -23493,6 +23514,7 @@ function chunkedStream(pool, conn, closeConn) {
|
|
|
23493
23514
|
break;
|
|
23494
23515
|
}
|
|
23495
23516
|
finishConn(pool, conn, closeConn);
|
|
23517
|
+
cleanupSignal();
|
|
23496
23518
|
controller.close();
|
|
23497
23519
|
return;
|
|
23498
23520
|
}
|
|
@@ -23500,12 +23522,14 @@ function chunkedStream(pool, conn, closeConn) {
|
|
|
23500
23522
|
}
|
|
23501
23523
|
} catch (error) {
|
|
23502
23524
|
pool.destroy(conn);
|
|
23525
|
+
cleanupSignal();
|
|
23503
23526
|
if (!cancelled)
|
|
23504
23527
|
controller.error(error);
|
|
23505
23528
|
}
|
|
23506
23529
|
},
|
|
23507
23530
|
cancel() {
|
|
23508
23531
|
cancelled = true;
|
|
23532
|
+
cleanupSignal();
|
|
23509
23533
|
pool.destroy(conn);
|
|
23510
23534
|
}
|
|
23511
23535
|
});
|
|
@@ -23860,7 +23884,8 @@ function createProxyFetchHandler(getRoute, verbose, onNoRoute) {
|
|
|
23860
23884
|
reqHeaders: req.headers,
|
|
23861
23885
|
forwardedHost: hostname,
|
|
23862
23886
|
originOverride,
|
|
23863
|
-
body: req.body
|
|
23887
|
+
body: req.body,
|
|
23888
|
+
signal: req.signal
|
|
23864
23889
|
});
|
|
23865
23890
|
if (pool)
|
|
23866
23891
|
markSuccess(pool, upstream);
|
|
@@ -26161,8 +26186,101 @@ init_sni();
|
|
|
26161
26186
|
init_on_demand();
|
|
26162
26187
|
init_static_files();
|
|
26163
26188
|
init_utils();
|
|
26189
|
+
// ../rpx/package.json
|
|
26190
|
+
var package_default = {
|
|
26191
|
+
name: "@stacksjs/rpx",
|
|
26192
|
+
type: "module",
|
|
26193
|
+
version: "0.11.38",
|
|
26194
|
+
description: "A modern and smart reverse proxy.",
|
|
26195
|
+
author: "Chris Breuer <chris@stacksjs.org>",
|
|
26196
|
+
license: "MIT",
|
|
26197
|
+
homepage: "https://github.com/stacksjs/rpx",
|
|
26198
|
+
repository: {
|
|
26199
|
+
type: "git",
|
|
26200
|
+
url: "git+https://github.com/stacksjs/rpx.git"
|
|
26201
|
+
},
|
|
26202
|
+
bugs: {
|
|
26203
|
+
url: "https://github.com/stacksjs/rpx/issues"
|
|
26204
|
+
},
|
|
26205
|
+
keywords: [
|
|
26206
|
+
"reverse proxy",
|
|
26207
|
+
"ssl",
|
|
26208
|
+
"development",
|
|
26209
|
+
"environment",
|
|
26210
|
+
"proxy",
|
|
26211
|
+
"bun",
|
|
26212
|
+
"stacks",
|
|
26213
|
+
"typescript",
|
|
26214
|
+
"javascript"
|
|
26215
|
+
],
|
|
26216
|
+
exports: {
|
|
26217
|
+
".": {
|
|
26218
|
+
types: "./dist/index.d.ts",
|
|
26219
|
+
bun: "./dist/index.js",
|
|
26220
|
+
import: "./dist/index.js"
|
|
26221
|
+
}
|
|
26222
|
+
},
|
|
26223
|
+
module: "./dist/index.js",
|
|
26224
|
+
types: "./dist/index.d.ts",
|
|
26225
|
+
bin: {
|
|
26226
|
+
rpx: "./dist/bin/cli.js",
|
|
26227
|
+
"reverse-proxy": "./dist/bin/cli.js"
|
|
26228
|
+
},
|
|
26229
|
+
files: [
|
|
26230
|
+
"README.md",
|
|
26231
|
+
"dist"
|
|
26232
|
+
],
|
|
26233
|
+
scripts: {
|
|
26234
|
+
build: "bun build.ts && bun build ./bin/cli.ts --compile --minify --outfile bin/rpx",
|
|
26235
|
+
compile: "bun build ./bin/cli.ts --compile --minify --outfile bin/rpx",
|
|
26236
|
+
"compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
|
|
26237
|
+
"compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/rpx-linux-x64",
|
|
26238
|
+
"compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/rpx-linux-arm64",
|
|
26239
|
+
"compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/rpx-windows-x64.exe",
|
|
26240
|
+
"compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/rpx-darwin-x64",
|
|
26241
|
+
"compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/rpx-darwin-arm64",
|
|
26242
|
+
bench: "bun run bench/run.ts",
|
|
26243
|
+
"bench:html": "bun run bench/run.ts --html",
|
|
26244
|
+
"bench:latency": "bun run bench/run.ts --latency",
|
|
26245
|
+
"bench:throughput": "bun run bench/run.ts --throughput",
|
|
26246
|
+
lint: "bunx --bun pickier .",
|
|
26247
|
+
"lint:fix": "bunx --bun pickier . --fix",
|
|
26248
|
+
fresh: "bunx rimraf node_modules/ bun.lock && bun i",
|
|
26249
|
+
changelog: "changelogen --output CHANGELOG.md",
|
|
26250
|
+
prepublishOnly: "bun build.ts",
|
|
26251
|
+
"release:binaries": "bun run compile:all && bun run zip",
|
|
26252
|
+
test: "bun test",
|
|
26253
|
+
typecheck: "bunx tsc --noEmit",
|
|
26254
|
+
zip: "bun run zip:all",
|
|
26255
|
+
"zip:all": "bun run zip:linux-x64 && bun run zip:linux-arm64 && bun run zip:windows-x64 && bun run zip:darwin-x64 && bun run zip:darwin-arm64",
|
|
26256
|
+
"zip:linux-x64": "zip -j bin/rpx-linux-x64.zip bin/rpx-linux-x64",
|
|
26257
|
+
"zip:linux-arm64": "zip -j bin/rpx-linux-arm64.zip bin/rpx-linux-arm64",
|
|
26258
|
+
"zip:windows-x64": "zip -j bin/rpx-windows-x64.zip bin/rpx-windows-x64.exe",
|
|
26259
|
+
"zip:darwin-x64": "zip -j bin/rpx-darwin-x64.zip bin/rpx-darwin-x64",
|
|
26260
|
+
"zip:darwin-arm64": "zip -j bin/rpx-darwin-arm64.zip bin/rpx-darwin-arm64"
|
|
26261
|
+
},
|
|
26262
|
+
dependencies: {
|
|
26263
|
+
"@stacksjs/clapp": "^0.2.10",
|
|
26264
|
+
"@stacksjs/tlsx": "^0.13.13"
|
|
26265
|
+
},
|
|
26266
|
+
devDependencies: {
|
|
26267
|
+
bunfig: "^0.15.6",
|
|
26268
|
+
mitata: "^1.0.34",
|
|
26269
|
+
typescript: "^7.0.2"
|
|
26270
|
+
},
|
|
26271
|
+
"simple-git-hooks": {
|
|
26272
|
+
"pre-commit": "bunx lint-staged"
|
|
26273
|
+
},
|
|
26274
|
+
"lint-staged": {
|
|
26275
|
+
"*.{js,ts}": "bunx --bun pickier . --fix"
|
|
26276
|
+
}
|
|
26277
|
+
};
|
|
26278
|
+
|
|
26279
|
+
// ../rpx/src/version.ts
|
|
26280
|
+
var version3 = package_default.version;
|
|
26281
|
+
|
|
26282
|
+
// ../rpx/src/start.ts
|
|
26164
26283
|
var processManager2 = new ProcessManager;
|
|
26165
|
-
var version3 = "0.12.0";
|
|
26166
26284
|
var globalPortManager = new DefaultPortManager("0.0.0.0");
|
|
26167
26285
|
var activeServers = new Set;
|
|
26168
26286
|
var activeUpstreamPools = new Set;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-rpx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.38",
|
|
5
5
|
"description": "A modern and smart reverse proxy. Vite plugin.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typecheck": "bunx tsc --noEmit"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@stacksjs/rpx": "0.11.
|
|
50
|
+
"@stacksjs/rpx": "0.11.38",
|
|
51
51
|
"@stacksjs/tlsx": "^0.13.13"
|
|
52
52
|
},
|
|
53
53
|
"simple-git-hooks": {
|