@yume-chan/adb 2.6.0 → 3.0.0-beta.0
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/LICENSE +1 -1
- package/README.md +1 -1
- package/esm/adb.d.ts +18 -15
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +18 -11
- package/esm/adb.js.map +1 -1
- package/esm/banner.d.ts +1 -1
- package/esm/banner.d.ts.map +1 -1
- package/esm/daemon/auth/authenticator.d.ts +28 -0
- package/esm/daemon/auth/authenticator.d.ts.map +1 -0
- package/esm/daemon/auth/authenticator.js +108 -0
- package/esm/daemon/auth/authenticator.js.map +1 -0
- package/esm/daemon/auth/index.d.ts +5 -0
- package/esm/daemon/auth/index.d.ts.map +1 -0
- package/esm/daemon/auth/index.js +5 -0
- package/esm/daemon/auth/index.js.map +1 -0
- package/esm/daemon/auth/packet-processor.d.ts +42 -0
- package/esm/daemon/auth/packet-processor.d.ts.map +1 -0
- package/esm/daemon/auth/packet-processor.js +129 -0
- package/esm/daemon/auth/packet-processor.js.map +1 -0
- package/esm/daemon/auth/public-key.d.ts +8 -0
- package/esm/daemon/auth/public-key.d.ts.map +1 -0
- package/esm/daemon/auth/public-key.js +74 -0
- package/esm/daemon/auth/public-key.js.map +1 -0
- package/esm/daemon/auth/type.d.ts +5 -0
- package/esm/daemon/auth/type.d.ts.map +1 -0
- package/esm/daemon/auth/type.js +2 -0
- package/esm/daemon/auth/type.js.map +1 -0
- package/esm/daemon/crypto.d.ts +6 -5
- package/esm/daemon/crypto.d.ts.map +1 -1
- package/esm/daemon/crypto.js +23 -73
- package/esm/daemon/crypto.js.map +1 -1
- package/esm/daemon/dispatcher.d.ts +3 -3
- package/esm/daemon/dispatcher.d.ts.map +1 -1
- package/esm/daemon/dispatcher.js +11 -4
- package/esm/daemon/dispatcher.js.map +1 -1
- package/esm/daemon/index.d.ts +1 -1
- package/esm/daemon/index.d.ts.map +1 -1
- package/esm/daemon/index.js +1 -1
- package/esm/daemon/index.js.map +1 -1
- package/esm/daemon/socket.d.ts +3 -3
- package/esm/daemon/socket.d.ts.map +1 -1
- package/esm/daemon/transport.d.ts +13 -65
- package/esm/daemon/transport.d.ts.map +1 -1
- package/esm/daemon/transport.js +18 -140
- package/esm/daemon/transport.js.map +1 -1
- package/esm/device-observer.d.ts +2 -3
- package/esm/device-observer.d.ts.map +1 -1
- package/esm/features-value.d.ts +40 -0
- package/esm/features-value.d.ts.map +1 -0
- package/esm/features-value.js +46 -0
- package/esm/features-value.js.map +1 -0
- package/esm/features.d.ts +4 -12
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +27 -13
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/server/client.d.ts +7 -7
- package/esm/server/client.d.ts.map +1 -1
- package/esm/server/client.js +69 -86
- package/esm/server/client.js.map +1 -1
- package/esm/server/commands/wireless.js +1 -1
- package/esm/server/commands/wireless.js.map +1 -1
- package/esm/server/{stream.d.ts → data-connection.d.ts} +5 -5
- package/esm/server/data-connection.d.ts.map +1 -0
- package/esm/server/{stream.js → data-connection.js} +4 -4
- package/esm/server/data-connection.js.map +1 -0
- package/esm/server/index.d.ts +1 -1
- package/esm/server/index.d.ts.map +1 -1
- package/esm/server/index.js +1 -1
- package/esm/server/index.js.map +1 -1
- package/esm/server/observer.d.ts.map +1 -1
- package/esm/server/observer.js +14 -13
- package/esm/server/observer.js.map +1 -1
- package/esm/server/transport.d.ts +4 -6
- package/esm/server/transport.d.ts.map +1 -1
- package/esm/server/transport.js +9 -24
- package/esm/server/transport.js.map +1 -1
- package/esm/service/framebuffer.d.ts.map +1 -0
- package/esm/service/framebuffer.js.map +1 -0
- package/esm/{commands → service}/index.d.ts +1 -2
- package/esm/service/index.d.ts.map +1 -0
- package/esm/{commands → service}/index.js +1 -2
- package/esm/service/index.js.map +1 -0
- package/esm/{commands → service}/power.d.ts +4 -2
- package/esm/service/power.d.ts.map +1 -0
- package/esm/{commands → service}/power.js +11 -5
- package/esm/service/power.js.map +1 -0
- package/esm/service/reverse/error.d.ts +14 -0
- package/esm/service/reverse/error.d.ts.map +1 -0
- package/esm/service/reverse/error.js +21 -0
- package/esm/service/reverse/error.js.map +1 -0
- package/esm/service/reverse/index.d.ts +3 -0
- package/esm/service/reverse/index.d.ts.map +1 -0
- package/esm/service/reverse/index.js +4 -0
- package/esm/service/reverse/index.js.map +1 -0
- package/esm/service/reverse/response.d.ts +2 -0
- package/esm/service/reverse/response.d.ts.map +1 -0
- package/esm/service/reverse/response.js +30 -0
- package/esm/service/reverse/response.js.map +1 -0
- package/esm/service/reverse/service.d.ts +59 -0
- package/esm/service/reverse/service.d.ts.map +1 -0
- package/esm/{commands/reverse.js → service/reverse/service.js} +16 -45
- package/esm/service/reverse/service.js.map +1 -0
- package/esm/{commands → service}/subprocess/index.d.ts +1 -0
- package/esm/service/subprocess/index.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/index.js +1 -0
- package/esm/service/subprocess/index.js.map +1 -0
- package/esm/service/subprocess/none/index.d.ts.map +1 -0
- package/esm/service/subprocess/none/index.js.map +1 -0
- package/esm/{commands → service}/subprocess/none/process.d.ts +2 -2
- package/esm/service/subprocess/none/process.d.ts.map +1 -0
- package/esm/service/subprocess/none/process.js.map +1 -0
- package/esm/{commands → service}/subprocess/none/pty.d.ts +4 -4
- package/esm/service/subprocess/none/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/none/pty.js +1 -1
- package/esm/service/subprocess/none/pty.js.map +1 -0
- package/esm/service/subprocess/none/service.d.ts +10 -0
- package/esm/service/subprocess/none/service.d.ts.map +1 -0
- package/esm/service/subprocess/none/service.js +44 -0
- package/esm/service/subprocess/none/service.js.map +1 -0
- package/esm/service/subprocess/none/spawner.d.ts +15 -0
- package/esm/service/subprocess/none/spawner.d.ts.map +1 -0
- package/esm/service/subprocess/none/spawner.js +31 -0
- package/esm/service/subprocess/none/spawner.js.map +1 -0
- package/esm/{commands → service}/subprocess/pty.d.ts +1 -1
- package/esm/service/subprocess/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/pty.js.map +1 -1
- package/esm/service/subprocess/service.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/service.js +1 -1
- package/esm/service/subprocess/service.js.map +1 -0
- package/esm/service/subprocess/shell/index.d.ts +5 -0
- package/esm/{commands/subprocess/none → service/subprocess/shell}/index.d.ts.map +1 -1
- package/esm/service/subprocess/shell/index.js +6 -0
- package/esm/{commands/subprocess/none → service/subprocess/shell}/index.js.map +1 -1
- package/esm/{commands → service}/subprocess/shell/process.d.ts +2 -2
- package/esm/service/subprocess/shell/process.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/process.js +4 -6
- package/esm/service/subprocess/shell/process.js.map +1 -0
- package/esm/{commands → service}/subprocess/shell/pty.d.ts +4 -4
- package/esm/service/subprocess/shell/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/pty.js +11 -9
- package/esm/service/subprocess/shell/pty.js.map +1 -0
- package/esm/service/subprocess/shell/service.d.ts +34 -0
- package/esm/service/subprocess/shell/service.d.ts.map +1 -0
- package/esm/service/subprocess/shell/service.js +52 -0
- package/esm/service/subprocess/shell/service.js.map +1 -0
- package/esm/service/subprocess/shell/shared.d.ts +2 -0
- package/esm/service/subprocess/shell/shared.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/shared.js +2 -0
- package/esm/service/subprocess/shell/shared.js.map +1 -0
- package/esm/{commands → service}/subprocess/shell/spawner.d.ts +3 -7
- package/esm/service/subprocess/shell/spawner.d.ts.map +1 -0
- package/esm/service/subprocess/shell/spawner.js +45 -0
- package/esm/service/subprocess/shell/spawner.js.map +1 -0
- package/esm/service/subprocess/types.d.ts +14 -0
- package/esm/service/subprocess/types.d.ts.map +1 -0
- package/esm/service/subprocess/types.js +2 -0
- package/esm/service/subprocess/types.js.map +1 -0
- package/esm/service/subprocess/utils.d.ts +39 -0
- package/esm/service/subprocess/utils.d.ts.map +1 -0
- package/esm/service/subprocess/utils.js +142 -0
- package/esm/service/subprocess/utils.js.map +1 -0
- package/esm/service/sync/android.d.ts +34 -0
- package/esm/service/sync/android.d.ts.map +1 -0
- package/esm/service/sync/android.js +34 -0
- package/esm/service/sync/android.js.map +1 -0
- package/esm/service/sync/compression/compression.d.ts +17 -0
- package/esm/service/sync/compression/compression.d.ts.map +1 -0
- package/esm/service/sync/compression/compression.js +92 -0
- package/esm/service/sync/compression/compression.js.map +1 -0
- package/esm/service/sync/compression/format-ns.d.ts +5 -0
- package/esm/service/sync/compression/format-ns.d.ts.map +1 -0
- package/esm/service/sync/compression/format-ns.js +5 -0
- package/esm/service/sync/compression/format-ns.js.map +1 -0
- package/esm/service/sync/compression/format.d.ts +4 -0
- package/esm/service/sync/compression/format.d.ts.map +1 -0
- package/esm/service/sync/compression/format.js +3 -0
- package/esm/service/sync/compression/format.js.map +1 -0
- package/esm/service/sync/compression/index.d.ts +2 -0
- package/esm/service/sync/compression/index.d.ts.map +1 -0
- package/esm/service/sync/compression/index.js +2 -0
- package/esm/service/sync/compression/index.js.map +1 -0
- package/esm/service/sync/id/common.d.ts +17 -0
- package/esm/service/sync/id/common.d.ts.map +1 -0
- package/esm/service/sync/id/common.js +29 -0
- package/esm/service/sync/id/common.js.map +1 -0
- package/esm/service/sync/id/index.d.ts +4 -0
- package/esm/service/sync/id/index.d.ts.map +1 -0
- package/esm/service/sync/id/index.js +6 -0
- package/esm/service/sync/id/index.js.map +1 -0
- package/esm/service/sync/id/request.d.ts +7 -0
- package/esm/service/sync/id/request.d.ts.map +1 -0
- package/esm/service/sync/id/request.js +9 -0
- package/esm/service/sync/id/request.js.map +1 -0
- package/esm/service/sync/id/response.d.ts +6 -0
- package/esm/service/sync/id/response.d.ts.map +1 -0
- package/esm/service/sync/id/response.js +8 -0
- package/esm/service/sync/id/response.js.map +1 -0
- package/esm/service/sync/index-ns.d.ts +7 -0
- package/esm/service/sync/index-ns.d.ts.map +1 -0
- package/esm/service/sync/index-ns.js +7 -0
- package/esm/service/sync/index-ns.js.map +1 -0
- package/esm/service/sync/index.d.ts +3 -0
- package/esm/service/sync/index.d.ts.map +1 -0
- package/esm/service/sync/index.js +3 -0
- package/esm/service/sync/index.js.map +1 -0
- package/esm/service/sync/request/index.d.ts +5 -0
- package/esm/service/sync/request/index.d.ts.map +1 -0
- package/esm/service/sync/request/index.js +5 -0
- package/esm/service/sync/request/index.js.map +1 -0
- package/esm/{commands/sync → service/sync/request}/list.d.ts +21 -19
- package/esm/service/sync/request/list.d.ts.map +1 -0
- package/esm/service/sync/request/list.js +77 -0
- package/esm/service/sync/request/list.js.map +1 -0
- package/esm/service/sync/request/pull.d.ts +12 -0
- package/esm/service/sync/request/pull.d.ts.map +1 -0
- package/esm/service/sync/request/pull.js +28 -0
- package/esm/service/sync/request/pull.js.map +1 -0
- package/esm/service/sync/request/push.d.ts +54 -0
- package/esm/service/sync/request/push.d.ts.map +1 -0
- package/esm/service/sync/request/push.js +95 -0
- package/esm/service/sync/request/push.js.map +1 -0
- package/esm/{commands/sync → service/sync/request}/stat.d.ts +40 -50
- package/esm/service/sync/request/stat.d.ts.map +1 -0
- package/esm/service/sync/request/stat.js +89 -0
- package/esm/service/sync/request/stat.js.map +1 -0
- package/esm/service/sync/service.d.ts +123 -0
- package/esm/service/sync/service.d.ts.map +1 -0
- package/esm/service/sync/service.js +170 -0
- package/esm/service/sync/service.js.map +1 -0
- package/esm/service/sync/socket-pool.d.ts +11 -0
- package/esm/service/sync/socket-pool.d.ts.map +1 -0
- package/esm/service/sync/socket-pool.js +80 -0
- package/esm/service/sync/socket-pool.js.map +1 -0
- package/esm/service/sync/socket.d.ts +40 -0
- package/esm/service/sync/socket.d.ts.map +1 -0
- package/esm/service/sync/socket.js +153 -0
- package/esm/service/sync/socket.js.map +1 -0
- package/esm/{commands → service}/tcpip.d.ts +4 -2
- package/esm/service/tcpip.d.ts.map +1 -0
- package/esm/{commands → service}/tcpip.js +10 -7
- package/esm/service/tcpip.js.map +1 -0
- package/esm/utils/array-buffer.d.ts.map +1 -1
- package/esm/utils/array-buffer.js +2 -3
- package/esm/utils/array-buffer.js.map +1 -1
- package/esm/utils/base64.d.ts.map +1 -1
- package/esm/utils/base64.js +22 -12
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/md5.d.ts +8 -0
- package/esm/utils/md5.d.ts.map +1 -0
- package/esm/utils/md5.js +149 -0
- package/esm/utils/md5.js.map +1 -0
- package/package.json +10 -10
- package/src/adb.ts +44 -34
- package/src/daemon/auth/authenticator.ts +186 -0
- package/src/daemon/auth/index.ts +4 -0
- package/src/daemon/auth/packet-processor.ts +212 -0
- package/src/daemon/auth/public-key.ts +112 -0
- package/src/daemon/auth/type.ts +5 -0
- package/src/daemon/crypto.ts +36 -102
- package/src/daemon/dispatcher.ts +15 -8
- package/src/daemon/index.ts +1 -1
- package/src/daemon/socket.ts +3 -3
- package/src/daemon/transport.ts +35 -253
- package/src/device-observer.ts +3 -3
- package/src/features-value.ts +47 -0
- package/src/features.ts +31 -14
- package/src/index.ts +1 -1
- package/src/server/client.ts +96 -94
- package/src/server/commands/wireless.ts +1 -1
- package/src/server/{stream.ts → data-connection.ts} +4 -4
- package/src/server/index.ts +1 -1
- package/src/server/observer.ts +21 -19
- package/src/server/transport.ts +13 -34
- package/src/{commands → service}/index.ts +1 -2
- package/src/{commands → service}/power.ts +14 -5
- package/src/service/reverse/error.ts +35 -0
- package/src/service/reverse/index.ts +3 -0
- package/src/service/reverse/response.ts +38 -0
- package/src/{commands/reverse.ts → service/reverse/service.ts} +32 -72
- package/src/{commands → service}/subprocess/index.ts +1 -0
- package/src/{commands → service}/subprocess/none/process.ts +3 -3
- package/src/{commands → service}/subprocess/none/pty.ts +5 -5
- package/src/service/subprocess/none/service.ts +57 -0
- package/src/service/subprocess/none/spawner.ts +81 -0
- package/src/{commands → service}/subprocess/pty.ts +1 -1
- package/src/{commands → service}/subprocess/service.ts +1 -1
- package/src/{commands → service}/subprocess/shell/index.ts +1 -1
- package/src/{commands → service}/subprocess/shell/process.ts +6 -7
- package/src/{commands → service}/subprocess/shell/pty.ts +15 -13
- package/src/service/subprocess/shell/service.ts +75 -0
- package/src/{commands → service}/subprocess/shell/shared.ts +5 -0
- package/src/service/subprocess/shell/spawner.ts +109 -0
- package/src/service/subprocess/types.ts +19 -0
- package/src/service/subprocess/utils.ts +166 -0
- package/src/service/sync/android.ts +43 -0
- package/src/service/sync/compression/compression.ts +126 -0
- package/src/service/sync/compression/format-ns.ts +4 -0
- package/src/service/sync/compression/format.ts +5 -0
- package/src/service/sync/compression/index.ts +1 -0
- package/src/service/sync/id/common.ts +33 -0
- package/src/service/sync/id/index.ts +7 -0
- package/src/service/sync/id/request.ts +12 -0
- package/src/service/sync/id/response.ts +11 -0
- package/src/service/sync/index-ns.ts +6 -0
- package/src/service/sync/index.ts +2 -0
- package/src/service/sync/request/index.ts +4 -0
- package/src/service/sync/request/list.ts +110 -0
- package/src/service/sync/request/pull.ts +49 -0
- package/src/service/sync/request/push.ts +184 -0
- package/src/service/sync/request/stat.ts +127 -0
- package/src/service/sync/service.ts +255 -0
- package/src/service/sync/socket-pool.ts +97 -0
- package/src/service/sync/socket.ts +201 -0
- package/src/{commands → service}/tcpip.ts +13 -7
- package/src/utils/array-buffer.ts +2 -3
- package/src/utils/base64.ts +24 -12
- package/src/utils/index.ts +1 -0
- package/src/utils/md5.ts +185 -0
- package/yume-chan-adb-3.0.0-beta.0.tgz +0 -0
- package/CHANGELOG.md +0 -251
- package/esm/commands/base.d.ts +0 -8
- package/esm/commands/base.d.ts.map +0 -1
- package/esm/commands/base.js +0 -12
- package/esm/commands/base.js.map +0 -1
- package/esm/commands/framebuffer.d.ts.map +0 -1
- package/esm/commands/framebuffer.js.map +0 -1
- package/esm/commands/index.d.ts.map +0 -1
- package/esm/commands/index.js.map +0 -1
- package/esm/commands/power.d.ts.map +0 -1
- package/esm/commands/power.js.map +0 -1
- package/esm/commands/reverse.d.ts +0 -48
- package/esm/commands/reverse.d.ts.map +0 -1
- package/esm/commands/reverse.js.map +0 -1
- package/esm/commands/subprocess/index.d.ts.map +0 -1
- package/esm/commands/subprocess/index.js.map +0 -1
- package/esm/commands/subprocess/none/process.d.ts.map +0 -1
- package/esm/commands/subprocess/none/process.js.map +0 -1
- package/esm/commands/subprocess/none/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/none/pty.js.map +0 -1
- package/esm/commands/subprocess/none/service.d.ts +0 -10
- package/esm/commands/subprocess/none/service.d.ts.map +0 -1
- package/esm/commands/subprocess/none/service.js +0 -34
- package/esm/commands/subprocess/none/service.js.map +0 -1
- package/esm/commands/subprocess/none/spawner.d.ts +0 -19
- package/esm/commands/subprocess/none/spawner.d.ts.map +0 -1
- package/esm/commands/subprocess/none/spawner.js +0 -26
- package/esm/commands/subprocess/none/spawner.js.map +0 -1
- package/esm/commands/subprocess/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/service.d.ts.map +0 -1
- package/esm/commands/subprocess/service.js.map +0 -1
- package/esm/commands/subprocess/shell/index.d.ts +0 -6
- package/esm/commands/subprocess/shell/index.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/index.js +0 -6
- package/esm/commands/subprocess/shell/index.js.map +0 -1
- package/esm/commands/subprocess/shell/process.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/process.js.map +0 -1
- package/esm/commands/subprocess/shell/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/pty.js.map +0 -1
- package/esm/commands/subprocess/shell/service.d.ts +0 -14
- package/esm/commands/subprocess/shell/service.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/service.js +0 -41
- package/esm/commands/subprocess/shell/service.js.map +0 -1
- package/esm/commands/subprocess/shell/shared.d.ts +0 -19
- package/esm/commands/subprocess/shell/shared.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/shared.js.map +0 -1
- package/esm/commands/subprocess/shell/spawner.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/spawner.js +0 -38
- package/esm/commands/subprocess/shell/spawner.js.map +0 -1
- package/esm/commands/subprocess/utils.d.ts +0 -3
- package/esm/commands/subprocess/utils.d.ts.map +0 -1
- package/esm/commands/subprocess/utils.js +0 -56
- package/esm/commands/subprocess/utils.js.map +0 -1
- package/esm/commands/sync/index.d.ts +0 -9
- package/esm/commands/sync/index.d.ts.map +0 -1
- package/esm/commands/sync/index.js +0 -9
- package/esm/commands/sync/index.js.map +0 -1
- package/esm/commands/sync/list.d.ts.map +0 -1
- package/esm/commands/sync/list.js +0 -64
- package/esm/commands/sync/list.js.map +0 -1
- package/esm/commands/sync/pull.d.ts +0 -12
- package/esm/commands/sync/pull.d.ts.map +0 -1
- package/esm/commands/sync/pull.js +0 -33
- package/esm/commands/sync/pull.js.map +0 -1
- package/esm/commands/sync/push.d.ts +0 -61
- package/esm/commands/sync/push.d.ts.map +0 -1
- package/esm/commands/sync/push.js +0 -83
- package/esm/commands/sync/push.js.map +0 -1
- package/esm/commands/sync/request.d.ts +0 -24
- package/esm/commands/sync/request.d.ts.map +0 -1
- package/esm/commands/sync/request.js +0 -32
- package/esm/commands/sync/request.js.map +0 -1
- package/esm/commands/sync/response.d.ts +0 -28
- package/esm/commands/sync/response.d.ts.map +0 -1
- package/esm/commands/sync/response.js +0 -81
- package/esm/commands/sync/response.js.map +0 -1
- package/esm/commands/sync/socket.d.ts +0 -22
- package/esm/commands/sync/socket.d.ts.map +0 -1
- package/esm/commands/sync/socket.js +0 -78
- package/esm/commands/sync/socket.js.map +0 -1
- package/esm/commands/sync/stat.d.ts.map +0 -1
- package/esm/commands/sync/stat.js +0 -121
- package/esm/commands/sync/stat.js.map +0 -1
- package/esm/commands/sync/sync.d.ts +0 -82
- package/esm/commands/sync/sync.d.ts.map +0 -1
- package/esm/commands/sync/sync.js +0 -138
- package/esm/commands/sync/sync.js.map +0 -1
- package/esm/commands/tcpip.d.ts.map +0 -1
- package/esm/commands/tcpip.js.map +0 -1
- package/esm/daemon/auth.d.ts +0 -54
- package/esm/daemon/auth.d.ts.map +0 -1
- package/esm/daemon/auth.js +0 -104
- package/esm/daemon/auth.js.map +0 -1
- package/esm/server/stream.d.ts.map +0 -1
- package/esm/server/stream.js.map +0 -1
- package/src/commands/base.ts +0 -15
- package/src/commands/subprocess/none/service.ts +0 -45
- package/src/commands/subprocess/none/spawner.ts +0 -68
- package/src/commands/subprocess/shell/service.ts +0 -58
- package/src/commands/subprocess/shell/spawner.ts +0 -90
- package/src/commands/subprocess/utils.ts +0 -61
- package/src/commands/sync/index.ts +0 -8
- package/src/commands/sync/list.ts +0 -99
- package/src/commands/sync/pull.ts +0 -55
- package/src/commands/sync/push.ts +0 -172
- package/src/commands/sync/request.ts +0 -53
- package/src/commands/sync/response.ts +0 -105
- package/src/commands/sync/socket.ts +0 -109
- package/src/commands/sync/stat.ts +0 -177
- package/src/commands/sync/sync.ts +0 -175
- package/src/daemon/auth.ts +0 -204
- package/tsconfig.build.tsbuildinfo +0 -1
- /package/esm/{commands → service}/framebuffer.d.ts +0 -0
- /package/esm/{commands → service}/framebuffer.js +0 -0
- /package/esm/{commands → service}/subprocess/none/index.d.ts +0 -0
- /package/esm/{commands → service}/subprocess/none/index.js +0 -0
- /package/esm/{commands → service}/subprocess/none/process.js +0 -0
- /package/esm/{commands → service}/subprocess/pty.js +0 -0
- /package/esm/{commands → service}/subprocess/service.d.ts +0 -0
- /package/src/{commands → service}/framebuffer.ts +0 -0
- /package/src/{commands → service}/subprocess/none/index.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,0BAA0B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { AbortSignal, ReadableStream } from "@yume-chan/stream-extra";
|
|
3
3
|
import { MaybeConsumable, WritableStream } from "@yume-chan/stream-extra";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Adb } from "../../../adb.js";
|
|
5
5
|
import type { AdbShellProtocolProcess } from "./spawner.js";
|
|
6
6
|
export declare class AdbShellProtocolProcessImpl implements AdbShellProtocolProcess {
|
|
7
7
|
#private;
|
|
@@ -9,7 +9,7 @@ export declare class AdbShellProtocolProcessImpl implements AdbShellProtocolProc
|
|
|
9
9
|
get stdout(): ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
10
10
|
get stderr(): ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
11
11
|
get exited(): Promise<number>;
|
|
12
|
-
constructor(socket:
|
|
12
|
+
constructor(socket: Adb.Socket, signal?: AbortSignal);
|
|
13
13
|
kill(): MaybePromiseLike<void>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EACR,WAAW,EAEX,cAAc,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,eAAe,EAGf,cAAc,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE5D,qBAAa,2BAA4B,YAAW,uBAAuB;;IAKvE,IAAI,KAAK,iEAER;IAGD,IAAI,MAAM,gDAET;IAGD,IAAI,MAAM,gDAET;IAGD,IAAI,MAAM,oBAET;gBAEW,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW;IAsFpD,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC;CAGjC"}
|
|
@@ -76,12 +76,10 @@ export class AdbShellProtocolProcessImpl {
|
|
|
76
76
|
}
|
|
77
77
|
this.#writer = this.#socket.writable.getWriter();
|
|
78
78
|
this.#stdin = new MaybeConsumable.WritableStream({
|
|
79
|
-
write:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}));
|
|
84
|
-
},
|
|
79
|
+
write: (chunk) => this.#writer.write(AdbShellProtocolPacket.serialize({
|
|
80
|
+
id: AdbShellProtocolId.Stdin,
|
|
81
|
+
data: chunk,
|
|
82
|
+
})),
|
|
85
83
|
close: () =>
|
|
86
84
|
// Only shell protocol + raw mode supports closing stdin
|
|
87
85
|
this.#writer.write(AdbShellProtocolPacket.serialize({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/process.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOnD,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGzE,MAAM,OAAO,2BAA2B;IAC3B,OAAO,CAAa;IACpB,OAAO,CAA2D;IAElE,MAAM,CAA8C;IAC7D,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEQ,OAAO,CAA6B;IAC7C,IAAI,MAAM;Q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CAAC,OAAO,CAAC,KAAK,CACd,sBAAsB,CAAC,SAAS,CAAC;gBAC7B,EAAE,EAAE,kBAAkB,CAAC,UAAU;gBACjC,IAAI,EAAE,eAAe;aACxB,CAAC,CACL;SACR,CAAC,CAAC;IACP,CAAC;IAED,IAAI;QACA,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACJ"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ReadableStream } from "@yume-chan/stream-extra";
|
|
2
2
|
import { MaybeConsumable, WritableStream } from "@yume-chan/stream-extra";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export declare class
|
|
3
|
+
import type { Adb } from "../../../adb.js";
|
|
4
|
+
import type { AdbPty } from "../pty.js";
|
|
5
|
+
export declare class AdbShellProtocolPty implements AdbPty<number> {
|
|
6
6
|
#private;
|
|
7
7
|
get input(): WritableStream<MaybeConsumable<Uint8Array<ArrayBufferLike>>>;
|
|
8
8
|
get output(): ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
9
9
|
get exited(): Promise<number>;
|
|
10
|
-
constructor(socket:
|
|
10
|
+
constructor(socket: Adb.Socket);
|
|
11
11
|
resize(rows: number, cols: number): Promise<void>;
|
|
12
12
|
sigint(): Promise<void>;
|
|
13
13
|
kill(): import("@yume-chan/async").MaybePromiseLike<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pty.d.ts","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/pty.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAER,cAAc,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,eAAe,EAGf,cAAc,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,qBAAa,mBAAoB,YAAW,MAAM,CAAC,MAAM,CAAC;;IAKtD,IAAI,KAAK,iEAER;IAGD,IAAI,MAAM,gDAET;IAGD,IAAI,MAAM,oBAET;gBAEW,MAAM,EAAE,GAAG,CAAC,MAAM;IAuDxB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAYvC,MAAM;IAKN,IAAI;CAGP"}
|
|
@@ -2,16 +2,16 @@ import { PromiseResolver } from "@yume-chan/async";
|
|
|
2
2
|
import { MaybeConsumable, PushReadableStream, StructDeserializeStream, WritableStream, } from "@yume-chan/stream-extra";
|
|
3
3
|
import { encodeUtf8 } from "@yume-chan/struct";
|
|
4
4
|
import { AdbShellProtocolId, AdbShellProtocolPacket } from "./shared.js";
|
|
5
|
-
export class
|
|
5
|
+
export class AdbShellProtocolPty {
|
|
6
6
|
#socket;
|
|
7
7
|
#writer;
|
|
8
8
|
#input;
|
|
9
9
|
get input() {
|
|
10
10
|
return this.#input;
|
|
11
11
|
}
|
|
12
|
-
#
|
|
12
|
+
#output;
|
|
13
13
|
get output() {
|
|
14
|
-
return this.#
|
|
14
|
+
return this.#output;
|
|
15
15
|
}
|
|
16
16
|
#exited = new PromiseResolver();
|
|
17
17
|
get exited() {
|
|
@@ -19,9 +19,9 @@ export class AdbShellProtocolPtyProcess {
|
|
|
19
19
|
}
|
|
20
20
|
constructor(socket) {
|
|
21
21
|
this.#socket = socket;
|
|
22
|
-
let
|
|
23
|
-
this.#
|
|
24
|
-
|
|
22
|
+
let outputController;
|
|
23
|
+
this.#output = new PushReadableStream((controller) => {
|
|
24
|
+
outputController = controller;
|
|
25
25
|
});
|
|
26
26
|
socket.readable
|
|
27
27
|
.pipeThrough(new StructDeserializeStream(AdbShellProtocolPacket))
|
|
@@ -32,17 +32,18 @@ export class AdbShellProtocolPtyProcess {
|
|
|
32
32
|
this.#exited.resolve(chunk.data[0]);
|
|
33
33
|
break;
|
|
34
34
|
case AdbShellProtocolId.Stdout:
|
|
35
|
-
await
|
|
35
|
+
await outputController.enqueue(chunk.data);
|
|
36
36
|
break;
|
|
37
|
+
// PTY mode doesn't have stderr
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
}))
|
|
40
41
|
.then(() => {
|
|
41
|
-
|
|
42
|
+
outputController.close();
|
|
42
43
|
// If `#exit` has already resolved, this will be a no-op
|
|
43
44
|
this.#exited.reject(new Error("Socket ended without exit message"));
|
|
44
45
|
}, (e) => {
|
|
45
|
-
|
|
46
|
+
outputController.error(e);
|
|
46
47
|
// If `#exit` has already resolved, this will be a no-op
|
|
47
48
|
this.#exited.reject(e);
|
|
48
49
|
});
|
|
@@ -67,6 +68,7 @@ export class AdbShellProtocolPtyProcess {
|
|
|
67
68
|
}));
|
|
68
69
|
}
|
|
69
70
|
sigint() {
|
|
71
|
+
// Write `^C`
|
|
70
72
|
return this.#writeStdin(new Uint8Array([0x03]));
|
|
71
73
|
}
|
|
72
74
|
kill() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pty.js","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/pty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMnD,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,OAAO,mBAAmB;IACnB,OAAO,CAAa;IACpB,OAAO,CAA2D;IAElE,MAAM,CAA8C;IAC7D,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEQ,OAAO,CAA6B;IAC7C,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAEQ,OAAO,GAAG,IAAI,eAAe,EAAU,CAAC;IACjD,IAAI,MA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S,EAAE,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,cAAc,CAAa;YACzD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;SAC5C,CAAC,CAAC;IACP,CAAC;IAED,WAAW,CAAC,KAAiB;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CACrB,sBAAsB,CAAC,SAAS,CAAC;YAC7B,EAAE,EAAE,kBAAkB,CAAC,KAAK;YAC5B,IAAI,EAAE,KAAK;SACd,CAAC,CACL,CAAC;IACN,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,IAAY;QACnC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CACpB,sBAAsB,CAAC,SAAS,CAAC;YAC7B,EAAE,EAAE,kBAAkB,CAAC,gBAAgB;YACvC,oEAAoE;YACpE,8DAA8D;YAC9D,8EAA8E;YAC9E,IAAI,EAAE,UAAU,CAAC,GAAG,IAAI,IAAI,IAAI,QAAQ,CAAC;SAC5C,CAAC,CACL,CAAC;IACN,CAAC;IAED,MAAM;QACF,aAAa;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI;QACA,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACJ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Adb } from "../../../adb.js";
|
|
2
|
+
import { AdbShellProtocolPty } from "./pty.js";
|
|
3
|
+
import { AdbShellProtocolId, AdbShellProtocolPacket } from "./shared.js";
|
|
4
|
+
export declare class AdbShellProtocolSubprocessService {
|
|
5
|
+
#private;
|
|
6
|
+
static readonly PacketId: {
|
|
7
|
+
readonly Stdin: 0;
|
|
8
|
+
readonly Stdout: 1;
|
|
9
|
+
readonly Stderr: 2;
|
|
10
|
+
readonly Exit: 3;
|
|
11
|
+
readonly CloseStdin: 4;
|
|
12
|
+
readonly WindowSizeChange: 5;
|
|
13
|
+
};
|
|
14
|
+
static readonly Packet: import("@yume-chan/struct").Struct<{
|
|
15
|
+
id: import("@yume-chan/struct").Field<AdbShellProtocolId, never, never, number>;
|
|
16
|
+
data: import("@yume-chan/struct").Field<Uint8Array<ArrayBufferLike>, string, never, Uint8Array<ArrayBufferLike>>;
|
|
17
|
+
}, undefined, import("@yume-chan/struct").FieldsValue<{
|
|
18
|
+
id: import("@yume-chan/struct").Field<AdbShellProtocolId, never, never, number>;
|
|
19
|
+
data: import("@yume-chan/struct").Field<Uint8Array<ArrayBufferLike>, string, never, Uint8Array<ArrayBufferLike>>;
|
|
20
|
+
}>>;
|
|
21
|
+
get adb(): Adb;
|
|
22
|
+
get isSupported(): boolean;
|
|
23
|
+
constructor(adb: Adb);
|
|
24
|
+
spawn: import("./spawner.js").AdbShellProtocolSpawner;
|
|
25
|
+
pty(options?: {
|
|
26
|
+
command?: string | readonly string[] | undefined;
|
|
27
|
+
terminalType?: string;
|
|
28
|
+
}): Promise<AdbShellProtocolPty>;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace AdbShellProtocolSubprocessService {
|
|
31
|
+
type PacketId = AdbShellProtocolId;
|
|
32
|
+
type Packet = AdbShellProtocolPacket;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGzE,qBAAa,iCAAiC;;IAC1C,MAAM,CAAC,QAAQ,CAAC,QAAQ;;;;;;;MAAsB;IAE9C,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;QAA0B;IAGhD,IAAI,GAAG,QAEN;IAED,IAAI,WAAW,YAEd;gBAEW,GAAG,EAAE,GAAG;IAIpB,KAAK,iDAeF;IAEG,GAAG,CAAC,OAAO,CAAC,EAAE;QAChB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;QACjD,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAsBnC;AAED,yBAAiB,iCAAiC,CAAC;IAC/C,KAAY,QAAQ,GAAG,kBAAkB,CAAC;IAE1C,KAAY,MAAM,GAAG,sBAAsB,CAAC;CAC/C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AdbFeature } from "../../../features.js";
|
|
2
|
+
import { AdbShellProtocolProcessImpl } from "./process.js";
|
|
3
|
+
import { AdbShellProtocolPty } from "./pty.js";
|
|
4
|
+
import { AdbShellProtocolId, AdbShellProtocolPacket } from "./shared.js";
|
|
5
|
+
import { adbShellProtocolSpawner } from "./spawner.js";
|
|
6
|
+
export class AdbShellProtocolSubprocessService {
|
|
7
|
+
static PacketId = AdbShellProtocolId;
|
|
8
|
+
static Packet = AdbShellProtocolPacket;
|
|
9
|
+
#adb;
|
|
10
|
+
get adb() {
|
|
11
|
+
return this.#adb;
|
|
12
|
+
}
|
|
13
|
+
get isSupported() {
|
|
14
|
+
return this.#adb.canUseFeature(AdbFeature.Shell2);
|
|
15
|
+
}
|
|
16
|
+
constructor(adb) {
|
|
17
|
+
this.#adb = adb;
|
|
18
|
+
}
|
|
19
|
+
spawn = adbShellProtocolSpawner(async (command, signal) => {
|
|
20
|
+
if (!command.length) {
|
|
21
|
+
throw new Error("Command cannot be empty");
|
|
22
|
+
}
|
|
23
|
+
// Don't escape `command`. See `AdbNoneProtocolSubprocessService.prototype.spawn` for details.
|
|
24
|
+
const service = "shell,v2,raw:" + command.join(" ");
|
|
25
|
+
const socket = await this.#adb.createSocket(service);
|
|
26
|
+
if (signal?.aborted) {
|
|
27
|
+
await socket.close();
|
|
28
|
+
throw signal.reason;
|
|
29
|
+
}
|
|
30
|
+
return new AdbShellProtocolProcessImpl(socket, signal);
|
|
31
|
+
});
|
|
32
|
+
async pty(options) {
|
|
33
|
+
const { command, terminalType } = options ?? {};
|
|
34
|
+
let service = "shell,v2,pty";
|
|
35
|
+
if (terminalType) {
|
|
36
|
+
if (terminalType.includes(",") || terminalType.includes(":")) {
|
|
37
|
+
throw new Error("terminalType must not contain ',' or ':'");
|
|
38
|
+
}
|
|
39
|
+
service += `,TERM=` + terminalType;
|
|
40
|
+
}
|
|
41
|
+
service += ":";
|
|
42
|
+
if (typeof command === "string") {
|
|
43
|
+
service += command;
|
|
44
|
+
}
|
|
45
|
+
else if (Array.isArray(command)) {
|
|
46
|
+
// Don't escape `command`. See `AdbNoneProtocolSubprocessService.prototype.spawn` for details.
|
|
47
|
+
service += command.join(" ");
|
|
48
|
+
}
|
|
49
|
+
return new AdbShellProtocolPty(await this.#adb.createSocket(service));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,OAAO,iCAAiC;IAC1C,MAAM,CAAU,QAAQ,GAAG,kBAAkB,CAAC;IAE9C,MAAM,CAAU,MAAM,GAAG,sBA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Y,CAAC;QACvC,CAAC;QACD,OAAO,IAAI,GAAG,CAAC;QAEf,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,IAAI,OAAO,CAAC;QACvB,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,8FAA8F;YAC9F,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAI,mBAAmB,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/shared.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buffer, struct, u32, u8 } from "@yume-chan/struct";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export const AdbShellProtocolId = {
|
|
3
4
|
Stdin: 0,
|
|
4
5
|
Stdout: 1,
|
|
@@ -8,6 +9,7 @@ export const AdbShellProtocolId = {
|
|
|
8
9
|
WindowSizeChange: 5,
|
|
9
10
|
};
|
|
10
11
|
// This packet format is used in both directions.
|
|
12
|
+
/** @internal */
|
|
11
13
|
export const AdbShellProtocolPacket = struct({
|
|
12
14
|
id: u8(),
|
|
13
15
|
data: buffer(u32),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/shared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAE5D,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,UAAU,EAAE,CAAC;IACb,gBAAgB,EAAE,CAAC;CACb,CAAC;AAMX,iDAAiD;AACjD,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CACxC;IACI,EAAE,EAAE,EAAE,EAAsB;IAC5B,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC;CACpB,EACD,EAAE,YAAY,EAAE,IAAI,EAAE,CACzB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import type { AbortSignal, MaybeConsumable, ReadableStream, WritableStream } from "@yume-chan/stream-extra";
|
|
3
|
+
import type { AdbSubprocessSpawner } from "../types.js";
|
|
3
4
|
export interface AdbShellProtocolProcess {
|
|
4
5
|
get stdin(): WritableStream<MaybeConsumable<Uint8Array>>;
|
|
5
6
|
get stdout(): ReadableStream<Uint8Array>;
|
|
@@ -7,13 +8,7 @@ export interface AdbShellProtocolProcess {
|
|
|
7
8
|
get exited(): Promise<number>;
|
|
8
9
|
kill(): MaybePromiseLike<void>;
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
-
#private;
|
|
12
|
-
constructor(spawn: (command: readonly string[], signal: AbortSignal | undefined) => Promise<AdbShellProtocolProcess>);
|
|
13
|
-
spawn(command: string | readonly string[], signal?: AbortSignal): Promise<AdbShellProtocolProcess>;
|
|
14
|
-
spawnWait(command: string | readonly string[]): Promise<AdbShellProtocolSpawner.WaitResult<Uint8Array>>;
|
|
15
|
-
spawnWaitText(command: string | readonly string[]): Promise<AdbShellProtocolSpawner.WaitResult<string>>;
|
|
16
|
-
}
|
|
11
|
+
export type AdbShellProtocolSpawner = (command: string | readonly string[], signal?: AbortSignal) => Promise<AdbShellProtocolProcess> & AdbSubprocessSpawner.Wait<AdbShellProtocolSpawner.WaitResult<Uint8Array>, AdbShellProtocolSpawner.WaitResult<string>>;
|
|
17
12
|
export declare namespace AdbShellProtocolSpawner {
|
|
18
13
|
interface WaitResult<T> {
|
|
19
14
|
stdout: T;
|
|
@@ -21,4 +16,5 @@ export declare namespace AdbShellProtocolSpawner {
|
|
|
21
16
|
exitCode: number;
|
|
22
17
|
}
|
|
23
18
|
}
|
|
19
|
+
export declare function adbShellProtocolSpawner(spawn: (command: readonly string[], signal: AbortSignal | undefined) => Promise<AdbShellProtocolProcess>): AdbShellProtocolSpawner;
|
|
24
20
|
//# sourceMappingURL=spawner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawner.d.ts","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/spawner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EACR,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAQxD,MAAM,WAAW,uBAAuB;IACpC,IAAI,KAAK,IAAI,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzD,IAAI,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;IAEzC,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9B,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,uBAAuB,GAAG,CAClC,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACnC,MAAM,CAAC,EAAE,WAAW,KACnB,OAAO,CAAC,uBAAuB,CAAC,GACjC,oBAAoB,CAAC,IAAI,CACrB,uBAAuB,CAAC,UAAU,CAAC,UAAU,CAAC,EAC9C,uBAAuB,CAAC,UAAU,CAAC,MAAM,CAAC,CAC7C,CAAC;AAEN,yBAAiB,uBAAuB,CAAC;IACrC,UAAiB,UAAU,CAAC,CAAC;QACzB,MAAM,EAAE,CAAC,CAAC;QACV,MAAM,EAAE,CAAC,CAAC;QACV,QAAQ,EAAE,MAAM,CAAC;KACpB;CACJ;AAED,wBAAgB,uBAAuB,CACnC,KAAK,EAAE,CACH,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,WAAW,GAAG,SAAS,KAC9B,OAAO,CAAC,uBAAuB,CAAC,GACtC,uBAAuB,CA0DzB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { concatUint8Arrays } from "@yume-chan/stream-extra";
|
|
2
|
+
import { createLazyPromise, decodeUtf8Chunked, splitCommand, ToArrayStream, } from "../utils.js";
|
|
3
|
+
export function adbShellProtocolSpawner(spawn) {
|
|
4
|
+
return (command, signal) => {
|
|
5
|
+
signal?.throwIfAborted();
|
|
6
|
+
if (typeof command === "string") {
|
|
7
|
+
command = splitCommand(command);
|
|
8
|
+
}
|
|
9
|
+
const processPromise = spawn(command, signal);
|
|
10
|
+
processPromise.wait = (options) => {
|
|
11
|
+
const waitPromise = processPromise.then(async (process) => {
|
|
12
|
+
const [, stdout, stderr, exitCode] = await Promise.all([
|
|
13
|
+
options?.stdin?.pipeTo(process.stdin),
|
|
14
|
+
process.stdout.pipeThrough(new ToArrayStream()),
|
|
15
|
+
process.stderr.pipeThrough(new ToArrayStream()),
|
|
16
|
+
process.exited,
|
|
17
|
+
]);
|
|
18
|
+
return {
|
|
19
|
+
stdout,
|
|
20
|
+
stderr,
|
|
21
|
+
exitCode,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
return createLazyPromise(async () => {
|
|
25
|
+
const { stdout, stderr, exitCode } = await waitPromise;
|
|
26
|
+
return {
|
|
27
|
+
stdout: concatUint8Arrays(stdout),
|
|
28
|
+
stderr: concatUint8Arrays(stderr),
|
|
29
|
+
exitCode,
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
async toString() {
|
|
33
|
+
const { stdout, stderr, exitCode } = await waitPromise;
|
|
34
|
+
return {
|
|
35
|
+
stdout: decodeUtf8Chunked(stdout),
|
|
36
|
+
stderr: decodeUtf8Chunked(stderr),
|
|
37
|
+
exitCode,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return processPromise;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=spawner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawner.js","sourceRoot":"","sources":["../../../../src/service/subprocess/shell/spawner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EACH,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GAChB,MAAM,aAAa,CAAC;AA8BrB,MAAM,UAAU,uBAAuB,CACnC,KAGqC;IAErC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACvB,MAAM,EAAE,cAAc,EAAE,CAAC;QAEzB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,cAAc,GAAG,KAAK,CACxB,OAAO,EACP,MAAM,CAKL,CAAC;QAEN,cAAc,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE;YAC9B,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;gBACtD,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;oBACnD,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;oBACrC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;oBAC/C,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;oBAC/C,OAAO,CAAC,MAAM;iBACjB,CAAC,CAAC;gBACH,OAAO;oBACH,MAAM;oBACN,MAAM;oBACN,QAAQ;iBACgD,CAAC;YACjE,CAAC,CAAC,CAAC;YAEH,OAAO,iBAAiB,CACpB,KAAK,IAAI,EAAE;gBACP,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,CAAC;gBAEvD,OAAO;oBACH,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;oBACjC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;oBACjC,QAAQ;iBACX,CAAC;YACN,CAAC,EACD;gBACI,KAAK,CAAC,QAAQ;oBACV,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,CAAC;oBAEvD,OAAO;wBACH,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;wBACjC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;wBACjC,QAAQ;qBACX,CAAC;gBACN,CAAC;aACJ,CACJ,CAAC;QACN,CAAC,CAAC;QAEF,OAAO,cAAc,CAAC;IAC1B,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MaybeConsumable, ReadableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import type { LazyPromise } from "./utils.js";
|
|
3
|
+
export declare namespace AdbSubprocessSpawner {
|
|
4
|
+
interface WaitToString<T> {
|
|
5
|
+
toString(): Promise<T>;
|
|
6
|
+
}
|
|
7
|
+
interface WaitOptions {
|
|
8
|
+
stdin?: ReadableStream<MaybeConsumable<Uint8Array>> | undefined;
|
|
9
|
+
}
|
|
10
|
+
interface Wait<TBuffer, TString> {
|
|
11
|
+
wait(options?: WaitOptions): LazyPromise<TBuffer, WaitToString<TString>>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/service/subprocess/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,yBAAiB,oBAAoB,CAAC;IAClC,UAAiB,YAAY,CAAC,CAAC;QAC3B,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;KAC1B;IAED,UAAiB,WAAW;QACxB,KAAK,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;KACnE;IAED,UAAiB,IAAI,CAAC,OAAO,EAAE,OAAO;QAClC,IAAI,CACA,OAAO,CAAC,EAAE,WAAW,GACtB,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;KAClD;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/service/subprocess/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AccumulateStream } from "@yume-chan/stream-extra";
|
|
2
|
+
export declare function escapeArg(s: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Split the command.
|
|
5
|
+
*
|
|
6
|
+
* Quotes and escaped characters are supported, and will be returned as-is.
|
|
7
|
+
* @param input The input command
|
|
8
|
+
* @returns An array of string containing the arguments
|
|
9
|
+
*/
|
|
10
|
+
export declare function splitCommand(input: string): string[];
|
|
11
|
+
export type LazyPromise<T, U> = Omit<Promise<T>, typeof Symbol.toStringTag> & U;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a `Promise`-like object that lazily computes the result
|
|
14
|
+
* only when it's being used as a `Promise`.
|
|
15
|
+
*
|
|
16
|
+
* For example, if an API returns a value `p` of type `Promise<T> & { asU(): Promise<U> }`,
|
|
17
|
+
* and the user calls `p.asU()` instead of using it as a `Promise` (`p.then()`, `await p`, etc.),
|
|
18
|
+
* is unnecessary to compute the result `T` (unless `asU` also depends on it).
|
|
19
|
+
*
|
|
20
|
+
* By using `createLazyPromise(computeT, { asU: computeU })`,
|
|
21
|
+
* `computeT` will only run when `p` is used as a `Promise`.
|
|
22
|
+
*
|
|
23
|
+
* Note that the result object can't be returned from an async function,
|
|
24
|
+
* as async functions always creates a new `Promise` with the return value,
|
|
25
|
+
* which runs `initializer` immediately, and discards any extra `methods` attached.
|
|
26
|
+
* @param initializer
|
|
27
|
+
* The initializer function when the result object is being used as a `Promise`.
|
|
28
|
+
*
|
|
29
|
+
* The result value will be cached.
|
|
30
|
+
* @param methods Any extra methods to add to the result object
|
|
31
|
+
* @returns
|
|
32
|
+
* A `Promise`-like object that runs `initializer` when used as a `Promise`, and contains `methods`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createLazyPromise<T, U extends Record<PropertyKey, () => unknown>>(initializer: () => Promise<T>, methods: U): LazyPromise<T, U>;
|
|
35
|
+
export declare class ToArrayStream<T> extends AccumulateStream<T, T[]> {
|
|
36
|
+
constructor();
|
|
37
|
+
}
|
|
38
|
+
export declare function decodeUtf8Chunked(chunks: Uint8Array[]): string;
|
|
39
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/service/subprocess/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,UAoBlC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAyCpD;AAID,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAC7B,CAAC,EACD,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,EAC9C,WAAW,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAoC9D;AAED,qBAAa,aAAa,CAAC,CAAC,CAAE,SAAQ,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;;CAW7D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAU9D"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { AccumulateStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import { TextDecoder } from "@yume-chan/struct";
|
|
3
|
+
export function escapeArg(s) {
|
|
4
|
+
let result = "";
|
|
5
|
+
result += `'`;
|
|
6
|
+
let base = 0;
|
|
7
|
+
while (true) {
|
|
8
|
+
const found = s.indexOf(`'`, base);
|
|
9
|
+
if (found === -1) {
|
|
10
|
+
result += s.substring(base);
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
result += s.substring(base, found);
|
|
14
|
+
// a'b becomes 'a'\'b', which is 'a' + \' + 'b'
|
|
15
|
+
// (quoted string 'a', escaped single quote, and quoted string 'b')
|
|
16
|
+
result += String.raw `'\''`;
|
|
17
|
+
base = found + 1;
|
|
18
|
+
}
|
|
19
|
+
result += `'`;
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Split the command.
|
|
24
|
+
*
|
|
25
|
+
* Quotes and escaped characters are supported, and will be returned as-is.
|
|
26
|
+
* @param input The input command
|
|
27
|
+
* @returns An array of string containing the arguments
|
|
28
|
+
*/
|
|
29
|
+
export function splitCommand(input) {
|
|
30
|
+
const result = [];
|
|
31
|
+
let quote;
|
|
32
|
+
let isEscaped = false;
|
|
33
|
+
let start = 0;
|
|
34
|
+
for (let i = 0, len = input.length; i < len; i += 1) {
|
|
35
|
+
if (isEscaped) {
|
|
36
|
+
isEscaped = false;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const char = input.charAt(i);
|
|
40
|
+
switch (char) {
|
|
41
|
+
case " ":
|
|
42
|
+
if (!quote) {
|
|
43
|
+
if (i !== start) {
|
|
44
|
+
result.push(input.substring(start, i));
|
|
45
|
+
}
|
|
46
|
+
start = i + 1;
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case "'":
|
|
50
|
+
case '"':
|
|
51
|
+
if (!quote) {
|
|
52
|
+
quote = char;
|
|
53
|
+
}
|
|
54
|
+
else if (char === quote) {
|
|
55
|
+
quote = undefined;
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
case "\\":
|
|
59
|
+
isEscaped = true;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (start < input.length) {
|
|
64
|
+
result.push(input.substring(start));
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates a `Promise`-like object that lazily computes the result
|
|
70
|
+
* only when it's being used as a `Promise`.
|
|
71
|
+
*
|
|
72
|
+
* For example, if an API returns a value `p` of type `Promise<T> & { asU(): Promise<U> }`,
|
|
73
|
+
* and the user calls `p.asU()` instead of using it as a `Promise` (`p.then()`, `await p`, etc.),
|
|
74
|
+
* is unnecessary to compute the result `T` (unless `asU` also depends on it).
|
|
75
|
+
*
|
|
76
|
+
* By using `createLazyPromise(computeT, { asU: computeU })`,
|
|
77
|
+
* `computeT` will only run when `p` is used as a `Promise`.
|
|
78
|
+
*
|
|
79
|
+
* Note that the result object can't be returned from an async function,
|
|
80
|
+
* as async functions always creates a new `Promise` with the return value,
|
|
81
|
+
* which runs `initializer` immediately, and discards any extra `methods` attached.
|
|
82
|
+
* @param initializer
|
|
83
|
+
* The initializer function when the result object is being used as a `Promise`.
|
|
84
|
+
*
|
|
85
|
+
* The result value will be cached.
|
|
86
|
+
* @param methods Any extra methods to add to the result object
|
|
87
|
+
* @returns
|
|
88
|
+
* A `Promise`-like object that runs `initializer` when used as a `Promise`, and contains `methods`.
|
|
89
|
+
*/
|
|
90
|
+
export function createLazyPromise(initializer, methods) {
|
|
91
|
+
let promise;
|
|
92
|
+
const getOrCreatePromise = () => {
|
|
93
|
+
if (!promise) {
|
|
94
|
+
promise = initializer();
|
|
95
|
+
}
|
|
96
|
+
return promise;
|
|
97
|
+
};
|
|
98
|
+
const result = {
|
|
99
|
+
// biome-ignore lint/suspicious/noThenProperty: This object is intentionally thenable
|
|
100
|
+
then(onfulfilled, onrejected) {
|
|
101
|
+
return getOrCreatePromise().then(onfulfilled, onrejected);
|
|
102
|
+
},
|
|
103
|
+
// biome-ignore lint/suspicious/noThenProperty: This object is intentionally thenable
|
|
104
|
+
catch(onrejected) {
|
|
105
|
+
return getOrCreatePromise().catch(onrejected);
|
|
106
|
+
},
|
|
107
|
+
// biome-ignore lint/suspicious/noThenProperty: This object is intentionally thenable
|
|
108
|
+
finally(onfinally) {
|
|
109
|
+
return getOrCreatePromise().finally(onfinally);
|
|
110
|
+
},
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
112
|
+
};
|
|
113
|
+
for (const [key, value] of Object.entries(methods)) {
|
|
114
|
+
Object.defineProperty(result, key, {
|
|
115
|
+
configurable: true,
|
|
116
|
+
writable: true,
|
|
117
|
+
enumerable: false,
|
|
118
|
+
value,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
export class ToArrayStream extends AccumulateStream {
|
|
124
|
+
constructor() {
|
|
125
|
+
super([], (chunk, current) => {
|
|
126
|
+
current.push(chunk);
|
|
127
|
+
return current;
|
|
128
|
+
}, (output) => output);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export function decodeUtf8Chunked(chunks) {
|
|
132
|
+
// PERF: `TextDecoder`'s `stream` mode can decode from `chunks` directly.
|
|
133
|
+
// This avoids an extra allocation and copy.
|
|
134
|
+
const decoder = new TextDecoder();
|
|
135
|
+
let output = "";
|
|
136
|
+
for (const chunk of chunks) {
|
|
137
|
+
output += decoder.decode(chunk, { stream: true });
|
|
138
|
+
}
|
|
139
|
+
output += decoder.decode();
|
|
140
|
+
return output;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/service/subprocess/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,SAAS,CAAC,CAAS;IAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,IAAI,GAAG,CAAC;IAEd,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,OAAO,IAAI,EAAE,CAAC;QACV,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,MAAM;QACV,CAAC;QACD,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnC,+CAA+C;QAC/C,mEAAmE;QACnE,MAAM,IAAI,MAAM,CAAC,GAAG,CAAA,MAAM,CAAC;QAC3B,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,IAAI,GAAG,CAAC;IACd,OAAO,MAAM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C,MAAM,EAAE,EAAE,CAAC,MAAM,CACrB,CAAC;IACN,CAAC;CACJ;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAoB;IAClD,yEAAyE;IACzE,4CAA4C;IAC5C,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAC3B,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const LinuxFileType: {
|
|
2
|
+
readonly Directory: 4;
|
|
3
|
+
readonly File: 8;
|
|
4
|
+
readonly Link: 10;
|
|
5
|
+
};
|
|
6
|
+
export type LinuxFileType = (typeof LinuxFileType)[keyof typeof LinuxFileType];
|
|
7
|
+
export declare const AndroidSyscallErrorCode: {
|
|
8
|
+
readonly SUCCESS: 0;
|
|
9
|
+
readonly EACCES: 13;
|
|
10
|
+
readonly EEXIST: 17;
|
|
11
|
+
readonly EFAULT: 14;
|
|
12
|
+
readonly EFBIG: 27;
|
|
13
|
+
readonly EINTR: 4;
|
|
14
|
+
readonly EINVAL: 22;
|
|
15
|
+
readonly EIO: 5;
|
|
16
|
+
readonly EISDIR: 21;
|
|
17
|
+
readonly ELOOP: 40;
|
|
18
|
+
readonly EMFILE: 24;
|
|
19
|
+
readonly ENAMETOOLONG: 36;
|
|
20
|
+
readonly ENFILE: 23;
|
|
21
|
+
readonly ENOENT: 2;
|
|
22
|
+
readonly ENOMEM: 12;
|
|
23
|
+
readonly ENOSPC: 28;
|
|
24
|
+
readonly ENOTDIR: 20;
|
|
25
|
+
readonly EOVERFLOW: 75;
|
|
26
|
+
readonly EPERM: 1;
|
|
27
|
+
readonly EROFS: 30;
|
|
28
|
+
readonly ETXTBSY: 26;
|
|
29
|
+
};
|
|
30
|
+
export type AndroidSyscallErrorCode = (typeof AndroidSyscallErrorCode)[keyof typeof AndroidSyscallErrorCode];
|
|
31
|
+
export declare const AndroidSyscallErrorNameMap: {
|
|
32
|
+
[k: string]: string;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../src/service/sync/android.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;CAsB1B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAC/B,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAE3E,eAAO,MAAM,0BAA0B;;CAM/B,CAAC"}
|