@yume-chan/adb 0.0.17 → 0.0.19

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.
Files changed (177) hide show
  1. package/CHANGELOG.json +27 -0
  2. package/CHANGELOG.md +16 -1
  3. package/LICENSE +1 -1
  4. package/esm/adb.d.ts +63 -60
  5. package/esm/adb.d.ts.map +1 -1
  6. package/esm/adb.js +257 -229
  7. package/esm/adb.js.map +1 -1
  8. package/esm/auth.d.ts +51 -51
  9. package/esm/auth.d.ts.map +1 -1
  10. package/esm/auth.js +95 -96
  11. package/esm/auth.js.map +1 -1
  12. package/esm/backend.d.ts +8 -8
  13. package/esm/backend.d.ts.map +1 -1
  14. package/esm/backend.js +1 -1
  15. package/esm/commands/base.d.ts +6 -6
  16. package/esm/commands/base.js +8 -8
  17. package/esm/commands/framebuffer.d.ts +53 -53
  18. package/esm/commands/framebuffer.d.ts.map +1 -1
  19. package/esm/commands/framebuffer.js +46 -47
  20. package/esm/commands/framebuffer.js.map +1 -1
  21. package/esm/commands/index.d.ts +7 -8
  22. package/esm/commands/index.d.ts.map +1 -1
  23. package/esm/commands/index.js +7 -8
  24. package/esm/commands/index.js.map +1 -1
  25. package/esm/commands/install.d.ts +9 -3
  26. package/esm/commands/install.d.ts.map +1 -1
  27. package/esm/commands/install.js +27 -21
  28. package/esm/commands/install.js.map +1 -1
  29. package/esm/commands/power.d.ts +22 -22
  30. package/esm/commands/power.d.ts.map +1 -1
  31. package/esm/commands/power.js +48 -44
  32. package/esm/commands/power.js.map +1 -1
  33. package/esm/commands/reverse.d.ts +41 -28
  34. package/esm/commands/reverse.d.ts.map +1 -1
  35. package/esm/commands/reverse.js +125 -98
  36. package/esm/commands/reverse.js.map +1 -1
  37. package/esm/commands/subprocess/command.d.ts +57 -51
  38. package/esm/commands/subprocess/command.d.ts.map +1 -1
  39. package/esm/commands/subprocess/command.js +86 -82
  40. package/esm/commands/subprocess/command.js.map +1 -1
  41. package/esm/commands/subprocess/index.d.ts +3 -3
  42. package/esm/commands/subprocess/index.js +3 -3
  43. package/esm/commands/subprocess/protocols/index.d.ts +3 -3
  44. package/esm/commands/subprocess/protocols/index.js +3 -3
  45. package/esm/commands/subprocess/protocols/none.d.ts +35 -35
  46. package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
  47. package/esm/commands/subprocess/protocols/none.js +65 -55
  48. package/esm/commands/subprocess/protocols/none.js.map +1 -1
  49. package/esm/commands/subprocess/protocols/shell.d.ts +39 -38
  50. package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
  51. package/esm/commands/subprocess/protocols/shell.js +166 -154
  52. package/esm/commands/subprocess/protocols/shell.js.map +1 -1
  53. package/esm/commands/subprocess/protocols/types.d.ts +49 -49
  54. package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
  55. package/esm/commands/subprocess/protocols/types.js +1 -1
  56. package/esm/commands/subprocess/utils.d.ts +1 -1
  57. package/esm/commands/subprocess/utils.js +18 -18
  58. package/esm/commands/sync/index.d.ts +8 -7
  59. package/esm/commands/sync/index.d.ts.map +1 -1
  60. package/esm/commands/sync/index.js +8 -7
  61. package/esm/commands/sync/index.js.map +1 -1
  62. package/esm/commands/sync/list.d.ts +42 -40
  63. package/esm/commands/sync/list.d.ts.map +1 -1
  64. package/esm/commands/sync/list.js +67 -35
  65. package/esm/commands/sync/list.js.map +1 -1
  66. package/esm/commands/sync/pull.d.ts +13 -11
  67. package/esm/commands/sync/pull.d.ts.map +1 -1
  68. package/esm/commands/sync/pull.js +35 -36
  69. package/esm/commands/sync/pull.js.map +1 -1
  70. package/esm/commands/sync/push.d.ts +46 -7
  71. package/esm/commands/sync/push.d.ts.map +1 -1
  72. package/esm/commands/sync/push.js +89 -23
  73. package/esm/commands/sync/push.js.map +1 -1
  74. package/esm/commands/sync/request.d.ts +26 -23
  75. package/esm/commands/sync/request.d.ts.map +1 -1
  76. package/esm/commands/sync/request.js +40 -42
  77. package/esm/commands/sync/request.js.map +1 -1
  78. package/esm/commands/sync/response.d.ts +19 -19
  79. package/esm/commands/sync/response.d.ts.map +1 -1
  80. package/esm/commands/sync/response.js +54 -54
  81. package/esm/commands/sync/response.js.map +1 -1
  82. package/esm/commands/sync/socket.d.ts +27 -0
  83. package/esm/commands/sync/socket.d.ts.map +1 -0
  84. package/esm/commands/sync/socket.js +66 -0
  85. package/esm/commands/sync/socket.js.map +1 -0
  86. package/esm/commands/sync/stat.d.ts +72 -72
  87. package/esm/commands/sync/stat.d.ts.map +1 -1
  88. package/esm/commands/sync/stat.js +116 -94
  89. package/esm/commands/sync/stat.js.map +1 -1
  90. package/esm/commands/sync/sync.d.ts +72 -60
  91. package/esm/commands/sync/sync.d.ts.map +1 -1
  92. package/esm/commands/sync/sync.js +127 -148
  93. package/esm/commands/sync/sync.js.map +1 -1
  94. package/esm/commands/tcpip.d.ts +5 -5
  95. package/esm/commands/tcpip.js +18 -18
  96. package/esm/crypto.d.ts +36 -36
  97. package/esm/crypto.d.ts.map +1 -1
  98. package/esm/crypto.js +248 -238
  99. package/esm/crypto.js.map +1 -1
  100. package/esm/features.d.ts +10 -7
  101. package/esm/features.d.ts.map +1 -1
  102. package/esm/features.js +13 -10
  103. package/esm/features.js.map +1 -1
  104. package/esm/index.d.ts +9 -9
  105. package/esm/index.d.ts.map +1 -1
  106. package/esm/index.js +9 -9
  107. package/esm/index.js.map +1 -1
  108. package/esm/packet.d.ts +45 -46
  109. package/esm/packet.d.ts.map +1 -1
  110. package/esm/packet.js +43 -46
  111. package/esm/packet.js.map +1 -1
  112. package/esm/socket/dispatcher.d.ts +59 -59
  113. package/esm/socket/dispatcher.d.ts.map +1 -1
  114. package/esm/socket/dispatcher.js +223 -231
  115. package/esm/socket/dispatcher.js.map +1 -1
  116. package/esm/socket/index.d.ts +2 -2
  117. package/esm/socket/index.js +2 -2
  118. package/esm/socket/socket.d.ts +59 -59
  119. package/esm/socket/socket.d.ts.map +1 -1
  120. package/esm/socket/socket.js +118 -98
  121. package/esm/socket/socket.js.map +1 -1
  122. package/esm/utils/auto-reset-event.d.ts +9 -9
  123. package/esm/utils/auto-reset-event.d.ts.map +1 -1
  124. package/esm/utils/auto-reset-event.js +33 -33
  125. package/esm/utils/auto-reset-event.js.map +1 -1
  126. package/esm/utils/base64.d.ts +27 -27
  127. package/esm/utils/base64.d.ts.map +1 -1
  128. package/esm/utils/base64.js +246 -245
  129. package/esm/utils/base64.js.map +1 -1
  130. package/esm/utils/conditional-variable.d.ts +9 -0
  131. package/esm/utils/conditional-variable.d.ts.map +1 -0
  132. package/esm/utils/conditional-variable.js +34 -0
  133. package/esm/utils/conditional-variable.js.map +1 -0
  134. package/esm/utils/index.d.ts +4 -3
  135. package/esm/utils/index.d.ts.map +1 -1
  136. package/esm/utils/index.js +4 -3
  137. package/esm/utils/index.js.map +1 -1
  138. package/package.json +17 -13
  139. package/src/adb.ts +160 -101
  140. package/src/auth.ts +31 -22
  141. package/src/backend.ts +6 -4
  142. package/src/commands/base.ts +2 -2
  143. package/src/commands/framebuffer.ts +37 -41
  144. package/src/commands/index.ts +7 -8
  145. package/src/commands/power.ts +15 -11
  146. package/src/commands/reverse.ts +74 -30
  147. package/src/commands/subprocess/command.ts +34 -23
  148. package/src/commands/subprocess/index.ts +3 -3
  149. package/src/commands/subprocess/protocols/index.ts +3 -3
  150. package/src/commands/subprocess/protocols/none.ts +26 -11
  151. package/src/commands/subprocess/protocols/shell.ts +110 -56
  152. package/src/commands/subprocess/protocols/types.ts +10 -6
  153. package/src/commands/subprocess/utils.ts +1 -1
  154. package/src/commands/sync/index.ts +8 -7
  155. package/src/commands/sync/list.ts +74 -28
  156. package/src/commands/sync/pull.ts +49 -37
  157. package/src/commands/sync/push.ts +153 -32
  158. package/src/commands/sync/request.ts +37 -34
  159. package/src/commands/sync/response.ts +34 -27
  160. package/src/commands/sync/socket.ts +97 -0
  161. package/src/commands/sync/stat.ts +98 -70
  162. package/src/commands/sync/sync.ts +78 -97
  163. package/src/commands/tcpip.ts +5 -5
  164. package/src/crypto.ts +60 -32
  165. package/src/features.ts +9 -6
  166. package/src/index.ts +9 -10
  167. package/src/packet.ts +41 -46
  168. package/src/socket/dispatcher.ts +130 -108
  169. package/src/socket/index.ts +2 -2
  170. package/src/socket/socket.ts +84 -34
  171. package/src/utils/auto-reset-event.ts +16 -17
  172. package/src/utils/base64.ts +51 -41
  173. package/src/utils/conditional-variable.ts +45 -0
  174. package/src/utils/index.ts +4 -3
  175. package/tsconfig.build.json +1 -1
  176. package/tsconfig.build.tsbuildinfo +1 -1
  177. package/src/commands/install.ts +0 -32
