@yume-chan/adb 0.0.12 → 0.0.13
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/CHANGELOG.json +18 -0
- package/CHANGELOG.md +10 -1
- package/README.md +24 -17
- package/esm/adb.d.ts +6 -6
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +77 -59
- package/esm/adb.js.map +1 -1
- package/esm/auth.d.ts +6 -6
- package/esm/auth.d.ts.map +1 -1
- package/esm/auth.js +8 -6
- package/esm/auth.js.map +1 -1
- package/esm/backend.d.ts +2 -2
- package/esm/commands/install.d.ts.map +1 -1
- package/esm/commands/install.js +5 -7
- package/esm/commands/install.js.map +1 -1
- package/esm/commands/reverse.d.ts +2 -2
- package/esm/commands/subprocess/index.d.ts +19 -20
- package/esm/commands/subprocess/index.d.ts.map +1 -1
- package/esm/commands/subprocess/index.js +36 -31
- package/esm/commands/subprocess/index.js.map +1 -1
- package/esm/commands/subprocess/legacy.d.ts +14 -7
- package/esm/commands/subprocess/legacy.d.ts.map +1 -1
- package/esm/commands/subprocess/legacy.js +14 -5
- package/esm/commands/subprocess/legacy.js.map +1 -1
- package/esm/commands/subprocess/protocol.d.ts +3 -2
- package/esm/commands/subprocess/protocol.d.ts.map +1 -1
- package/esm/commands/subprocess/protocol.js +6 -4
- package/esm/commands/subprocess/protocol.js.map +1 -1
- package/esm/commands/subprocess/protocols/index.d.ts +4 -0
- package/esm/commands/subprocess/protocols/index.d.ts.map +1 -0
- package/esm/commands/subprocess/protocols/index.js +4 -0
- package/esm/commands/subprocess/protocols/index.js.map +1 -0
- package/esm/commands/subprocess/protocols/none.d.ts +35 -0
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -0
- package/esm/commands/subprocess/protocols/none.js +53 -0
- package/esm/commands/subprocess/protocols/none.js.map +1 -0
- package/esm/commands/subprocess/protocols/shell.d.ts +39 -0
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -0
- package/esm/commands/subprocess/protocols/shell.js +155 -0
- package/esm/commands/subprocess/protocols/shell.js.map +1 -0
- package/esm/commands/subprocess/protocols/types.d.ts +50 -0
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -0
- package/esm/commands/subprocess/protocols/types.js +2 -0
- package/esm/commands/subprocess/protocols/types.js.map +1 -0
- package/esm/commands/subprocess/types.d.ts +9 -6
- package/esm/commands/subprocess/types.d.ts.map +1 -1
- package/esm/commands/sync/list.d.ts +25 -1
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +40 -5
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/request.d.ts +1 -0
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +1 -0
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +2 -1
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +2 -1
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/stat.d.ts +13 -1
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +20 -7
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +13 -35
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +39 -9
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/crypto.d.ts +23 -10
- package/esm/crypto.d.ts.map +1 -1
- package/esm/crypto.js +64 -46
- package/esm/crypto.js.map +1 -1
- package/esm/features.d.ts +4 -2
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +6 -2
- package/esm/features.js.map +1 -1
- package/esm/packet.d.ts +21 -2
- package/esm/packet.d.ts.map +1 -1
- package/esm/packet.js +2 -2
- package/esm/packet.js.map +1 -1
- package/esm/socket/dispatcher.d.ts +15 -11
- package/esm/socket/dispatcher.d.ts.map +1 -1
- package/esm/socket/dispatcher.js +16 -19
- package/esm/socket/dispatcher.js.map +1 -1
- package/esm/socket/socket.d.ts +19 -7
- package/esm/socket/socket.d.ts.map +1 -1
- package/esm/socket/socket.js +20 -11
- package/esm/socket/socket.js.map +1 -1
- package/esm/stream/detect.d.ts +1 -17
- package/esm/stream/detect.d.ts.map +1 -1
- package/esm/stream/detect.js +4 -5
- package/esm/stream/detect.js.map +1 -1
- package/esm/stream/detect.polyfill.d.ts.map +1 -1
- package/esm/stream/detect.polyfill.js +4 -1
- package/esm/stream/detect.polyfill.js.map +1 -1
- package/esm/stream/transform.d.ts +23 -23
- package/esm/stream/transform.d.ts.map +1 -1
- package/esm/stream/transform.js +74 -24
- package/esm/stream/transform.js.map +1 -1
- package/esm/utils/encoding.d.ts.map +1 -1
- package/esm/utils/encoding.js.map +1 -1
- package/esm/utils/index.d.ts +1 -1
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +1 -1
- package/esm/utils/index.js.map +1 -1
- package/package.json +6 -6
- package/src/adb.ts +93 -70
- package/src/auth.ts +21 -18
- package/src/backend.ts +2 -2
- package/src/commands/install.ts +7 -9
- package/src/commands/reverse.ts +2 -2
- package/src/commands/subprocess/index.ts +57 -42
- package/src/commands/subprocess/protocols/index.ts +3 -0
- package/src/commands/subprocess/{legacy.ts → protocols/none.ts} +18 -8
- package/src/commands/subprocess/{protocol.ts → protocols/shell.ts} +22 -17
- package/src/commands/subprocess/{types.ts → protocols/types.ts} +13 -9
- package/src/commands/sync/list.ts +51 -5
- package/src/commands/sync/request.ts +1 -0
- package/src/commands/sync/response.ts +8 -2
- package/src/commands/sync/stat.ts +36 -9
- package/src/commands/sync/sync.ts +55 -19
- package/src/crypto.ts +72 -56
- package/src/features.ts +6 -2
- package/src/packet.ts +17 -6
- package/src/socket/dispatcher.ts +43 -29
- package/src/socket/socket.ts +29 -22
- package/src/stream/detect.polyfill.ts +4 -1
- package/src/stream/detect.ts +4 -24
- package/src/stream/transform.ts +96 -40
- package/src/utils/index.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/src/utils/encoding.ts +0 -13
package/esm/socket/dispatcher.js
CHANGED
|
@@ -3,7 +3,7 @@ import { AutoDisposable, EventEmitter } from '@yume-chan/event';
|
|
|
3
3
|
import { AdbCommand, calculateChecksum } from '../packet.js';
|
|
4
4
|
import { AbortController, WritableStream } from '../stream/index.js';
|
|
5
5
|
import { decodeUtf8, encodeUtf8 } from '../utils/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { AdbSocketController } from './socket.js';
|
|
7
7
|
const EmptyUint8Array = new Uint8Array(0);
|
|
8
8
|
export class AdbPacketDispatcher extends AutoDisposable {
|
|
9
9
|
// ADB socket id starts from 1
|
|
@@ -11,18 +11,15 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
11
11
|
initializers = new AsyncOperationManager(1);
|
|
12
12
|
sockets = new Map();
|
|
13
13
|
_writer;
|
|
14
|
-
|
|
15
|
-
calculateChecksum = true;
|
|
16
|
-
appendNullToServiceString = true;
|
|
14
|
+
options;
|
|
17
15
|
_disconnected = new PromiseResolver();
|
|
18
16
|
get disconnected() { return this._disconnected.promise; }
|
|
19
17
|
incomingSocketEvent = this.addDisposable(new EventEmitter());
|
|
20
18
|
get onIncomingSocket() { return this.incomingSocketEvent.event; }
|
|
21
|
-
errorEvent = this.addDisposable(new EventEmitter());
|
|
22
|
-
get onError() { return this.errorEvent.event; }
|
|
23
19
|
_abortController = new AbortController();
|
|
24
|
-
constructor(connection) {
|
|
20
|
+
constructor(connection, options) {
|
|
25
21
|
super();
|
|
22
|
+
this.options = options;
|
|
26
23
|
connection.readable
|
|
27
24
|
.pipeTo(new WritableStream({
|
|
28
25
|
write: async (packet) => {
|
|
@@ -48,7 +45,6 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
catch (e) {
|
|
51
|
-
this.errorEvent.fire(e);
|
|
52
48
|
// Throw error here will stop the pipe
|
|
53
49
|
// But won't close `readable` because of `preventCancel: true`
|
|
54
50
|
throw e;
|
|
@@ -60,8 +56,8 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
60
56
|
})
|
|
61
57
|
.then(() => {
|
|
62
58
|
this.dispose();
|
|
63
|
-
}, () => {
|
|
64
|
-
|
|
59
|
+
}, (e) => {
|
|
60
|
+
this._disconnected.reject(e);
|
|
65
61
|
this.dispose();
|
|
66
62
|
});
|
|
67
63
|
this._writer = connection.writable.getWriter();
|
|
@@ -114,7 +110,7 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
114
110
|
this.initializers.resolve(localId, undefined);
|
|
115
111
|
const remoteId = packet.arg0;
|
|
116
112
|
const serviceString = decodeUtf8(packet.payload);
|
|
117
|
-
const
|
|
113
|
+
const controller = new AdbSocketController({
|
|
118
114
|
dispatcher: this,
|
|
119
115
|
localId,
|
|
120
116
|
remoteId,
|
|
@@ -125,11 +121,11 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
125
121
|
handled: false,
|
|
126
122
|
packet,
|
|
127
123
|
serviceString,
|
|
128
|
-
socket,
|
|
124
|
+
socket: controller.socket,
|
|
129
125
|
};
|
|
130
126
|
this.incomingSocketEvent.fire(args);
|
|
131
127
|
if (args.handled) {
|
|
132
|
-
this.sockets.set(localId,
|
|
128
|
+
this.sockets.set(localId, controller);
|
|
133
129
|
await this.sendPacket(AdbCommand.OK, localId, remoteId);
|
|
134
130
|
}
|
|
135
131
|
else {
|
|
@@ -137,21 +133,22 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
137
133
|
}
|
|
138
134
|
}
|
|
139
135
|
async createSocket(serviceString) {
|
|
140
|
-
if (this.appendNullToServiceString) {
|
|
136
|
+
if (this.options.appendNullToServiceString) {
|
|
141
137
|
serviceString += '\0';
|
|
142
138
|
}
|
|
143
139
|
const [localId, initializer] = this.initializers.add();
|
|
144
140
|
await this.sendPacket(AdbCommand.Open, localId, 0, serviceString);
|
|
141
|
+
// Fulfilled by `handleOk`
|
|
145
142
|
const remoteId = await initializer;
|
|
146
|
-
const
|
|
143
|
+
const controller = new AdbSocketController({
|
|
147
144
|
dispatcher: this,
|
|
148
145
|
localId,
|
|
149
146
|
remoteId,
|
|
150
147
|
localCreated: true,
|
|
151
148
|
serviceString,
|
|
152
149
|
});
|
|
153
|
-
this.sockets.set(localId,
|
|
154
|
-
return socket;
|
|
150
|
+
this.sockets.set(localId, controller);
|
|
151
|
+
return controller.socket;
|
|
155
152
|
}
|
|
156
153
|
async sendPacket(packetOrCommand, arg0, arg1, payload = EmptyUint8Array) {
|
|
157
154
|
let init;
|
|
@@ -170,10 +167,10 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
170
167
|
};
|
|
171
168
|
}
|
|
172
169
|
if (init.payload &&
|
|
173
|
-
init.payload.byteLength > this.maxPayloadSize) {
|
|
170
|
+
init.payload.byteLength > this.options.maxPayloadSize) {
|
|
174
171
|
throw new Error('payload too large');
|
|
175
172
|
}
|
|
176
|
-
if (this.calculateChecksum) {
|
|
173
|
+
if (this.options.calculateChecksum) {
|
|
177
174
|
calculateChecksum(init);
|
|
178
175
|
}
|
|
179
176
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/socket/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAA0C,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,cAAc,EAA0D,MAAM,oBAAoB,CAAC;AAC7H,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/socket/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,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AC,OAAO,EAAE,CAAC;SACpB;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAErB,IAAI;YACA,aAAa;YACb,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;SACjC;QAAC,MAAM,GAAG;QAEX,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAE3B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAE7B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ"}
|
package/esm/socket/socket.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReadableStream, WritableStream } from '../stream/index.js';
|
|
1
|
+
import { type ReadableStream, type ReadableWritablePair, type WritableStream } from '../stream/index.js';
|
|
2
2
|
import type { AdbPacketDispatcher } from './dispatcher.js';
|
|
3
3
|
export interface AdbSocketInfo {
|
|
4
4
|
localId: number;
|
|
@@ -6,15 +6,11 @@ export interface AdbSocketInfo {
|
|
|
6
6
|
localCreated: boolean;
|
|
7
7
|
serviceString: string;
|
|
8
8
|
}
|
|
9
|
-
export interface AdbSocketConstructionOptions {
|
|
9
|
+
export interface AdbSocketConstructionOptions extends AdbSocketInfo {
|
|
10
10
|
dispatcher: AdbPacketDispatcher;
|
|
11
|
-
localId: number;
|
|
12
|
-
remoteId: number;
|
|
13
|
-
localCreated: boolean;
|
|
14
|
-
serviceString: string;
|
|
15
11
|
highWaterMark?: number | undefined;
|
|
16
12
|
}
|
|
17
|
-
export declare class
|
|
13
|
+
export declare class AdbSocketController implements AdbSocketInfo, ReadableWritablePair<Uint8Array, Uint8Array> {
|
|
18
14
|
private readonly dispatcher;
|
|
19
15
|
readonly localId: number;
|
|
20
16
|
readonly remoteId: number;
|
|
@@ -28,7 +24,23 @@ export declare class AdbSocket implements AdbSocketInfo {
|
|
|
28
24
|
readonly writable: WritableStream<Uint8Array>;
|
|
29
25
|
private _closed;
|
|
30
26
|
get closed(): boolean;
|
|
27
|
+
private _socket;
|
|
28
|
+
get socket(): AdbSocket;
|
|
31
29
|
constructor(options: AdbSocketConstructionOptions);
|
|
30
|
+
enqueue(packet: Uint8Array): Promise<void>;
|
|
31
|
+
ack(): void;
|
|
32
|
+
close(): Promise<void>;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
export declare class AdbSocket implements AdbSocketInfo, ReadableWritablePair<Uint8Array, Uint8Array> {
|
|
36
|
+
private _controller;
|
|
37
|
+
get localId(): number;
|
|
38
|
+
get remoteId(): number;
|
|
39
|
+
get localCreated(): boolean;
|
|
40
|
+
get serviceString(): string;
|
|
41
|
+
get readable(): ReadableStream<Uint8Array>;
|
|
42
|
+
get writable(): WritableStream<Uint8Array>;
|
|
43
|
+
constructor(controller: AdbSocketController);
|
|
32
44
|
close(): Promise<void>;
|
|
33
45
|
}
|
|
34
46
|
//# sourceMappingURL=socket.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../src/socket/socket.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../src/socket/socket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiF,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxL,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IAC/D,UAAU,EAAE,mBAAmB,CAAC;IAEhC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,qBAAa,mBAAoB,YAAW,aAAa,EAAE,o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{ AdbCommand } from '../packet.js';
|
|
3
3
|
import { ChunkStream, DuplexStreamFactory, pipeFrom } from '../stream/index.js';
|
|
4
|
-
export class
|
|
4
|
+
export class AdbSocketController {
|
|
5
5
|
dispatcher;
|
|
6
6
|
localId;
|
|
7
7
|
remoteId;
|
|
@@ -15,6 +15,8 @@ export class AdbSocket {
|
|
|
15
15
|
writable;
|
|
16
16
|
_closed = false;
|
|
17
17
|
get closed() { return this._closed; }
|
|
18
|
+
_socket;
|
|
19
|
+
get socket() { return this._socket; }
|
|
18
20
|
constructor(options) {
|
|
19
21
|
Object.assign(this, options);
|
|
20
22
|
// Check this image to help you understand the stream graph
|
|
@@ -38,17 +40,12 @@ export class AdbSocket {
|
|
|
38
40
|
await this.dispatcher.sendPacket(AdbCommand.Write, this.localId, this.remoteId, chunk);
|
|
39
41
|
await this._writePromise.promise;
|
|
40
42
|
},
|
|
41
|
-
}), new ChunkStream(this.dispatcher.maxPayloadSize));
|
|
43
|
+
}), new ChunkStream(this.dispatcher.options.maxPayloadSize));
|
|
44
|
+
this._socket = new AdbSocket(this);
|
|
42
45
|
}
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
46
|
async enqueue(packet) {
|
|
47
47
|
await this._readableController.enqueue(packet);
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
49
|
ack() {
|
|
53
50
|
this._writePromise?.resolve();
|
|
54
51
|
}
|
|
@@ -62,9 +59,6 @@ export class AdbSocket {
|
|
|
62
59
|
await this.dispatcher.sendPacket(AdbCommand.Close, this.localId, this.remoteId);
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
62
|
dispose() {
|
|
69
63
|
this._closed = true;
|
|
70
64
|
this._factory.close();
|
|
@@ -72,4 +66,19 @@ export class AdbSocket {
|
|
|
72
66
|
this.close();
|
|
73
67
|
}
|
|
74
68
|
}
|
|
69
|
+
export class AdbSocket {
|
|
70
|
+
_controller;
|
|
71
|
+
get localId() { return this._controller.localId; }
|
|
72
|
+
get remoteId() { return this._controller.remoteId; }
|
|
73
|
+
get localCreated() { return this._controller.localCreated; }
|
|
74
|
+
get serviceString() { return this._controller.serviceString; }
|
|
75
|
+
get readable() { return this._controller.readable; }
|
|
76
|
+
get writable() { return this._controller.writable; }
|
|
77
|
+
constructor(controller) {
|
|
78
|
+
this._controller = controller;
|
|
79
|
+
}
|
|
80
|
+
close() {
|
|
81
|
+
return this._controller.close();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
75
84
|
//# sourceMappingURL=socket.js.map
|
package/esm/socket/socket.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../src/socket/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../src/socket/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAA0G,MAAM,oBAAoB,CAAC;AAiBxL,MAAM,OAAO,mBAAmB;IACX,UAAU,CAAuB;IAElC,OAAO,CAAU;IACjB,QAAQ,CAAU;IAClB,YAAY,CAAW;IACvB,aAAa,CAAU;IAE/B,QAAQ,CAA8C;IAEtD,SAAS,CAA6B;IACtC,mBAAmB,CAA4C;IACvE,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAExC,aAAa,CAAoC;IACzC,QAAQ,CAA6B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E7E,IAAW,QAAQ,KAAiC,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvF,IAAW,QAAQ,KAAiC,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEvF,YAAmB,UAA+B;QAC9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAEM,KAAK;QACR,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;CACJ"}
|
package/esm/stream/detect.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export * from 'web-streams-polyfill';
|
|
3
|
-
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
4
|
-
export interface AbortController {
|
|
5
|
-
/**
|
|
6
|
-
* Returns the AbortSignal object associated with this object.
|
|
7
|
-
*/
|
|
8
|
-
readonly signal: AbortSignal;
|
|
9
|
-
/**
|
|
10
|
-
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
11
|
-
*/
|
|
12
|
-
abort(): void;
|
|
13
|
-
}
|
|
14
|
-
export declare let AbortController: {
|
|
15
|
-
prototype: AbortController;
|
|
16
|
-
new (): AbortController;
|
|
17
|
-
};
|
|
1
|
+
export * from './detect.polyfill.js';
|
|
18
2
|
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/stream/detect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/stream/detect.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC"}
|
package/esm/stream/detect.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// cspell: ignore
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
({ AbortController } = globalThis);
|
|
1
|
+
// cspell: ignore vercel
|
|
2
|
+
// Always use polyfilled version because
|
|
3
|
+
// Vercel doesn't support Node.js 16 (`streams/web` module) yet
|
|
4
|
+
export * from './detect.polyfill.js';
|
|
6
5
|
//# sourceMappingURL=detect.js.map
|
package/esm/stream/detect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/stream/detect.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/stream/detect.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,wCAAwC;AACxC,+DAA+D;AAC/D,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.polyfill.d.ts","sourceRoot":"","sources":["../../src/stream/detect.polyfill.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"detect.polyfill.d.ts","sourceRoot":"","sources":["../../src/stream/detect.polyfill.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,cAAc,sBAAsB,CAAC;AAErC,iGAAiG;AACjG,MAAM,WAAW,eAAe;IAC5B;;OAEG;IAEH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACjB;AAED,eAAO,IAAI,eAAe,EAAE;IACxB,SAAS,EAAE,eAAe,CAAC;IAC3B,QAAO,eAAe,CAAC;CAC1B,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// cspell: ignore ponyfill
|
|
2
|
-
// TODO:
|
|
2
|
+
// TODO: Upgrade to `web-streams-polyfill@4.0.0-beta.2` once released.
|
|
3
|
+
// `web-streams-polyfill@4.0.0-beta.1` changed the default export to ponyfill,
|
|
4
|
+
// But it forgot to include `type` export so it's unusable.
|
|
5
|
+
// See https://github.com/MattiasBuelens/web-streams-polyfill/pull/107
|
|
3
6
|
export * from 'web-streams-polyfill';
|
|
4
7
|
export let AbortController;
|
|
5
8
|
({ AbortController } = globalThis);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.polyfill.js","sourceRoot":"","sources":["../../src/stream/detect.polyfill.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAG1B,
|
|
1
|
+
{"version":3,"file":"detect.polyfill.js","sourceRoot":"","sources":["../../src/stream/detect.polyfill.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAG1B,sEAAsE;AACtE,8EAA8E;AAC9E,2DAA2D;AAC3D,sEAAsE;AACtE,cAAc,sBAAsB,CAAC;AAerC,MAAM,CAAC,IAAI,eAGV,CAAC;AAEF,CAAC,EAAE,eAAe,EAAE,GAAG,UAAiB,CAAC,CAAC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type Struct from "@yume-chan/struct";
|
|
2
|
-
import type { StructValueType } from "@yume-chan/struct";
|
|
2
|
+
import type { StructValueType, ValueOrPromise } from "@yume-chan/struct";
|
|
3
3
|
import { AbortSignal, ReadableStream, TransformStream, WritableStream, type QueuingStrategy, type ReadableWritablePair, type UnderlyingSink, type UnderlyingSource } from "./detect.js";
|
|
4
4
|
export interface DuplexStreamFactoryOptions {
|
|
5
5
|
preventCloseReadableStreams?: boolean | undefined;
|
|
6
6
|
close?: (() => void | Promise<void>) | undefined;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* A factory for creating a duplex stream.
|
|
10
|
+
*
|
|
11
|
+
* It can create multiple `ReadableStream`s and `WritableStream`s,
|
|
12
|
+
* when any of them is closed, all other streams will be closed as well.
|
|
13
|
+
*/
|
|
8
14
|
export declare class DuplexStreamFactory<R, W> {
|
|
9
15
|
private readableControllers;
|
|
10
16
|
private pushReadableControllers;
|
|
@@ -15,7 +21,7 @@ export declare class DuplexStreamFactory<R, W> {
|
|
|
15
21
|
private _writableClosed;
|
|
16
22
|
constructor(options?: DuplexStreamFactoryOptions);
|
|
17
23
|
createPushReadable(source: PushReadableStreamSource<R>, strategy?: QueuingStrategy<R>): PushReadableStream<R>;
|
|
18
|
-
createWrapReadable(
|
|
24
|
+
createWrapReadable(wrapper: ReadableStream<R> | WrapReadableStreamStart<R> | ReadableStreamWrapper<R>): WrapReadableStream<R>;
|
|
19
25
|
createReadable(source?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
|
20
26
|
createWritable(sink: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
|
|
21
27
|
closeReadableStreams(): Promise<void>;
|
|
@@ -24,7 +30,7 @@ export declare class DuplexStreamFactory<R, W> {
|
|
|
24
30
|
export declare class DecodeUtf8Stream extends TransformStream<Uint8Array, string> {
|
|
25
31
|
constructor();
|
|
26
32
|
}
|
|
27
|
-
export declare class GatherStringStream extends
|
|
33
|
+
export declare class GatherStringStream extends WritableStream<string> {
|
|
28
34
|
private _result;
|
|
29
35
|
get result(): string;
|
|
30
36
|
constructor();
|
|
@@ -39,31 +45,25 @@ export declare class StructDeserializeStream<T extends Struct<any, any, any, any
|
|
|
39
45
|
export declare class StructSerializeStream<T extends Struct<any, any, any, any>> extends TransformStream<T['TInit'], Uint8Array> {
|
|
40
46
|
constructor(struct: T);
|
|
41
47
|
}
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}>;
|
|
47
|
-
close?(state: S): Promise<void>;
|
|
48
|
+
export declare type WrapWritableStreamStart<T> = () => ValueOrPromise<WritableStream<T>>;
|
|
49
|
+
export interface WritableStreamWrapper<T> {
|
|
50
|
+
start: WrapWritableStreamStart<T>;
|
|
51
|
+
close?(): Promise<void>;
|
|
48
52
|
}
|
|
49
|
-
export declare class WrapWritableStream<T
|
|
50
|
-
writable:
|
|
53
|
+
export declare class WrapWritableStream<T> extends WritableStream<T> {
|
|
54
|
+
writable: WritableStream<T>;
|
|
51
55
|
private writer;
|
|
52
|
-
|
|
53
|
-
constructor(wrapper: WritableStreamWrapper<T, W, S>);
|
|
56
|
+
constructor(wrapper: WritableStream<T> | WrapWritableStreamStart<T> | WritableStreamWrapper<T>);
|
|
54
57
|
}
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}>;
|
|
60
|
-
close?(state: S): Promise<void>;
|
|
58
|
+
export declare type WrapReadableStreamStart<T> = () => ValueOrPromise<ReadableStream<T>>;
|
|
59
|
+
export interface ReadableStreamWrapper<T> {
|
|
60
|
+
start: WrapReadableStreamStart<T>;
|
|
61
|
+
close?(): Promise<void>;
|
|
61
62
|
}
|
|
62
|
-
export declare class WrapReadableStream<T
|
|
63
|
-
readable:
|
|
63
|
+
export declare class WrapReadableStream<T> extends ReadableStream<T> {
|
|
64
|
+
readable: ReadableStream<T>;
|
|
64
65
|
private reader;
|
|
65
|
-
|
|
66
|
-
constructor(wrapper: ReadableStreamWrapper<T, R, S>);
|
|
66
|
+
constructor(wrapper: ReadableStream<T> | WrapReadableStreamStart<T> | ReadableStreamWrapper<T>);
|
|
67
67
|
}
|
|
68
68
|
export declare class ChunkStream extends TransformStream<Uint8Array, Uint8Array> {
|
|
69
69
|
constructor(size: number);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/stream/transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/stream/transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAmB,WA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,GAAG,GAAG,IAAI,CAAC;CACxB;AAED,oBAAY,wBAAwB,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEhG,qBAAa,kBAAkB,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACrC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;CAuCxF"}
|
package/esm/stream/transform.js
CHANGED
|
@@ -2,6 +2,12 @@ import { PromiseResolver } from "@yume-chan/async";
|
|
|
2
2
|
import { decodeUtf8 } from "../utils/index.js";
|
|
3
3
|
import { BufferedStream, BufferedStreamEndedError } from "./buffered.js";
|
|
4
4
|
import { AbortController, ReadableStream, TransformStream, WritableStream } from "./detect.js";
|
|
5
|
+
/**
|
|
6
|
+
* A factory for creating a duplex stream.
|
|
7
|
+
*
|
|
8
|
+
* It can create multiple `ReadableStream`s and `WritableStream`s,
|
|
9
|
+
* when any of them is closed, all other streams will be closed as well.
|
|
10
|
+
*/
|
|
5
11
|
export class DuplexStreamFactory {
|
|
6
12
|
readableControllers = [];
|
|
7
13
|
pushReadableControllers = [];
|
|
@@ -26,6 +32,8 @@ export class DuplexStreamFactory {
|
|
|
26
32
|
await controller.enqueue(chunk);
|
|
27
33
|
},
|
|
28
34
|
close: async () => {
|
|
35
|
+
// The source signals stream ended,
|
|
36
|
+
// usually means the other end closed the connection first.
|
|
29
37
|
controller.close();
|
|
30
38
|
this._closeRequestedByReadable = true;
|
|
31
39
|
await this.close();
|
|
@@ -39,15 +47,15 @@ export class DuplexStreamFactory {
|
|
|
39
47
|
}, strategy);
|
|
40
48
|
}
|
|
41
49
|
;
|
|
42
|
-
createWrapReadable(
|
|
50
|
+
createWrapReadable(wrapper) {
|
|
43
51
|
return new WrapReadableStream({
|
|
44
52
|
async start() {
|
|
45
|
-
return
|
|
46
|
-
readable,
|
|
47
|
-
state: undefined,
|
|
48
|
-
};
|
|
53
|
+
return getWrappedReadableStream(wrapper);
|
|
49
54
|
},
|
|
50
55
|
close: async () => {
|
|
56
|
+
if ('close' in wrapper) {
|
|
57
|
+
await wrapper.close?.();
|
|
58
|
+
}
|
|
51
59
|
this._closeRequestedByReadable = true;
|
|
52
60
|
await this.close();
|
|
53
61
|
},
|
|
@@ -123,19 +131,19 @@ export class DecodeUtf8Stream extends TransformStream {
|
|
|
123
131
|
});
|
|
124
132
|
}
|
|
125
133
|
}
|
|
126
|
-
export class GatherStringStream extends
|
|
134
|
+
export class GatherStringStream extends WritableStream {
|
|
127
135
|
// Optimization: rope (concat strings) is faster than `[].join('')`
|
|
128
136
|
_result = '';
|
|
129
137
|
get result() { return this._result; }
|
|
130
138
|
constructor() {
|
|
131
139
|
super({
|
|
132
|
-
|
|
140
|
+
write: (chunk) => {
|
|
133
141
|
this._result += chunk;
|
|
134
142
|
},
|
|
135
143
|
});
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
|
-
// TODO:
|
|
146
|
+
// TODO: StructTransformStream: Looking for better implementation
|
|
139
147
|
export class StructDeserializeStream {
|
|
140
148
|
_readable;
|
|
141
149
|
get readable() { return this._readable; }
|
|
@@ -182,17 +190,32 @@ export class StructSerializeStream extends TransformStream {
|
|
|
182
190
|
});
|
|
183
191
|
}
|
|
184
192
|
}
|
|
193
|
+
async function getWrappedWritableStream(wrapper) {
|
|
194
|
+
if ('start' in wrapper) {
|
|
195
|
+
return await wrapper.start();
|
|
196
|
+
}
|
|
197
|
+
else if (typeof wrapper === 'function') {
|
|
198
|
+
return await wrapper();
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
// Can't use `wrapper instanceof WritableStream`
|
|
202
|
+
// Because we want to be compatible with any WritableStream-like objects
|
|
203
|
+
return wrapper;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
185
206
|
export class WrapWritableStream extends WritableStream {
|
|
186
207
|
writable;
|
|
187
208
|
writer;
|
|
188
|
-
state;
|
|
189
209
|
constructor(wrapper) {
|
|
190
210
|
super({
|
|
191
211
|
start: async () => {
|
|
192
|
-
|
|
193
|
-
this
|
|
194
|
-
this
|
|
195
|
-
this.
|
|
212
|
+
// `start` is invoked before `ReadableStream`'s constructor finish,
|
|
213
|
+
// so using `this` synchronously causes
|
|
214
|
+
// "Must call super constructor in derived class before accessing 'this' or returning from derived constructor".
|
|
215
|
+
// Queue a microtask to avoid this.
|
|
216
|
+
await Promise.resolve();
|
|
217
|
+
this.writable = await getWrappedWritableStream(wrapper);
|
|
218
|
+
this.writer = this.writable.getWriter();
|
|
196
219
|
},
|
|
197
220
|
write: async (chunk) => {
|
|
198
221
|
// Maintain back pressure
|
|
@@ -201,36 +224,63 @@ export class WrapWritableStream extends WritableStream {
|
|
|
201
224
|
},
|
|
202
225
|
abort: async (reason) => {
|
|
203
226
|
await this.writer.abort(reason);
|
|
204
|
-
wrapper
|
|
227
|
+
if ('close' in wrapper) {
|
|
228
|
+
await wrapper.close?.();
|
|
229
|
+
}
|
|
205
230
|
},
|
|
206
231
|
close: async () => {
|
|
232
|
+
// Close the inner stream first.
|
|
233
|
+
// Usually the inner stream is a logical sub-stream over the outer stream,
|
|
234
|
+
// closing the outer stream first will make the inner stream incapable of
|
|
235
|
+
// sending data in its `close` handler.
|
|
207
236
|
await this.writer.close();
|
|
208
|
-
|
|
237
|
+
if ('close' in wrapper) {
|
|
238
|
+
await wrapper.close?.();
|
|
239
|
+
}
|
|
209
240
|
},
|
|
210
241
|
});
|
|
211
242
|
}
|
|
212
243
|
}
|
|
244
|
+
function getWrappedReadableStream(wrapper) {
|
|
245
|
+
if ('start' in wrapper) {
|
|
246
|
+
return wrapper.start();
|
|
247
|
+
}
|
|
248
|
+
else if (typeof wrapper === 'function') {
|
|
249
|
+
return wrapper();
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// Can't use `wrapper instanceof ReadableStream`
|
|
253
|
+
// Because we want to be compatible with any ReadableStream-like objects
|
|
254
|
+
return wrapper;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
213
257
|
export class WrapReadableStream extends ReadableStream {
|
|
214
258
|
readable;
|
|
215
259
|
reader;
|
|
216
|
-
state;
|
|
217
260
|
constructor(wrapper) {
|
|
218
261
|
super({
|
|
219
262
|
start: async () => {
|
|
220
|
-
|
|
221
|
-
this
|
|
222
|
-
this
|
|
223
|
-
this.
|
|
263
|
+
// `start` is invoked before `ReadableStream`'s constructor finish,
|
|
264
|
+
// so using `this` synchronously causes
|
|
265
|
+
// "Must call super constructor in derived class before accessing 'this' or returning from derived constructor".
|
|
266
|
+
// Queue a microtask to avoid this.
|
|
267
|
+
await Promise.resolve();
|
|
268
|
+
this.readable = await getWrappedReadableStream(wrapper);
|
|
269
|
+
this.reader = this.readable.getReader();
|
|
224
270
|
},
|
|
225
271
|
cancel: async (reason) => {
|
|
226
272
|
await this.reader.cancel(reason);
|
|
227
|
-
wrapper
|
|
273
|
+
if ('close' in wrapper) {
|
|
274
|
+
await wrapper.close?.();
|
|
275
|
+
}
|
|
228
276
|
},
|
|
229
277
|
pull: async (controller) => {
|
|
230
278
|
const result = await this.reader.read();
|
|
231
279
|
if (result.done) {
|
|
232
|
-
wrapper.close?.(this.state);
|
|
233
280
|
controller.close();
|
|
281
|
+
if ('close' in wrapper) {
|
|
282
|
+
await wrapper.close?.();
|
|
283
|
+
}
|
|
234
284
|
}
|
|
235
285
|
else {
|
|
236
286
|
controller.enqueue(result.value);
|
|
@@ -319,7 +369,7 @@ export class PushReadableStream extends ReadableStream {
|
|
|
319
369
|
source({
|
|
320
370
|
abortSignal: canceled.signal,
|
|
321
371
|
async enqueue(chunk) {
|
|
322
|
-
// Only when the stream
|
|
372
|
+
// Only when the stream is errored, `desiredSize` will be `null`.
|
|
323
373
|
// But since `null <= 0` is `true`
|
|
324
374
|
// (`null <= 0` is evaluated as `!(null > 0)` => `!false` => `true`),
|
|
325
375
|
// not handling it will cause a deadlock.
|
|
@@ -343,8 +393,8 @@ export class PushReadableStream extends ReadableStream {
|
|
|
343
393
|
waterMarkLow?.resolve();
|
|
344
394
|
},
|
|
345
395
|
cancel: async (reason) => {
|
|
346
|
-
waterMarkLow?.reject(reason);
|
|
347
396
|
canceled.abort();
|
|
397
|
+
waterMarkLow?.reject(reason);
|
|
348
398
|
},
|
|
349
399
|
}, strategy);
|
|
350
400
|
}
|