coderaft 0.0.44 → 0.0.45
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/README.md +4 -5
- package/code.mjs +1 -1
- package/code.tar.zst +0 -0
- package/dist/THIRD-PARTY-LICENSES.md.gz +0 -0
- package/dist/_chunks/_args.mjs +0 -1
- package/dist/_chunks/extensions.mjs +5 -7
- package/dist/_chunks/libs/httpxy.mjs +159 -35
- package/dist/_chunks/server.mjs +6 -8
- package/dist/cli.mjs +8 -189
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +2 -2
- package/package.json +4 -3
- package/worker.mjs +50 -2
- package/dist/THIRD-PARTY-LICENSES.md +0 -58
package/README.md
CHANGED
|
@@ -333,11 +333,10 @@ These run against the extensions dir and exit without starting a server (see [Ex
|
|
|
333
333
|
|
|
334
334
|
### Other
|
|
335
335
|
|
|
336
|
-
| Option | Description
|
|
337
|
-
| ------------ |
|
|
338
|
-
| `--no-fork` | Run server in the main process (no subprocess)
|
|
339
|
-
|
|
|
340
|
-
| `-o, --open` | Open in browser on startup |
|
|
336
|
+
| Option | Description |
|
|
337
|
+
| ------------ | ---------------------------------------------- |
|
|
338
|
+
| `--no-fork` | Run server in the main process (no subprocess) |
|
|
339
|
+
| `-o, --open` | Open in browser on startup |
|
|
341
340
|
|
|
342
341
|
### Debugging
|
|
343
342
|
|
package/code.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
6
|
// Auto-updated by scripts/pack.ts
|
|
7
|
-
const codeArchiveHash = "
|
|
7
|
+
const codeArchiveHash = "d93137180c333868";
|
|
8
8
|
|
|
9
9
|
const archivePath = fileURLToPath(new URL("./code.tar.zst", import.meta.url));
|
|
10
10
|
|
package/code.tar.zst
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/_chunks/_args.mjs
CHANGED
|
@@ -237,7 +237,6 @@ const helpText = `
|
|
|
237
237
|
--crash-reporter-id <id> Crash reporter ID
|
|
238
238
|
|
|
239
239
|
--no-fork Run server in the main process (no subprocess)
|
|
240
|
-
--no-tui Disable interactive terminal UI
|
|
241
240
|
-o, --open Open in browser on startup
|
|
242
241
|
-h, --help Show this help message
|
|
243
242
|
`;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
3
|
import { fork } from "node:child_process";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
|
-
var __exportAll = (all,
|
|
8
|
-
let target = {};
|
|
7
|
+
var __exportAll = (all, flags) => {
|
|
8
|
+
let target = Object.setPrototypeOf({}, null);
|
|
9
9
|
for (var name in all) __defProp(target, name, {
|
|
10
10
|
get: all[name],
|
|
11
11
|
enumerable: true
|
|
12
12
|
});
|
|
13
|
-
if (!
|
|
14
|
-
return target;
|
|
13
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
15
15
|
};
|
|
16
16
|
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
17
17
|
if (process.platform === "android") {
|
|
@@ -90,8 +90,6 @@ if (process.platform === "android") {
|
|
|
90
90
|
_syncESM();
|
|
91
91
|
}
|
|
92
92
|
var extensions_exports = /* @__PURE__ */ __exportAll({
|
|
93
|
-
ensureExtensions: () => ensureExtensions,
|
|
94
|
-
readInstalledExtensions: () => readInstalledExtensions,
|
|
95
93
|
resolveExtensionDirs: () => resolveExtensionDirs,
|
|
96
94
|
runExtensionCommand: () => runExtensionCommand
|
|
97
95
|
});
|
|
@@ -2,6 +2,7 @@ import httpNative from "node:http";
|
|
|
2
2
|
import httpsNative from "node:https";
|
|
3
3
|
import http2 from "node:http2";
|
|
4
4
|
import { EventEmitter } from "node:events";
|
|
5
|
+
import { Readable, Transform } from "node:stream";
|
|
5
6
|
const upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i;
|
|
6
7
|
const transferEncodingConnectionToken = /(^|,)\s*transfer-encoding\s*($|,)/i;
|
|
7
8
|
const defaultAgents = {
|
|
@@ -27,6 +28,27 @@ function forceConnectionCloseForTransferEncoding(headers) {
|
|
|
27
28
|
const connectionMarksTransferEncoding = typeof connection === "string" && transferEncodingConnectionToken.test(connection);
|
|
28
29
|
if (carriesTransferEncoding || connectionMarksTransferEncoding) headers.connection = "close";
|
|
29
30
|
}
|
|
31
|
+
function drainAfterEarlyResponse(proxyReq, proxyRes, source) {
|
|
32
|
+
if (proxyReq.writableFinished) return;
|
|
33
|
+
let drained = false;
|
|
34
|
+
const drain = () => {
|
|
35
|
+
if (drained) return;
|
|
36
|
+
drained = true;
|
|
37
|
+
if (source instanceof Readable) {
|
|
38
|
+
source.unpipe(proxyReq);
|
|
39
|
+
source.resume();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
proxyRes.once("end", () => {
|
|
43
|
+
if (!proxyReq.writableFinished) drain();
|
|
44
|
+
});
|
|
45
|
+
proxyRes.once("close", () => {
|
|
46
|
+
if (!proxyReq.writableFinished) {
|
|
47
|
+
drain();
|
|
48
|
+
proxyReq.destroy();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
30
52
|
const HTTP2_HEADER_BLACKLIST = [
|
|
31
53
|
":method",
|
|
32
54
|
":path",
|
|
@@ -106,6 +128,14 @@ function setupSocket(socket) {
|
|
|
106
128
|
socket.setKeepAlive(true, 0);
|
|
107
129
|
return socket;
|
|
108
130
|
}
|
|
131
|
+
function createHttpHeader(line, headers) {
|
|
132
|
+
let head = line;
|
|
133
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
134
|
+
if (value === void 0) continue;
|
|
135
|
+
for (const entry of Array.isArray(value) ? value : [value]) head += `\r\n${key}: ${entry}`;
|
|
136
|
+
}
|
|
137
|
+
return `${head}\r\n\r\n`;
|
|
138
|
+
}
|
|
109
139
|
function getPort(req) {
|
|
110
140
|
const hostHeader = req.headers[":authority"] || req.headers.host;
|
|
111
141
|
const res = hostHeader ? hostHeader.match(/:(\d+)/) : "";
|
|
@@ -294,23 +324,22 @@ const webIncomingMiddleware = [
|
|
|
294
324
|
};
|
|
295
325
|
}
|
|
296
326
|
let bodyBuffer;
|
|
297
|
-
|
|
298
|
-
const chunks = [];
|
|
327
|
+
proxyReq.once("socket", () => {
|
|
299
328
|
const source = options.buffer || req;
|
|
300
|
-
|
|
301
|
-
chunks
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
else
|
|
329
|
+
if (maxRedirects > 0) {
|
|
330
|
+
const chunks = [];
|
|
331
|
+
source.on("data", (chunk) => {
|
|
332
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
333
|
+
proxyReq.write(chunk);
|
|
334
|
+
});
|
|
335
|
+
source.on("end", () => {
|
|
336
|
+
bodyBuffer = Buffer.concat(chunks);
|
|
337
|
+
proxyReq.end();
|
|
338
|
+
});
|
|
339
|
+
source.on("error", (err) => {
|
|
340
|
+
proxyReq.destroy(err);
|
|
341
|
+
});
|
|
342
|
+
} else source.pipe(proxyReq);
|
|
314
343
|
});
|
|
315
344
|
function handleResponse(proxyRes, redirectCount, currentUrl) {
|
|
316
345
|
const statusCode = proxyRes.statusCode;
|
|
@@ -381,10 +410,109 @@ const webIncomingMiddleware = [
|
|
|
381
410
|
}
|
|
382
411
|
}
|
|
383
412
|
proxyReq.on("response", function(proxyRes) {
|
|
413
|
+
if (maxRedirects === 0) drainAfterEarlyResponse(proxyReq, proxyRes, options.buffer || req);
|
|
384
414
|
handleResponse(proxyRes, 0, options.target);
|
|
385
415
|
});
|
|
386
416
|
})
|
|
387
417
|
];
|
|
418
|
+
function setUpgradeTimeout(proxyReq, socket, timeout, onError) {
|
|
419
|
+
if (!timeout || timeout <= 0 || !Number.isFinite(timeout)) return;
|
|
420
|
+
const timer = setTimeout(() => {
|
|
421
|
+
fail(Object.assign(/* @__PURE__ */ new Error("Upstream WebSocket upgrade timed out"), {
|
|
422
|
+
code: "ERR_UPSTREAM_UPGRADE_TIMEOUT",
|
|
423
|
+
statusCode: 504
|
|
424
|
+
}));
|
|
425
|
+
}, Math.min(timeout, 0x7fffffff));
|
|
426
|
+
timer.unref();
|
|
427
|
+
proxyReq.once("response", clear);
|
|
428
|
+
proxyReq.once("upgrade", clear);
|
|
429
|
+
proxyReq.once("error", clear);
|
|
430
|
+
proxyReq.once("close", clear);
|
|
431
|
+
socket.prependOnceListener("error", fail);
|
|
432
|
+
socket.prependOnceListener("close", onSocketClose);
|
|
433
|
+
if (socket.destroyed) onSocketClose();
|
|
434
|
+
function clear() {
|
|
435
|
+
clearTimeout(timer);
|
|
436
|
+
proxyReq.removeListener("response", clear);
|
|
437
|
+
proxyReq.removeListener("upgrade", clear);
|
|
438
|
+
proxyReq.removeListener("error", clear);
|
|
439
|
+
proxyReq.removeListener("close", clear);
|
|
440
|
+
socket.removeListener("error", fail);
|
|
441
|
+
socket.removeListener("close", onSocketClose);
|
|
442
|
+
}
|
|
443
|
+
function onSocketClose() {
|
|
444
|
+
fail(socket.errored || Object.assign(/* @__PURE__ */ new Error("socket hang up"), { code: "ECONNRESET" }));
|
|
445
|
+
}
|
|
446
|
+
function fail(error) {
|
|
447
|
+
clear();
|
|
448
|
+
try {
|
|
449
|
+
onError(error);
|
|
450
|
+
} finally {
|
|
451
|
+
proxyReq.destroy(error);
|
|
452
|
+
socket.destroy();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
const hopByHopHeaders = [
|
|
457
|
+
"connection",
|
|
458
|
+
"proxy-connection",
|
|
459
|
+
"keep-alive",
|
|
460
|
+
"te",
|
|
461
|
+
"trailer",
|
|
462
|
+
"upgrade",
|
|
463
|
+
"proxy-authenticate",
|
|
464
|
+
"proxy-authorization",
|
|
465
|
+
"transfer-encoding"
|
|
466
|
+
];
|
|
467
|
+
function pipeNonUpgradeResponse(response, socket, onError) {
|
|
468
|
+
const headers = { ...response.headers };
|
|
469
|
+
const hopHeaders = new Set(hopByHopHeaders);
|
|
470
|
+
for (const name of ["connection", "proxy-connection"]) for (const token of String(headers[name] || "").split(",")) hopHeaders.add(token.trim().toLowerCase());
|
|
471
|
+
for (const name of hopHeaders) delete headers[name];
|
|
472
|
+
headers.connection = "close";
|
|
473
|
+
const status = response.statusCode || 502;
|
|
474
|
+
const bodyless = status === 204 || status === 205 || status === 304;
|
|
475
|
+
const transferEncoding = response.headers["transfer-encoding"];
|
|
476
|
+
if (status === 205) headers["content-length"] = "0";
|
|
477
|
+
else if (status === 204) delete headers["content-length"];
|
|
478
|
+
else if (transferEncoding && !bodyless) {
|
|
479
|
+
headers["transfer-encoding"] = transferEncoding;
|
|
480
|
+
delete headers["content-length"];
|
|
481
|
+
} else if (response.headers["content-length"] !== void 0) headers["content-length"] = response.headers["content-length"];
|
|
482
|
+
const encoder = !bodyless && /(?:^|,)\s*chunked\s*$/i.test(transferEncoding || "") ? new Transform({
|
|
483
|
+
transform(chunk, _encoding, callback) {
|
|
484
|
+
callback(null, chunk.length === 0 ? void 0 : Buffer.concat([
|
|
485
|
+
Buffer.from(`${chunk.length.toString(16)}\r\n`),
|
|
486
|
+
chunk,
|
|
487
|
+
Buffer.from("\r\n")
|
|
488
|
+
]));
|
|
489
|
+
},
|
|
490
|
+
flush(callback) {
|
|
491
|
+
callback(null, Buffer.from("0\r\n\r\n"));
|
|
492
|
+
}
|
|
493
|
+
}) : void 0;
|
|
494
|
+
let closed = false;
|
|
495
|
+
const onClose = () => {
|
|
496
|
+
closed = true;
|
|
497
|
+
response.destroy();
|
|
498
|
+
encoder?.destroy();
|
|
499
|
+
};
|
|
500
|
+
const onResponseError = (error) => {
|
|
501
|
+
if (closed) return;
|
|
502
|
+
onClose();
|
|
503
|
+
socket.destroy();
|
|
504
|
+
onError(error);
|
|
505
|
+
};
|
|
506
|
+
socket.once("close", onClose);
|
|
507
|
+
response.once("error", onResponseError);
|
|
508
|
+
encoder?.once("error", onResponseError);
|
|
509
|
+
socket.write(createHttpHeader(`HTTP/${response.httpVersion} ${status} ${response.statusMessage}`, headers), "latin1");
|
|
510
|
+
if (status === 205) {
|
|
511
|
+
onClose();
|
|
512
|
+
socket.end();
|
|
513
|
+
} else if (encoder) response.pipe(encoder).pipe(socket);
|
|
514
|
+
else response.pipe(socket);
|
|
515
|
+
}
|
|
388
516
|
const websocketIncomingMiddleware = [
|
|
389
517
|
defineProxyMiddleware((req, socket) => {
|
|
390
518
|
if (req.method !== "GET" || !req.headers.upgrade) {
|
|
@@ -413,17 +541,7 @@ const websocketIncomingMiddleware = [
|
|
|
413
541
|
}
|
|
414
542
|
}),
|
|
415
543
|
defineProxyMiddleware((req, socket, options, server, head, callback) => {
|
|
416
|
-
|
|
417
|
-
return Object.keys(headers).reduce(function(head, key) {
|
|
418
|
-
const value = headers[key];
|
|
419
|
-
if (!Array.isArray(value)) {
|
|
420
|
-
head.push(key + ": " + value);
|
|
421
|
-
return head;
|
|
422
|
-
}
|
|
423
|
-
for (const element of value) head.push(key + ": " + element);
|
|
424
|
-
return head;
|
|
425
|
-
}, [line]).join("\r\n") + "\r\n\r\n";
|
|
426
|
-
};
|
|
544
|
+
let upgradeFailed = false;
|
|
427
545
|
setupSocket(socket);
|
|
428
546
|
if (head && head.length > 0) socket.unshift(head);
|
|
429
547
|
socket.on("error", onSocketError);
|
|
@@ -431,11 +549,10 @@ const websocketIncomingMiddleware = [
|
|
|
431
549
|
if (server) server.emit("proxyReqWs", proxyReq, req, socket, options, head);
|
|
432
550
|
proxyReq.on("error", onOutgoingError);
|
|
433
551
|
proxyReq.on("response", function(res) {
|
|
434
|
-
if (!res.upgrade)
|
|
435
|
-
socket.
|
|
436
|
-
res.
|
|
437
|
-
|
|
438
|
-
} else res.resume();
|
|
552
|
+
if (!res.upgrade) {
|
|
553
|
+
if (!socket.destroyed && socket.writable) pipeNonUpgradeResponse(res, socket, onOutgoingError);
|
|
554
|
+
else res.resume();
|
|
555
|
+
}
|
|
439
556
|
});
|
|
440
557
|
proxyReq.on("upgrade", function(proxyRes, proxySocket, proxyHead) {
|
|
441
558
|
proxySocket.on("error", onOutgoingError);
|
|
@@ -453,16 +570,22 @@ const websocketIncomingMiddleware = [
|
|
|
453
570
|
server.emit("open", proxySocket);
|
|
454
571
|
server.emit("proxySocket", proxySocket);
|
|
455
572
|
});
|
|
573
|
+
setUpgradeTimeout(proxyReq, socket, options.upgradeTimeout, (error) => {
|
|
574
|
+
upgradeFailed = true;
|
|
575
|
+
reportError(error);
|
|
576
|
+
});
|
|
456
577
|
proxyReq.end();
|
|
457
578
|
function onSocketError(err) {
|
|
458
|
-
if (
|
|
459
|
-
else server.emit("error", err, req, socket);
|
|
579
|
+
if (!upgradeFailed) reportError(err);
|
|
460
580
|
proxyReq.destroy();
|
|
461
581
|
}
|
|
462
582
|
function onOutgoingError(err) {
|
|
583
|
+
if (!upgradeFailed) reportError(err);
|
|
584
|
+
socket.end();
|
|
585
|
+
}
|
|
586
|
+
function reportError(err) {
|
|
463
587
|
if (callback) callback(err, req, socket);
|
|
464
588
|
else server.emit("error", err, req, socket);
|
|
465
|
-
socket.end();
|
|
466
589
|
}
|
|
467
590
|
})
|
|
468
591
|
];
|
|
@@ -548,6 +671,7 @@ function _createProxyFn(type, server) {
|
|
|
548
671
|
_resolve();
|
|
549
672
|
});
|
|
550
673
|
res.on("error", (error) => {
|
|
674
|
+
if (type === "ws" && server.listenerCount("error") > 0) return;
|
|
551
675
|
_reject(error);
|
|
552
676
|
});
|
|
553
677
|
for (const pass of server._getPasses(type)) {
|
package/dist/_chunks/server.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __exportAll, ensureExtensions, resolveExtensionDirs } from "./extensions.mjs";
|
|
2
|
-
import { createProxyServer } from "./libs/httpxy.mjs";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import { createReadStream, readFileSync, readdirSync, unlinkSync } from "node:fs";
|
|
5
2
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
3
|
+
import { createReadStream, readFileSync, readdirSync, unlinkSync } from "node:fs";
|
|
6
4
|
import { createServer } from "node:http";
|
|
7
5
|
import { extname, join, normalize, sep } from "node:path";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
7
|
+
import { createProxyServer } from "./libs/httpxy.mjs";
|
|
8
8
|
import { readFile, stat } from "node:fs/promises";
|
|
9
9
|
import { promisify } from "node:util";
|
|
10
10
|
import { brotliCompress, constants, gzip } from "node:zlib";
|
|
@@ -47,7 +47,8 @@ const brotliAsync = promisify(brotliCompress);
|
|
|
47
47
|
const gzipAsync = promisify(gzip);
|
|
48
48
|
const compressedCache = /* @__PURE__ */ new Map();
|
|
49
49
|
async function serveStatic(req, res, root, relPath) {
|
|
50
|
-
const
|
|
50
|
+
const decoded = decodeURIComponent(relPath);
|
|
51
|
+
const abs = normalize(join(root, decoded));
|
|
51
52
|
if (abs !== root && !abs.startsWith(root + sep)) {
|
|
52
53
|
res.writeHead(400).end("Bad request.");
|
|
53
54
|
return true;
|
|
@@ -110,10 +111,7 @@ function negotiateEncoding(acceptEncoding) {
|
|
|
110
111
|
if (accepted.has("br")) return "br";
|
|
111
112
|
if (accepted.has("gzip")) return "gzip";
|
|
112
113
|
}
|
|
113
|
-
var server_exports = /* @__PURE__ */ __exportAll({
|
|
114
|
-
createCodeServer: () => createCodeServer,
|
|
115
|
-
startCodeServer: () => startCodeServer
|
|
116
|
-
});
|
|
114
|
+
var server_exports = /* @__PURE__ */ __exportAll({ startCodeServer: () => startCodeServer });
|
|
117
115
|
const MANIFEST_BODY = JSON.stringify({
|
|
118
116
|
name: "coderaft",
|
|
119
117
|
short_name: "coderaft",
|
package/dist/cli.mjs
CHANGED
|
@@ -46,165 +46,6 @@ function gradientBanner(text) {
|
|
|
46
46
|
}).join("\n");
|
|
47
47
|
}
|
|
48
48
|
const BANNER = gradientBanner(BANNER_PLAIN);
|
|
49
|
-
const BANNER_LINES = BANNER.split("\n").length;
|
|
50
|
-
function createTUI(HEADER_LINES, opts) {
|
|
51
|
-
const c = {
|
|
52
|
-
cyan: "\x1B[36m",
|
|
53
|
-
bold: "\x1B[1m",
|
|
54
|
-
dim: "\x1B[2m",
|
|
55
|
-
reset: "\x1B[0m",
|
|
56
|
-
yellow: "\x1B[33m",
|
|
57
|
-
red: "\x1B[31m"
|
|
58
|
-
};
|
|
59
|
-
const logBuffer = [];
|
|
60
|
-
const maxBuffer = 5e3;
|
|
61
|
-
let scrollOffset = 0;
|
|
62
|
-
let url = "";
|
|
63
|
-
let rendering = false;
|
|
64
|
-
let stats = { rss: 0 };
|
|
65
|
-
let startedAt = 0;
|
|
66
|
-
const origStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
67
|
-
const write = (s) => origStdoutWrite(s);
|
|
68
|
-
const origConsoleLog = console.log;
|
|
69
|
-
const origConsoleError = console.error;
|
|
70
|
-
const origConsoleWarn = console.warn;
|
|
71
|
-
write("\x1B[?1049h\x1B[2J\x1B[H\x1B[?25l");
|
|
72
|
-
let destroyed = false;
|
|
73
|
-
const destroy = () => {
|
|
74
|
-
if (destroyed) return;
|
|
75
|
-
destroyed = true;
|
|
76
|
-
process.stdout.write = origStdoutWrite;
|
|
77
|
-
console.log = origConsoleLog;
|
|
78
|
-
console.error = origConsoleError;
|
|
79
|
-
console.warn = origConsoleWarn;
|
|
80
|
-
if (process.stdin.isTTY) process.stdin.setRawMode(false);
|
|
81
|
-
write("\x1B[?25h\x1B[?1049l");
|
|
82
|
-
const lines = [BANNER, ""];
|
|
83
|
-
if (url) {
|
|
84
|
-
let status = ` ${c.bold}\x1b[31m●${c.reset} ${c.cyan}${url}${c.reset}`;
|
|
85
|
-
const rss = stats.rss || 0;
|
|
86
|
-
if (rss > 0) status += ` ${c.dim}▪ mem ${(rss / 1024 / 1024).toFixed(0)} MB${c.reset}`;
|
|
87
|
-
if (startedAt) status += ` ${c.dim}▴ up ${formatUptime(Date.now() - startedAt)}${c.reset}`;
|
|
88
|
-
lines.push(status);
|
|
89
|
-
}
|
|
90
|
-
if (lines.length > 0) write(`\n${lines.join("\n")}\n\n`);
|
|
91
|
-
};
|
|
92
|
-
const addLines = (text) => {
|
|
93
|
-
const lines = text.split("\n");
|
|
94
|
-
const added = lines.length;
|
|
95
|
-
for (const line of lines) logBuffer.push(line);
|
|
96
|
-
while (logBuffer.length > maxBuffer) logBuffer.shift();
|
|
97
|
-
if (scrollOffset > 0) {
|
|
98
|
-
const logRows = (process.stdout.rows || 24) - HEADER_LINES;
|
|
99
|
-
const maxOffset = Math.max(0, logBuffer.length - logRows);
|
|
100
|
-
scrollOffset = Math.min(maxOffset, scrollOffset + added);
|
|
101
|
-
}
|
|
102
|
-
scheduleRender();
|
|
103
|
-
};
|
|
104
|
-
const format = (...args) => args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" ");
|
|
105
|
-
console.log = (...args) => addLines(format(...args));
|
|
106
|
-
console.error = (...args) => addLines(format(...args));
|
|
107
|
-
console.warn = (...args) => addLines(`${c.yellow}${format(...args)}${c.reset}`);
|
|
108
|
-
process.stdout.write = ((chunk, ...rest) => {
|
|
109
|
-
const str = typeof chunk === "string" ? chunk : chunk.toString();
|
|
110
|
-
if (rendering) return origStdoutWrite(chunk, ...rest);
|
|
111
|
-
addLines(str.replace(/\n$/, ""));
|
|
112
|
-
return true;
|
|
113
|
-
});
|
|
114
|
-
let renderTimer;
|
|
115
|
-
function scheduleRender() {
|
|
116
|
-
if (renderTimer) return;
|
|
117
|
-
renderTimer = setTimeout(() => {
|
|
118
|
-
renderTimer = void 0;
|
|
119
|
-
render();
|
|
120
|
-
}, 16);
|
|
121
|
-
}
|
|
122
|
-
function render() {
|
|
123
|
-
rendering = true;
|
|
124
|
-
const rows = process.stdout.rows || 24;
|
|
125
|
-
const cols = process.stdout.columns || 80;
|
|
126
|
-
const logRows = rows - HEADER_LINES;
|
|
127
|
-
if (logRows <= 0) {
|
|
128
|
-
rendering = false;
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const end = logBuffer.length - scrollOffset;
|
|
132
|
-
const start = Math.max(0, end - logRows);
|
|
133
|
-
const visible = logBuffer.slice(start, end);
|
|
134
|
-
let out = "\x1B[H";
|
|
135
|
-
const mem = `${((stats.rss || process.memoryUsage.rss()) / 1024 / 1024).toFixed(0)} MB`;
|
|
136
|
-
const sep = c.dim + "─".repeat(cols) + c.reset;
|
|
137
|
-
for (const line of BANNER.split("\n")) out += `\x1b[2K${line}\n`;
|
|
138
|
-
out += `\x1b[2K\n`;
|
|
139
|
-
if (url) {
|
|
140
|
-
let status = ` ${c.bold}\x1b[32m●${c.reset} ${c.cyan}${url}${c.reset}`;
|
|
141
|
-
status += ` ${c.dim}▪ mem ${mem}${c.reset}`;
|
|
142
|
-
if (startedAt) status += ` ${c.dim}▴ up ${formatUptime(Date.now() - startedAt)}${c.reset}`;
|
|
143
|
-
if (scrollOffset > 0) status += ` ${c.yellow}↑ ${scrollOffset}${c.reset}`;
|
|
144
|
-
out += `\x1b[2K${status}\n`;
|
|
145
|
-
if (opts?.onOpen) out += `\x1b[2K ${c.dim}press ${c.reset}${c.bold}enter${c.reset}${c.dim} to open ${c.reset}${c.bold}q${c.reset}${c.dim} to quit${c.reset}\n`;
|
|
146
|
-
} else out += `\x1b[2K ${c.dim}○ Starting...${c.reset}\n`;
|
|
147
|
-
out += `\x1b[2K${sep}\n`;
|
|
148
|
-
for (let i = 0; i < logRows; i++) out += `\x1b[2K${visible[i] ?? ""}\n`;
|
|
149
|
-
write(out);
|
|
150
|
-
rendering = false;
|
|
151
|
-
}
|
|
152
|
-
if (process.stdin.isTTY) {
|
|
153
|
-
process.stdin.setRawMode(true);
|
|
154
|
-
process.stdin.resume();
|
|
155
|
-
process.stdin.on("data", (data) => {
|
|
156
|
-
const key = data.toString();
|
|
157
|
-
const logRows = (process.stdout.rows || 24) - HEADER_LINES;
|
|
158
|
-
const maxOffset = Math.max(0, logBuffer.length - logRows);
|
|
159
|
-
if (key === "\x1B[A" || key === "k") {
|
|
160
|
-
scrollOffset = Math.min(maxOffset, scrollOffset + 1);
|
|
161
|
-
render();
|
|
162
|
-
} else if (key === "\x1B[B" || key === "j") {
|
|
163
|
-
scrollOffset = Math.max(0, scrollOffset - 1);
|
|
164
|
-
render();
|
|
165
|
-
} else if (key === "\x1B[5~") {
|
|
166
|
-
scrollOffset = Math.min(maxOffset, scrollOffset + logRows);
|
|
167
|
-
render();
|
|
168
|
-
} else if (key === "\x1B[6~") {
|
|
169
|
-
scrollOffset = Math.max(0, scrollOffset - logRows);
|
|
170
|
-
render();
|
|
171
|
-
} else if (key === "g") {
|
|
172
|
-
scrollOffset = maxOffset;
|
|
173
|
-
render();
|
|
174
|
-
} else if (key === "G") {
|
|
175
|
-
scrollOffset = 0;
|
|
176
|
-
render();
|
|
177
|
-
} else if (key === "\r" && url && opts?.onOpen) opts.onOpen();
|
|
178
|
-
else if (key === "q" || key === "") process.kill(process.pid, "SIGINT");
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
process.stdout.on("resize", () => render());
|
|
182
|
-
render();
|
|
183
|
-
let refreshInterval;
|
|
184
|
-
return {
|
|
185
|
-
setURL(u) {
|
|
186
|
-
url = u;
|
|
187
|
-
startedAt = Date.now();
|
|
188
|
-
render();
|
|
189
|
-
refreshInterval = setInterval(() => scheduleRender(), 2e3);
|
|
190
|
-
refreshInterval.unref();
|
|
191
|
-
},
|
|
192
|
-
setStats(s) {
|
|
193
|
-
stats = s;
|
|
194
|
-
},
|
|
195
|
-
destroy() {
|
|
196
|
-
if (refreshInterval) clearInterval(refreshInterval);
|
|
197
|
-
destroy();
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function formatUptime(ms) {
|
|
202
|
-
const s = Math.floor(ms / 1e3);
|
|
203
|
-
if (s < 60) return `${s}s`;
|
|
204
|
-
const m = Math.floor(s / 60);
|
|
205
|
-
if (m < 60) return `${m}m ${s % 60}s`;
|
|
206
|
-
return `${Math.floor(m / 60)}h ${m % 60}m`;
|
|
207
|
-
}
|
|
208
49
|
if (process.argv.includes("--worker")) startWorker();
|
|
209
50
|
else startMain();
|
|
210
51
|
function startWorker() {
|
|
@@ -263,20 +104,12 @@ async function startMain() {
|
|
|
263
104
|
extensions: values["preinstall-extension"],
|
|
264
105
|
vscode
|
|
265
106
|
};
|
|
266
|
-
|
|
267
|
-
const HEADER_LINES = BANNER_LINES + 4;
|
|
268
|
-
let tui;
|
|
269
|
-
let serverURL = "";
|
|
270
|
-
if (interactive) tui = createTUI(HEADER_LINES, { onOpen: () => {
|
|
271
|
-
if (serverURL) openBrowser(serverURL);
|
|
272
|
-
} });
|
|
273
|
-
process.on("exit", () => tui?.destroy());
|
|
107
|
+
console.log(`\n${BANNER}`);
|
|
274
108
|
if (values["no-fork"]) {
|
|
275
109
|
const { startCodeServer } = await import("./_chunks/server.mjs").then((n) => n.server_exports);
|
|
276
110
|
let handle;
|
|
277
111
|
let shuttingDown = false;
|
|
278
112
|
const shutdown = () => {
|
|
279
|
-
tui?.destroy();
|
|
280
113
|
if (shuttingDown) process.exit(0);
|
|
281
114
|
shuttingDown = true;
|
|
282
115
|
setTimeout(() => process.exit(0), 3e3).unref();
|
|
@@ -288,23 +121,14 @@ async function startMain() {
|
|
|
288
121
|
handle = await startCodeServer(opts);
|
|
289
122
|
onReady(handle.url);
|
|
290
123
|
} else {
|
|
291
|
-
const child = fork(process.argv[1], ["--worker"], {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
],
|
|
298
|
-
env: {
|
|
299
|
-
...process.env,
|
|
300
|
-
FORCE_COLOR: "1"
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
child.stdout.on("data", (chunk) => process.stdout.write(chunk));
|
|
304
|
-
child.stderr.on("data", (chunk) => console.error(chunk.toString()));
|
|
124
|
+
const child = fork(process.argv[1], ["--worker"], { stdio: [
|
|
125
|
+
"ignore",
|
|
126
|
+
"inherit",
|
|
127
|
+
"inherit",
|
|
128
|
+
"ipc"
|
|
129
|
+
] });
|
|
305
130
|
let shuttingDown = false;
|
|
306
131
|
const shutdown = () => {
|
|
307
|
-
tui?.destroy();
|
|
308
132
|
if (shuttingDown) process.exit(0);
|
|
309
133
|
shuttingDown = true;
|
|
310
134
|
child.kill("SIGTERM");
|
|
@@ -324,12 +148,7 @@ async function startMain() {
|
|
|
324
148
|
});
|
|
325
149
|
}
|
|
326
150
|
function onReady(url) {
|
|
327
|
-
serverURL = url;
|
|
328
151
|
if (values.open) openBrowser(url);
|
|
329
|
-
if (tui) {
|
|
330
|
-
tui.setURL(url);
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
152
|
const c = {
|
|
334
153
|
cyan: "\x1B[36m",
|
|
335
154
|
bold: "\x1B[1m",
|
|
@@ -337,7 +156,7 @@ async function startMain() {
|
|
|
337
156
|
reset: "\x1B[0m"
|
|
338
157
|
};
|
|
339
158
|
const mem = `${(process.memoryUsage.rss() / 1024 / 1024).toFixed(0)} MB`;
|
|
340
|
-
console.log(`\n
|
|
159
|
+
console.log(`\n ${c.bold}${c.cyan}➜${c.reset} ${c.bold}Ready${c.reset} ${c.dim}at${c.reset} ${c.cyan}${url}${c.reset}\n ${c.bold}${c.cyan}➜${c.reset} ${c.bold}Memory${c.reset} ${c.dim}${mem}${c.reset}\n`);
|
|
341
160
|
}
|
|
342
161
|
}
|
|
343
162
|
function openBrowser(url) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChildProcess } from "node:child_process";
|
|
2
1
|
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
3
|
-
import { EventEmitter } from "node:events";
|
|
4
2
|
import { Duplex } from "node:stream";
|
|
3
|
+
import { ChildProcess } from "node:child_process";
|
|
4
|
+
import { EventEmitter } from "node:events";
|
|
5
5
|
/**
|
|
6
6
|
* Options for `createServer()` from VS Code server
|
|
7
7
|
* (`code-server/lib/vscode/out/server-main.js`).
|
|
@@ -147,8 +147,8 @@ interface CodeServerHandle {
|
|
|
147
147
|
connectionToken: string;
|
|
148
148
|
close(): Promise<void>;
|
|
149
149
|
}
|
|
150
|
-
declare function createCodeServer(opts?: CreateCodeServerOptions): Promise<CodeServerHandler>;
|
|
151
|
-
declare function startCodeServer(opts?: StartCodeServerOptions): Promise<CodeServerHandle>;
|
|
150
|
+
export declare function createCodeServer(opts?: CreateCodeServerOptions): Promise<CodeServerHandler>;
|
|
151
|
+
export declare function startCodeServer(opts?: StartCodeServerOptions): Promise<CodeServerHandle>;
|
|
152
152
|
interface SpawnProcessOptions {
|
|
153
153
|
/** Extra environment variables merged into the worker's `process.env`. */
|
|
154
154
|
env?: NodeJS.ProcessEnv;
|
|
@@ -169,7 +169,7 @@ interface SpawnCodeServerOptions extends StartCodeServerOptions {
|
|
|
169
169
|
/** Options for the forked worker process. */
|
|
170
170
|
spawn?: SpawnProcessOptions;
|
|
171
171
|
}
|
|
172
|
-
interface SpawnedCodeServer {
|
|
172
|
+
export interface SpawnedCodeServer {
|
|
173
173
|
/**
|
|
174
174
|
* Emitted when the handle loses its worker: crash, explicit kill, or a
|
|
175
175
|
* `reload()` whose respawn failed (the old worker is already gone; the
|
|
@@ -185,7 +185,7 @@ interface SpawnedCodeServer {
|
|
|
185
185
|
on(event: "error", listener: (err: Error) => void): this;
|
|
186
186
|
on(event: string, listener: (...args: unknown[]) => void): this;
|
|
187
187
|
}
|
|
188
|
-
declare class SpawnedCodeServer extends EventEmitter {
|
|
188
|
+
export declare class SpawnedCodeServer extends EventEmitter {
|
|
189
189
|
#private;
|
|
190
190
|
/** The forked worker process (changes after `reload`). */
|
|
191
191
|
proc: ChildProcess;
|
|
@@ -203,7 +203,7 @@ declare class SpawnedCodeServer extends EventEmitter {
|
|
|
203
203
|
/** Kill the current worker and spawn a new one with the original options. */
|
|
204
204
|
reload(): Promise<void>;
|
|
205
205
|
}
|
|
206
|
-
declare function spawnCodeServer(opts?: SpawnCodeServerOptions): Promise<SpawnedCodeServer>;
|
|
206
|
+
export declare function spawnCodeServer(opts?: SpawnCodeServerOptions): Promise<SpawnedCodeServer>;
|
|
207
207
|
interface ExtensionDirs {
|
|
208
208
|
/** VS Code server data directory. */
|
|
209
209
|
serverDataDir: string;
|
|
@@ -217,7 +217,7 @@ interface ExtensionDirs {
|
|
|
217
217
|
* agree on, mirroring VS Code's OSS server defaults
|
|
218
218
|
* (`~/.vscode-server-oss/{,data,extensions}`).
|
|
219
219
|
*/
|
|
220
|
-
declare function resolveExtensionDirs(vscode?: VSCodeServerOptions): ExtensionDirs;
|
|
220
|
+
export declare function resolveExtensionDirs(vscode?: VSCodeServerOptions): ExtensionDirs;
|
|
221
221
|
interface EnsureExtensionsOptions {
|
|
222
222
|
/** Directory extensions are installed into (must match the running server). */
|
|
223
223
|
extensionsDir: string;
|
|
@@ -235,7 +235,7 @@ interface EnsureExtensionsOptions {
|
|
|
235
235
|
* `extensions.json` manifest VS Code maintains in the extensions directory.
|
|
236
236
|
* Returns an empty set when the directory or manifest doesn't exist yet.
|
|
237
237
|
*/
|
|
238
|
-
declare function readInstalledExtensions(extensionsDir: string): Set<string>;
|
|
238
|
+
export declare function readInstalledExtensions(extensionsDir: string): Set<string>;
|
|
239
239
|
/**
|
|
240
240
|
* Ensure the given extensions are installed before the server boots. Missing
|
|
241
241
|
* extensions are installed from the gallery (Open VSX by default) in a forked
|
|
@@ -243,7 +243,7 @@ declare function readInstalledExtensions(extensionsDir: string): Set<string>;
|
|
|
243
243
|
* in the server process. Best-effort: install failures are logged, not thrown,
|
|
244
244
|
* so a bad id or a gallery outage never blocks startup.
|
|
245
245
|
*/
|
|
246
|
-
declare function ensureExtensions(specs: string[], opts: EnsureExtensionsOptions): Promise<void>;
|
|
246
|
+
export declare function ensureExtensions(specs: string[], opts: EnsureExtensionsOptions): Promise<void>;
|
|
247
247
|
interface ExtensionCommand {
|
|
248
248
|
/** Specs to install: gallery id, `id@version`, or a path to a local `.vsix`. */
|
|
249
249
|
install?: string[];
|
|
@@ -267,5 +267,5 @@ interface ExtensionCommand {
|
|
|
267
267
|
* A zero exit from the CLI is verified against the extensions manifest, so a
|
|
268
268
|
* spec that silently didn't land still reports failure to the caller.
|
|
269
269
|
*/
|
|
270
|
-
declare function runExtensionCommand(cmd: ExtensionCommand, dirs: ExtensionDirs): Promise<number>;
|
|
271
|
-
export {
|
|
270
|
+
export declare function runExtensionCommand(cmd: ExtensionCommand, dirs: ExtensionDirs): Promise<number>;
|
|
271
|
+
export type { CodeServerHandle, CodeServerHandler, CreateCodeServerOptions, EnsureExtensionsOptions, ExtensionCommand, ExtensionDirs, SpawnCodeServerOptions, SpawnProcessOptions, StartCodeServerOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ensureExtensions, readInstalledExtensions, resolveExtensionDirs, runExtensionCommand } from "./_chunks/extensions.mjs";
|
|
2
1
|
import { createCodeServer, startCodeServer } from "./_chunks/server.mjs";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
2
|
import { fork } from "node:child_process";
|
|
5
3
|
import { EventEmitter } from "node:events";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { ensureExtensions, readInstalledExtensions, resolveExtensionDirs, runExtensionCommand } from "./_chunks/extensions.mjs";
|
|
6
6
|
var SpawnedCodeServer = class SpawnedCodeServer extends EventEmitter {
|
|
7
7
|
proc;
|
|
8
8
|
url;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coderaft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"repository": "pithings/coderaft",
|
|
5
5
|
"bin": {
|
|
6
6
|
"coderaft": "./dist/cli.mjs"
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"build": "obuild"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"code-server": "https://github.com/coder/code-server/releases/download/v4.
|
|
34
|
+
"code-server": "https://github.com/coder/code-server/releases/download/v4.146.0/package.tar.gz",
|
|
35
35
|
"@devcontainers/cli": "0.88.0",
|
|
36
36
|
"@github/copilot": "workspace:*",
|
|
37
37
|
"@github/copilot-sdk": "workspace:*",
|
|
38
|
+
"@hpke/core": "^1.9.0",
|
|
38
39
|
"@microsoft/1ds-core-js": "workspace:*",
|
|
39
40
|
"@microsoft/1ds-post-js": "workspace:*",
|
|
40
|
-
"@microsoft/mxc-sdk": "0.8.0",
|
|
41
41
|
"@parcel/watcher": "workspace:*",
|
|
42
42
|
"@vscode/copilot-api": "^0.5.2",
|
|
43
43
|
"@vscode/deviceid": "workspace:*",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"jschardet": "3.1.4",
|
|
73
73
|
"katex": "^0.16.22",
|
|
74
74
|
"kerberos": "workspace:*",
|
|
75
|
+
"libsodium-wrappers": "^0.8.4",
|
|
75
76
|
"minimist": "^1.2.8",
|
|
76
77
|
"node-addon-api": "^6.0.0",
|
|
77
78
|
"node-pty": "workspace:*",
|
package/worker.mjs
CHANGED
|
@@ -60,5 +60,53 @@ const forwardFatal = (kind) => (err) => {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
// VS Code's promise-cancellation races surface as `CancellationError`s — for
|
|
64
|
+
// example RequestStore's timeout promise rejecting when a pending ptyHost
|
|
65
|
+
// resolved-variables request is cancelled on extension-host restart (it has
|
|
66
|
+
// no rejection handler). Those are by design, not bugs: VS Code's own
|
|
67
|
+
// handlers ignore them. Treating them as fatal makes every extension-host
|
|
68
|
+
// restart crash the worker, and because the parent respawns us and the
|
|
69
|
+
// browser reconnects, the same race fires again — a self-sustaining crash
|
|
70
|
+
// loop. Mirrors VS Code's `isCancellationError` (src/vs/base/common/errors.ts).
|
|
71
|
+
const isCanceled = (err) =>
|
|
72
|
+
err instanceof Error && err.name === "Canceled" && err.message === "Canceled";
|
|
73
|
+
|
|
74
|
+
// RequestStore cancels its timeout on every successful reply, so these are
|
|
75
|
+
// frequent in normal operation. Log the first one only.
|
|
76
|
+
let loggedCanceled = false;
|
|
77
|
+
const ignoreCanceled = (err) => {
|
|
78
|
+
if (loggedCanceled || shuttingDown) return;
|
|
79
|
+
loggedCanceled = true;
|
|
80
|
+
console.error(
|
|
81
|
+
"[coderaft worker] ignoring Canceled error (further ones will not be logged):",
|
|
82
|
+
err,
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// With `--unhandled-rejections=strict` (e.g. via NODE_OPTIONS), rejections
|
|
87
|
+
// arrive here instead of `unhandledRejection`, so filter in both places.
|
|
88
|
+
process.on("uncaughtException", (err) => {
|
|
89
|
+
if (isCanceled(err)) return ignoreCanceled(err);
|
|
90
|
+
forwardFatal("uncaughtException")(err);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Node emits `unhandledRejection` as soon as a rejected promise has no handler
|
|
94
|
+
// at the end of a microtask drain, even if one is attached a tick later. Like
|
|
95
|
+
// VS Code, give it a grace period and only treat it as fatal if it is still
|
|
96
|
+
// unhandled afterwards.
|
|
97
|
+
const UNHANDLED_REJECTION_GRACE_MS = 1000;
|
|
98
|
+
const pendingRejections = new Map();
|
|
99
|
+
|
|
100
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
101
|
+
if (shuttingDown) return;
|
|
102
|
+
if (isCanceled(reason)) return ignoreCanceled(reason);
|
|
103
|
+
pendingRejections.set(promise, reason);
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
if (!pendingRejections.delete(promise)) return;
|
|
106
|
+
forwardFatal("unhandledRejection")(reason);
|
|
107
|
+
}, UNHANDLED_REJECTION_GRACE_MS);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
process.on("rejectionHandled", (promise) => {
|
|
111
|
+
pendingRejections.delete(promise);
|
|
112
|
+
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Licenses of Bundled Dependencies
|
|
2
|
-
|
|
3
|
-
The published artifact additionally contains code with the following licenses:
|
|
4
|
-
MIT
|
|
5
|
-
|
|
6
|
-
# Bundled Dependencies
|
|
7
|
-
|
|
8
|
-
## httpxy
|
|
9
|
-
|
|
10
|
-
License: MIT
|
|
11
|
-
Repository: https://github.com/unjs/httpxy
|
|
12
|
-
|
|
13
|
-
> MIT License
|
|
14
|
-
>
|
|
15
|
-
> Copyright (c) Pooya Parsa <pooya@pi0.io>
|
|
16
|
-
>
|
|
17
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
19
|
-
> in the Software without restriction, including without limitation the rights
|
|
20
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
22
|
-
> furnished to do so, subject to the following conditions:
|
|
23
|
-
>
|
|
24
|
-
> The above copyright notice and this permission notice shall be included in all
|
|
25
|
-
> copies or substantial portions of the Software.
|
|
26
|
-
>
|
|
27
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
-
> SOFTWARE.
|
|
34
|
-
>
|
|
35
|
-
> ----
|
|
36
|
-
>
|
|
37
|
-
> Based on http-party/node-http-proxy (9b96cd7)
|
|
38
|
-
>
|
|
39
|
-
> Copyright (c) 2010-2016 Charlie Robbins, Jarrett Cruger & the Contributors.
|
|
40
|
-
>
|
|
41
|
-
> Permission is hereby granted, free of charge, to any person obtaining
|
|
42
|
-
> a copy of this software and associated documentation files (the
|
|
43
|
-
> "Software"), to deal in the Software without restriction, including
|
|
44
|
-
> without limitation the rights to use, copy, modify, merge, publish,
|
|
45
|
-
> distribute, sublicense, and/or sell copies of the Software, and to
|
|
46
|
-
> permit persons to whom the Software is furnished to do so, subject to
|
|
47
|
-
> the following conditions:
|
|
48
|
-
>
|
|
49
|
-
> The above copyright notice and this permission notice shall be
|
|
50
|
-
> included in all copies or substantial portions of the Software.
|
|
51
|
-
>
|
|
52
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
53
|
-
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
54
|
-
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
55
|
-
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
56
|
-
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
57
|
-
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
58
|
-
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|