@@ -1,155 +1,167 @@
1
- import { PromiseResolver } from '@yume-chan/async';
2
- import { pipeFrom, PushReadableStream, StructDeserializeStream, StructSerializeStream, TransformStream, WritableStream } from '@yume-chan/stream-extra';
3
- import Struct, { placeholder } from '@yume-chan/struct';
4
- import { AdbFeatures } from '../../../features.js';
5
- import { encodeUtf8 } from '../../../utils/index.js';
6
- export var AdbShellProtocolId;
7
- (function (AdbShellProtocolId) {
8
- AdbShellProtocolId[AdbShellProtocolId["Stdin"] = 0] = "Stdin";
9
- AdbShellProtocolId[AdbShellProtocolId["Stdout"] = 1] = "Stdout";
10
- AdbShellProtocolId[AdbShellProtocolId["Stderr"] = 2] = "Stderr";
11
- AdbShellProtocolId[AdbShellProtocolId["Exit"] = 3] = "Exit";
12
- AdbShellProtocolId[AdbShellProtocolId["CloseStdin"] = 4] = "CloseStdin";
13
- AdbShellProtocolId[AdbShellProtocolId["WindowSizeChange"] = 5] = "WindowSizeChange";
14
- })(AdbShellProtocolId = AdbShellProtocolId || (AdbShellProtocolId = {}));
15
- // This packet format is used in both direction.
16
- const AdbShellProtocolPacket = new Struct({ littleEndian: true })
17
- .uint8('id', placeholder())
18
- .uint32('length')
19
- .uint8Array('data', { lengthField: 'length' });
20
- class StdinSerializeStream extends TransformStream {
21
- constructor() {
22
- super({
23
- transform(chunk, controller) {
24
- controller.enqueue({
25
- id: AdbShellProtocolId.Stdin,
26
- data: chunk,
27
- });
28
- },
29
- flush() {
30
- // TODO: AdbShellSubprocessProtocol: support closing stdin
31
- }
32
- });
33
- }
34
- }
35
- class StdoutDeserializeStream extends TransformStream {
36
- constructor(type) {
37
- super({
38
- transform(chunk, controller) {
39
- if (chunk.id === type) {
40
- controller.enqueue(chunk.data);
41
- }
42
- },
43
- });
44
- }
45
- }
46
- class MultiplexStream {
47
- _readable;
48
- _readableController;
49
- get readable() { return this._readable; }
50
- _activeCount = 0;
51
- constructor() {
52
- this._readable = new PushReadableStream(controller => {
53
- this._readableController = controller;
54
- });
55
- }
56
- createWriteable() {
57
- return new WritableStream({
58
- start: () => {
59
- this._activeCount += 1;
60
- },
61
- write: async (chunk) => {
62
- await this._readableController.enqueue(chunk);
63
- },
64
- abort: async (e) => {
65
- this._activeCount -= 1;
66
- if (this._activeCount === 0) {
67
- this._readableController.close();
68
- }
69
- },
70
- close: async () => {
71
- this._activeCount -= 1;
72
- if (this._activeCount === 0) {
73
- this._readableController.close();
74
- }
75
- },
76
- });
77
- }
78
- }
79
- /**
80
- * Shell v2 a.k.a Shell Protocol
81
- *
82
- * Features:
83
- * * `stderr`: Yes
84
- * * `exit` exit code: Yes
85
- * * `resize`: Yes
86
- */
87
- export class AdbSubprocessShellProtocol {
88
- static isSupported(adb) {
89
- return adb.features.includes(AdbFeatures.ShellV2);
90
- }
91
- static async pty(adb, command) {
92
- // TODO: AdbShellSubprocessProtocol: Support setting `XTERM` environment variable
93
- return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,pty:${command}`));
94
- }
95
- static async raw(adb, command) {
96
- return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,raw:${command}`));
97
- }
98
- _socket;
99
- _socketWriter;
100
- _stdin;
101
- get stdin() { return this._stdin; }
102
- _stdout;
103
- get stdout() { return this._stdout; }
104
- _stderr;
105
- get stderr() { return this._stderr; }
106
- _exit = new PromiseResolver();
107
- get exit() { return this._exit.promise; }
108
- constructor(socket) {
109
- this._socket = socket;
110
- // Check this image to help you understand the stream graph
111
- // cspell: disable-next-line
112
- // https://www.plantuml.com/plantuml/png/bL91QiCm4Bpx5SAdv90lb1JISmiw5XzaQKf5PIkiLZIqzEyLSg8ks13gYtOykpFhiOw93N6UGjVDqK7rZsxKqNw0U_NTgVAy4empOy2mm4_olC0VEVEE47GUpnGjKdgXoD76q4GIEpyFhOwP_m28hW0NNzxNUig1_JdW0bA7muFIJDco1daJ_1SAX9bgvoPJPyIkSekhNYctvIGXrCH6tIsPL5fs-s6J5yc9BpWXhKtNdF2LgVYPGM_6GlMwfhWUsIt4lbScANrwlgVVUifPSVi__t44qStnwPvZwobdSmHHlL57p2vFuHS0
113
- // TODO: AdbShellSubprocessProtocol: Optimize stream graph
114
- const [stdout, stderr] = socket.readable
115
- .pipeThrough(new StructDeserializeStream(AdbShellProtocolPacket))
116
- .pipeThrough(new TransformStream({
117
- transform: (chunk, controller) => {
118
- if (chunk.id === AdbShellProtocolId.Exit) {
119
- this._exit.resolve(new Uint8Array(chunk.data)[0]);
120
- // We can let `StdoutDeserializeStream` to process `AdbShellProtocolId.Exit`,
121
- // but since we need this `TransformStream` to capture the exit code anyway,
122
- // terminating child streams here is killing two birds with one stone.
123
- controller.terminate();
124
- return;
125
- }
126
- controller.enqueue(chunk);
127
- }
128
- }))
129
- .tee();
130
- this._stdout = stdout
131
- .pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stdout));
132
- this._stderr = stderr
133
- .pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stderr));
134
- const multiplexer = new MultiplexStream();
135
- multiplexer.readable
136
- .pipeThrough(new StructSerializeStream(AdbShellProtocolPacket))
137
- .pipeTo(socket.writable);
138
- this._stdin = pipeFrom(multiplexer.createWriteable(), new StdinSerializeStream());
139
- this._socketWriter = multiplexer.createWriteable().getWriter();
140
- }
141
- async resize(rows, cols) {
142
- await this._socketWriter.write({
143
- id: AdbShellProtocolId.WindowSizeChange,
144
- data: encodeUtf8(
145
- // The "correct" format is `${rows}x${cols},${x_pixels}x${y_pixels}`
146
- // However, according to https://linux.die.net/man/4/tty_ioctl
147
- // `x_pixels` and `y_pixels` are unused, so always sending `0` should be fine.
148
- `${rows}x${cols},0x0\0`),
149
- });
150
- }
151
- kill() {
152
- return this._socket.close();
153
- }
154
- }
1
+ import { PromiseResolver } from "@yume-chan/async";
2
+ import { ConsumableTransformStream, ConsumableWritableStream, PushReadableStream, StructDeserializeStream, TransformStream, WritableStream, pipeFrom, } from "@yume-chan/stream-extra";
3
+ import Struct, { placeholder } from "@yume-chan/struct";
4
+ import { AdbFeature } from "../../../features.js";
5
+ import { encodeUtf8 } from "../../../utils/index.js";
6
+ export var AdbShellProtocolId;
7
+ (function (AdbShellProtocolId) {
8
+ AdbShellProtocolId[AdbShellProtocolId["Stdin"] = 0] = "Stdin";
9
+ AdbShellProtocolId[AdbShellProtocolId["Stdout"] = 1] = "Stdout";
10
+ AdbShellProtocolId[AdbShellProtocolId["Stderr"] = 2] = "Stderr";
11
+ AdbShellProtocolId[AdbShellProtocolId["Exit"] = 3] = "Exit";
12
+ AdbShellProtocolId[AdbShellProtocolId["CloseStdin"] = 4] = "CloseStdin";
13
+ AdbShellProtocolId[AdbShellProtocolId["WindowSizeChange"] = 5] = "WindowSizeChange";
14
+ })(AdbShellProtocolId = AdbShellProtocolId || (AdbShellProtocolId = {}));
15
+ // This packet format is used in both direction.
16
+ const AdbShellProtocolPacket = new Struct({ littleEndian: true })
17
+ .uint8("id", placeholder())
18
+ .uint32("length")
19
+ .uint8Array("data", { lengthField: "length" });
20
+ class StdinSerializeStream extends ConsumableTransformStream {
21
+ constructor() {
22
+ super({
23
+ async transform(chunk, controller) {
24
+ await controller.enqueue({
25
+ id: AdbShellProtocolId.Stdin,
26
+ data: chunk,
27
+ });
28
+ },
29
+ flush() {
30
+ // TODO: AdbShellSubprocessProtocol: support closing stdin
31
+ },
32
+ });
33
+ }
34
+ }
35
+ class StdoutDeserializeStream extends TransformStream {
36
+ constructor(type) {
37
+ super({
38
+ transform(chunk, controller) {
39
+ if (chunk.id === type) {
40
+ controller.enqueue(chunk.data);
41
+ }
42
+ },
43
+ });
44
+ }
45
+ }
46
+ class MultiplexStream {
47
+ _readable;
48
+ _readableController;
49
+ get readable() {
50
+ return this._readable;
51
+ }
52
+ _activeCount = 0;
53
+ constructor() {
54
+ this._readable = new PushReadableStream((controller) => {
55
+ this._readableController = controller;
56
+ });
57
+ }
58
+ createWriteable() {
59
+ return new WritableStream({
60
+ start: () => {
61
+ this._activeCount += 1;
62
+ },
63
+ write: async (chunk) => {
64
+ await this._readableController.enqueue(chunk);
65
+ },
66
+ abort: () => {
67
+ this._activeCount -= 1;
68
+ if (this._activeCount === 0) {
69
+ this._readableController.close();
70
+ }
71
+ },
72
+ close: () => {
73
+ this._activeCount -= 1;
74
+ if (this._activeCount === 0) {
75
+ this._readableController.close();
76
+ }
77
+ },
78
+ });
79
+ }
80
+ }
81
+ /**
82
+ * Shell v2 a.k.a Shell Protocol
83
+ *
84
+ * Features:
85
+ * * `stderr`: Yes
86
+ * * `exit` exit code: Yes
87
+ * * `resize`: Yes
88
+ */
89
+ export class AdbSubprocessShellProtocol {
90
+ static isSupported(adb) {
91
+ return adb.supportsFeature(AdbFeature.ShellV2);
92
+ }
93
+ static async pty(adb, command) {
94
+ // TODO: AdbShellSubprocessProtocol: Support setting `XTERM` environment variable
95
+ return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,pty:${command}`));
96
+ }
97
+ static async raw(adb, command) {
98
+ return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,raw:${command}`));
99
+ }
100
+ _socket;
101
+ _socketWriter;
102
+ _stdin;
103
+ get stdin() {
104
+ return this._stdin;
105
+ }
106
+ _stdout;
107
+ get stdout() {
108
+ return this._stdout;
109
+ }
110
+ _stderr;
111
+ get stderr() {
112
+ return this._stderr;
113
+ }
114
+ _exit = new PromiseResolver();
115
+ get exit() {
116
+ return this._exit.promise;
117
+ }
118
+ constructor(socket) {
119
+ this._socket = socket;
120
+ // Check this image to help you understand the stream graph
121
+ // cspell: disable-next-line
122
+ // https://www.plantuml.com/plantuml/png/bL91QiCm4Bpx5SAdv90lb1JISmiw5XzaQKf5PIkiLZIqzEyLSg8ks13gYtOykpFhiOw93N6UGjVDqK7rZsxKqNw0U_NTgVAy4empOy2mm4_olC0VEVEE47GUpnGjKdgXoD76q4GIEpyFhOwP_m28hW0NNzxNUig1_JdW0bA7muFIJDco1daJ_1SAX9bgvoPJPyIkSekhNYctvIGXrCH6tIsPL5fs-s6J5yc9BpWXhKtNdF2LgVYPGM_6GlMwfhWUsIt4lbScANrwlgVVUifPSVi__t44qStnwPvZwobdSmHHlL57p2vFuHS0
123
+ // TODO: AdbShellSubprocessProtocol: Optimize stream graph
124
+ const [stdout, stderr] = socket.readable
125
+ .pipeThrough(new StructDeserializeStream(AdbShellProtocolPacket))
126
+ .pipeThrough(new TransformStream({
127
+ transform: (chunk, controller) => {
128
+ if (chunk.id === AdbShellProtocolId.Exit) {
129
+ this._exit.resolve(new Uint8Array(chunk.data)[0]);
130
+ // We can let `StdoutDeserializeStream` to process `AdbShellProtocolId.Exit`,
131
+ // but since we need this `TransformStream` to capture the exit code anyway,
132
+ // terminating child streams here is killing two birds with one stone.
133
+ controller.terminate();
134
+ return;
135
+ }
136
+ controller.enqueue(chunk);
137
+ },
138
+ }))
139
+ .tee();
140
+ this._stdout = stdout.pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stdout));
141
+ this._stderr = stderr.pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stderr));
142
+ const multiplexer = new MultiplexStream();
143
+ void multiplexer.readable
144
+ .pipeThrough(new ConsumableTransformStream({
145
+ async transform(chunk, controller) {
146
+ await controller.enqueue(AdbShellProtocolPacket.serialize(chunk));
147
+ },
148
+ }))
149
+ .pipeTo(socket.writable);
150
+ this._stdin = pipeFrom(multiplexer.createWriteable(), new StdinSerializeStream());
151
+ this._socketWriter = multiplexer.createWriteable().getWriter();
152
+ }
153
+ async resize(rows, cols) {
154
+ await ConsumableWritableStream.write(this._socketWriter, {
155
+ id: AdbShellProtocolId.WindowSizeChange,
156
+ data: encodeUtf8(
157
+ // The "correct" format is `${rows}x${cols},${x_pixels}x${y_pixels}`
158
+ // However, according to https://linux.die.net/man/4/tty_ioctl
159
+ // `x_pixels` and `y_pixels` are unused, so always sending `0` should be fine.
160
+ `${rows}x${cols},0x0\0`),
161
+ });
162
+ }
163
+ kill() {
164
+ return this._socket.close();
165
+ }
166
+ }
155
167
  //# sourceMappingURL=shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAA4F,MAAM,yBAAyB,CAAC;AAClP,OAAO,MAAM,EAAE,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC1B,6DAAK,CAAA;IACL,+DAAM,CAAA;IACN,+DAAM,CAAA;IACN,2DAAI,CAAA;IACJ,uEAAU,CAAA;IACV,mFAAgB,CAAA;AACpB,CAAC,EAPW,kBAAkB,GAAlB,kBAAkB,KAAlB,kBAAkB,QAO7B;AAED,gDAAgD;AAChD,MAAM,sBAAsB,GACxB,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAC7B,KAAK,CAAC,IAAI,EAAE,WAAW,EAAsB,CAAC;KAC9C,MAAM,CAAC,QAAQ,CAAC;KAChB,UAAU,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,QAAQ,E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C,CACzD,CAAC;QAEF,MAAM,WAAW,GAAG,IAAI,eAAe,EAEpC,CAAC;QACJ,KAAK,WAAW,CAAC,QAAQ;aACpB,WAAW,CACR,IAAI,yBAAyB,CAAC;YAC1B,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU;gBAC7B,MAAM,UAAU,CAAC,OAAO,CACpB,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAC1C,CAAC;YACN,CAAC;SACJ,CAAC,CACL;aACA,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE7B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAClB,WAAW,CAAC,eAAe,EAAE,EAC7B,IAAI,oBAAoB,EAAE,CAC7B,CAAC;QAEF,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC,SAAS,EAAE,CAAC;IACnE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,IAAY;QAC1C,MAAM,wBAAwB,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE;YACrD,EAAE,EAAE,kBAAkB,CAAC,gBAAgB;YACvC,IAAI,EAAE,UAAU;YACZ,oEAAoE;YACpE,8DAA8D;YAC9D,8EAA8E;YAC9E,GAAG,IAAI,IAAI,IAAI,QAAQ,CAC1B;SACJ,CAAC,CAAC;IACP,CAAC;IAEM,IAAI;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACJ"}
