@replit/river 0.11.0 → 0.12.1
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 +28 -8
- package/dist/{builder-1f26296b.d.ts → builder-c593de11.d.ts} +14 -13
- package/dist/{chunk-3JGVFWKQ.js → chunk-55XUAPC6.js} +205 -180
- package/dist/{chunk-R6H2BIMC.js → chunk-GZ7HCLLM.js} +31 -7
- package/dist/{chunk-T7M7OKPE.js → chunk-H4BYJELI.js} +5 -1
- package/dist/{chunk-GKPT5YQE.js → chunk-IIBVKYDB.js} +6 -34
- package/dist/chunk-M6LY25P2.js +47 -0
- package/dist/chunk-QEYN2Z6O.js +726 -0
- package/dist/chunk-RDTTKCGV.js +40 -0
- package/dist/chunk-TKINU53F.js +44 -0
- package/dist/chunk-XFFS4UOD.js +127 -0
- package/dist/codec/index.cjs +13 -7
- package/dist/codec/index.js +2 -4
- package/dist/connection-bf7811aa.d.ts +17 -0
- package/dist/connection-d880aa4a.d.ts +18 -0
- package/dist/connection-eb10d250.d.ts +15 -0
- package/dist/index-0c0a69f6.d.ts +440 -0
- package/dist/logging/index.cjs +8 -3
- package/dist/logging/index.d.cts +6 -1
- package/dist/logging/index.d.ts +6 -1
- package/dist/logging/index.js +5 -3
- package/dist/messageFraming-b200ef25.d.ts +20 -0
- package/dist/router/index.cjs +250 -211
- package/dist/router/index.d.cts +6 -7
- package/dist/router/index.d.ts +6 -7
- package/dist/router/index.js +3 -3
- package/dist/transport/impls/stdio/client.cjs +909 -0
- package/dist/transport/impls/stdio/client.d.cts +27 -0
- package/dist/transport/impls/stdio/client.d.ts +27 -0
- package/dist/transport/impls/stdio/client.js +42 -0
- package/dist/transport/impls/stdio/server.cjs +883 -0
- package/dist/transport/impls/stdio/server.d.cts +25 -0
- package/dist/transport/impls/stdio/server.d.ts +25 -0
- package/dist/transport/impls/stdio/server.js +33 -0
- package/dist/transport/impls/uds/client.cjs +911 -0
- package/dist/transport/impls/uds/client.d.cts +16 -0
- package/dist/transport/impls/uds/client.d.ts +16 -0
- package/dist/transport/impls/uds/client.js +44 -0
- package/dist/transport/impls/uds/server.cjs +885 -0
- package/dist/transport/impls/uds/server.d.cts +16 -0
- package/dist/transport/impls/uds/server.d.ts +16 -0
- package/dist/transport/impls/uds/server.js +39 -0
- package/dist/transport/impls/ws/client.cjs +612 -249
- package/dist/transport/impls/ws/client.d.cts +6 -21
- package/dist/transport/impls/ws/client.d.ts +6 -21
- package/dist/transport/impls/ws/client.js +83 -7
- package/dist/transport/impls/ws/server.cjs +565 -196
- package/dist/transport/impls/ws/server.d.cts +6 -10
- package/dist/transport/impls/ws/server.d.ts +6 -10
- package/dist/transport/impls/ws/server.js +31 -8
- package/dist/transport/index.cjs +673 -130
- package/dist/transport/index.d.cts +3 -276
- package/dist/transport/index.d.ts +3 -276
- package/dist/transport/index.js +13 -10
- package/dist/util/testHelpers.cjs +40 -602
- package/dist/util/testHelpers.d.cts +18 -37
- package/dist/util/testHelpers.d.ts +18 -37
- package/dist/util/testHelpers.js +27 -47
- package/package.json +29 -14
- package/dist/chunk-5IC5XMWK.js +0 -140
- package/dist/chunk-L7D75G4K.js +0 -29
- package/dist/chunk-LQXPKF3A.js +0 -282
- package/dist/chunk-PJ2EUO7O.js +0 -63
- package/dist/chunk-WVT5QXMZ.js +0 -20
- package/dist/chunk-ZE4MX7DF.js +0 -75
- package/dist/connection-2529fc14.d.ts +0 -10
- package/dist/connection-316d6e3a.d.ts +0 -10
- package/dist/connection-8e19874c.d.ts +0 -11
- package/dist/connection-f7688cc1.d.ts +0 -11
- package/dist/transport/impls/stdio/stdio.cjs +0 -518
- package/dist/transport/impls/stdio/stdio.d.cts +0 -26
- package/dist/transport/impls/stdio/stdio.d.ts +0 -26
- package/dist/transport/impls/stdio/stdio.js +0 -70
- package/dist/transport/impls/unixsocket/client.cjs +0 -516
- package/dist/transport/impls/unixsocket/client.d.cts +0 -16
- package/dist/transport/impls/unixsocket/client.d.ts +0 -16
- package/dist/transport/impls/unixsocket/client.js +0 -67
- package/dist/transport/impls/unixsocket/server.cjs +0 -520
- package/dist/transport/impls/unixsocket/server.d.cts +0 -18
- package/dist/transport/impls/unixsocket/server.d.ts +0 -18
- package/dist/transport/impls/unixsocket/server.js +0 -73
- /package/dist/{chunk-ORAG7IAU.js → chunk-5IZ2UHWV.js} +0 -0
|
@@ -6,7 +6,7 @@ var LoggingLevels = {
|
|
|
6
6
|
error: 2
|
|
7
7
|
};
|
|
8
8
|
var log;
|
|
9
|
-
var defaultLoggingLevel = "
|
|
9
|
+
var defaultLoggingLevel = "info";
|
|
10
10
|
function bindLogger(write, color) {
|
|
11
11
|
const debug = color ? "\x1B[37mdebug\x1B[0m" : "debug";
|
|
12
12
|
const info = color ? "\x1B[37minfo\x1B[0m" : "info";
|
|
@@ -20,6 +20,9 @@ function bindLogger(write, color) {
|
|
|
20
20
|
minLevel: log?.minLevel ?? defaultLoggingLevel
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
function unbindLogger() {
|
|
24
|
+
log = void 0;
|
|
25
|
+
}
|
|
23
26
|
function setLevel(level) {
|
|
24
27
|
if (log) {
|
|
25
28
|
log.minLevel = level;
|
|
@@ -29,5 +32,6 @@ function setLevel(level) {
|
|
|
29
32
|
export {
|
|
30
33
|
log,
|
|
31
34
|
bindLogger,
|
|
35
|
+
unbindLogger,
|
|
32
36
|
setLevel
|
|
33
37
|
};
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Connection
|
|
3
|
-
} from "./chunk-LQXPKF3A.js";
|
|
4
|
-
|
|
5
1
|
// transport/transforms/messageFraming.ts
|
|
6
2
|
import { Transform } from "node:stream";
|
|
7
3
|
var Uint32LengthPrefixFraming = class extends Transform {
|
|
8
4
|
receivedBuffer;
|
|
9
5
|
maxBufferSizeBytes;
|
|
10
|
-
constructor({
|
|
11
|
-
preAllocatedBufferSize,
|
|
12
|
-
maxBufferSizeBytes,
|
|
13
|
-
...options
|
|
14
|
-
}) {
|
|
6
|
+
constructor({ maxBufferSizeBytes, ...options }) {
|
|
15
7
|
super(options);
|
|
16
8
|
this.maxBufferSizeBytes = maxBufferSizeBytes;
|
|
17
|
-
this.receivedBuffer = Buffer.alloc(
|
|
9
|
+
this.receivedBuffer = Buffer.alloc(0);
|
|
18
10
|
}
|
|
19
11
|
_transform(chunk, _encoding, cb) {
|
|
20
12
|
if (this.receivedBuffer.byteLength + chunk.byteLength > this.maxBufferSizeBytes) {
|
|
@@ -22,7 +14,8 @@ var Uint32LengthPrefixFraming = class extends Transform {
|
|
|
22
14
|
`buffer overflow: ${this.receivedBuffer.byteLength}B > ${this.maxBufferSizeBytes}B`
|
|
23
15
|
);
|
|
24
16
|
this.emit("error", err);
|
|
25
|
-
|
|
17
|
+
cb(err);
|
|
18
|
+
return;
|
|
26
19
|
}
|
|
27
20
|
this.receivedBuffer = Buffer.concat([this.receivedBuffer, chunk]);
|
|
28
21
|
while (this.receivedBuffer.length > 4) {
|
|
@@ -51,10 +44,8 @@ var Uint32LengthPrefixFraming = class extends Transform {
|
|
|
51
44
|
};
|
|
52
45
|
function createLengthEncodedStream(options) {
|
|
53
46
|
return new Uint32LengthPrefixFraming({
|
|
54
|
-
maxBufferSizeBytes: options?.maxBufferSizeBytes ?? 16 * 1024 * 1024
|
|
47
|
+
maxBufferSizeBytes: options?.maxBufferSizeBytes ?? 16 * 1024 * 1024
|
|
55
48
|
// 16MB
|
|
56
|
-
preAllocatedBufferSize: options?.preAllocatedBufferSize ?? 16 * 1024
|
|
57
|
-
// 16KB
|
|
58
49
|
});
|
|
59
50
|
}
|
|
60
51
|
var MessageFramer = {
|
|
@@ -66,25 +57,6 @@ var MessageFramer = {
|
|
|
66
57
|
}
|
|
67
58
|
};
|
|
68
59
|
|
|
69
|
-
// transport/impls/stdio/connection.ts
|
|
70
|
-
var StreamConnection = class extends Connection {
|
|
71
|
-
output;
|
|
72
|
-
constructor(transport, connectedTo, output) {
|
|
73
|
-
super(transport, connectedTo);
|
|
74
|
-
this.output = output;
|
|
75
|
-
}
|
|
76
|
-
send(payload) {
|
|
77
|
-
if (!this.output.writable) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return this.output.write(MessageFramer.write(payload));
|
|
81
|
-
}
|
|
82
|
-
async close() {
|
|
83
|
-
this.output.end();
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
60
|
export {
|
|
88
|
-
MessageFramer
|
|
89
|
-
StreamConnection
|
|
61
|
+
MessageFramer
|
|
90
62
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MessageFramer
|
|
3
|
+
} from "./chunk-IIBVKYDB.js";
|
|
4
|
+
import {
|
|
5
|
+
Connection
|
|
6
|
+
} from "./chunk-QEYN2Z6O.js";
|
|
7
|
+
|
|
8
|
+
// transport/impls/stdio/connection.ts
|
|
9
|
+
var StreamConnection = class extends Connection {
|
|
10
|
+
input;
|
|
11
|
+
output;
|
|
12
|
+
framer;
|
|
13
|
+
constructor(input, output) {
|
|
14
|
+
super();
|
|
15
|
+
this.framer = MessageFramer.createFramedStream();
|
|
16
|
+
this.input = input.pipe(this.framer);
|
|
17
|
+
this.output = output;
|
|
18
|
+
}
|
|
19
|
+
addDataListener(cb) {
|
|
20
|
+
this.input.on("data", cb);
|
|
21
|
+
}
|
|
22
|
+
removeDataListener(cb) {
|
|
23
|
+
this.input.off("data", cb);
|
|
24
|
+
}
|
|
25
|
+
addCloseListener(cb) {
|
|
26
|
+
this.input.on("close", cb);
|
|
27
|
+
this.output.on("close", cb);
|
|
28
|
+
}
|
|
29
|
+
addErrorListener(cb) {
|
|
30
|
+
this.input.on("error", cb);
|
|
31
|
+
this.output.on("error", cb);
|
|
32
|
+
}
|
|
33
|
+
send(payload) {
|
|
34
|
+
if (!this.output.writable)
|
|
35
|
+
return false;
|
|
36
|
+
return this.output.write(MessageFramer.write(payload));
|
|
37
|
+
}
|
|
38
|
+
close() {
|
|
39
|
+
this.output.end();
|
|
40
|
+
this.input.unpipe(this.framer);
|
|
41
|
+
this.framer.destroy();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
StreamConnection
|
|
47
|
+
};
|