@@ -1,50 +1,50 @@
1
- import type { ReadableStream, WritableStream } from '@yume-chan/stream-extra';
2
- import type { ValueOrPromise } from '@yume-chan/struct';
3
- import type { Adb } from '../../../adb.js';
4
- import type { AdbSocket } from '../../../socket/index.js';
5
- export interface AdbSubprocessProtocol {
6
- /**
7
- * A WritableStream that writes to the `stdin` stream.
8
- */
9
- readonly stdin: WritableStream<Uint8Array>;
10
- /**
11
- * The `stdout` stream of the process.
12
- */
13
- readonly stdout: ReadableStream<Uint8Array>;
14
- /**
15
- * The `stderr` stream of the process.
16
- *
17
- * Note: Some `AdbSubprocessProtocol` doesn't separate `stdout` and `stderr`,
18
- * All output will be sent to `stdout`.
19
- */
20
- readonly stderr: ReadableStream<Uint8Array>;
21
- /**
22
- * A `Promise` that resolves to the exit code of the process.
23
- *
24
- * Note: Some `AdbSubprocessProtocol` doesn't support exit code,
25
- * They will always resolve it with `0`.
26
- */
27
- readonly exit: Promise<number>;
28
- /**
29
- * Resizes the current shell.
30
- *
31
- * Some `AdbSubprocessProtocol`s may not support resizing
32
- * and will ignore calls to this method.
33
- */
34
- resize(rows: number, cols: number): ValueOrPromise<void>;
35
- /**
36
- * Kills the current process.
37
- */
38
- kill(): ValueOrPromise<void>;
39
- }
40
- export interface AdbSubprocessProtocolConstructor {
41
- /** Returns `true` if the `adb` instance supports this shell */
42
- isSupported(adb: Adb): ValueOrPromise<boolean>;
43
- /** Spawns an executable in PTY (interactive) mode. */
44
- pty(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
45
- /** Spawns an executable and pipe the output. */
46
- raw(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
47
- /** Creates a new `AdbShell` by attaching to an exist `AdbSocket` */
48
- new (socket: AdbSocket): AdbSubprocessProtocol;
49
- }
1
+ import type { Consumable, ReadableStream, WritableStream } from "@yume-chan/stream-extra";
2
+ import type { ValueOrPromise } from "@yume-chan/struct";
3
+ import type { Adb } from "../../../adb.js";
4
+ import type { AdbSocket } from "../../../socket/index.js";
5
+ export interface AdbSubprocessProtocol {
6
+ /**
7
+ * A WritableStream that writes to the `stdin` stream.
8
+ */
9
+ readonly stdin: WritableStream<Consumable<Uint8Array>>;
10
+ /**
11
+ * The `stdout` stream of the process.
12
+ */
13
+ readonly stdout: ReadableStream<Uint8Array>;
14
+ /**
15
+ * The `stderr` stream of the process.
16
+ *
17
+ * Note: Some `AdbSubprocessProtocol` doesn't separate `stdout` and `stderr`,
18
+ * All output will be sent to `stdout`.
19
+ */
20
+ readonly stderr: ReadableStream<Uint8Array>;
21
+ /**
22
+ * A `Promise` that resolves to the exit code of the process.
23
+ *
24
+ * Note: Some `AdbSubprocessProtocol` doesn't support exit code,
25
+ * They will always resolve it with `0`.
26
+ */
27
+ readonly exit: Promise<number>;
28
+ /**
29
+ * Resizes the current shell.
30
+ *
31
+ * Some `AdbSubprocessProtocol`s may not support resizing
32
+ * and will ignore calls to this method.
33
+ */
34
+ resize(rows: number, cols: number): ValueOrPromise<void>;
35
+ /**
36
+ * Kills the current process.
37
+ */
38
+ kill(): ValueOrPromise<void>;
39
+ }
40
+ export interface AdbSubprocessProtocolConstructor {
41
+ /** Returns `true` if the `adb` instance supports this shell */
42
+ isSupported(adb: Adb): ValueOrPromise<boolean>;
43
+ /** Spawns an executable in PTY (interactive) mode. */
44
+ pty(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
45
+ /** Spawns an executable and pipe the output. */
46
+ raw(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
47
+ /** Creates a new `AdbShell` by attaching to an exist `AdbSocket` */
48
+ new (socket: AdbSocket): AdbSubprocessProtocol;
49
+ }
50
50
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE3C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,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C;IAEvD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,IAAI,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,gCAAgC;IAC7C,+DAA+D;IAC/D,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/C,sDAAsD;IACtD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,gDAAgD;IAChD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,oEAAoE;IACpE,KAAK,MAAM,EAAE,SAAS,GAAG,qBAAqB,CAAC;CAClD"}
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
@@ -1,2 +1,2 @@
1
- export declare function escapeArg(s: string): string;
1
+ export declare function escapeArg(s: string): string;
2
2
  //# sourceMappingURL=utils.d.ts.map
@@ -1,19 +1,19 @@
1
- export function escapeArg(s) {
2
- let result = '';
3
- result += `'`;
4
- let base = 0;
5
- while (true) {
6
- const found = s.indexOf(`'`, base);
7
- if (found === -1) {
8
- result += s.substring(base);
9
- break;
10
- }
11
- result += s.substring(base, found);
12
- // a'b becomes a'\'b
13
- result += String.raw `'\''`;
14
- base = found + 1;
15
- }
16
- result += `'`;
17
- return result;
18
- }
1
+ export function escapeArg(s) {
2
+ let result = "";
3
+ result += `'`;
4
+ let base = 0;
5
+ while (true) {
6
+ const found = s.indexOf(`'`, base);
7
+ if (found === -1) {
8
+ result += s.substring(base);
9
+ break;
10
+ }
11
+ result += s.substring(base, found);
12
+ // a'b becomes a'\'b
13
+ result += String.raw `'\''`;
14
+ base = found + 1;
15
+ }
16
+ result += `'`;
17
+ return result;
18
+ }
19
19
  //# sourceMappingURL=utils.js.map
@@ -1,8 +1,9 @@
1
- export * from './list.js';
2
- export * from './pull.js';
3
- export * from './push.js';
4
- export * from './request.js';
5
- export * from './response.js';
6
- export * from './stat.js';
7
- export * from './sync.js';
1
+ export * from "./list.js";
2
+ export * from "./pull.js";
3
+ export * from "./push.js";
4
+ export * from "./request.js";
5
+ export * from "./response.js";
6
+ export * from "./socket.js";
7
+ export * from "./stat.js";
8
+ export * from "./sync.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
@@ -1,8 +1,9 @@
1
- export * from './list.js';
2
- export * from './pull.js';
3
- export * from './push.js';
4
- export * from './request.js';
5
- export * from './response.js';
6
- export * from './stat.js';
7
- export * from './sync.js';
1
+ export * from "./list.js";
2
+ export * from "./pull.js";
3
+ export * from "./push.js";
4
+ export * from "./request.js";
5
+ export * from "./response.js";
6
+ export * from "./socket.js";
7
+ export * from "./stat.js";
8
+ export * from "./sync.js";
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}