@midscene/android-playground 1.12.2-beta-20260828072235.0 → 1.12.2

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/dist/es/bin.mjs CHANGED
@@ -3,8 +3,7 @@ import { createScrcpyPreviewDescriptor, definePlaygroundPlatform, launchPrepared
3
3
  import { AndroidAgent, AndroidDevice, getConnectedDevicesWithDetails } from "@midscene/android";
4
4
  import { PLAYGROUND_SERVER_PORT, SCRCPY_ADB_CONNECT_TIMEOUT_MS, SCRCPY_PREVIEW_METADATA_TIMEOUT_MS, SCRCPY_PUSH_TIMEOUT_MS, SCRCPY_SERVER_PORT, SCRCPY_START_TIMEOUT_MS, SCRCPY_VIDEO_STREAM_TIMEOUT_MS } from "@midscene/shared/constants";
5
5
  import { findAvailablePort } from "@midscene/shared/node";
6
- import { exec } from "node:child_process";
7
- import { createReadStream } from "node:fs";
6
+ import { execFile } from "node:child_process";
8
7
  import { createServer } from "node:http";
9
8
  import { fileURLToPath } from "node:url";
10
9
  import { promisify } from "node:util";
@@ -225,7 +224,7 @@ function scrcpy_server_define_property(obj, key, value) {
225
224
  return obj;
226
225
  }
227
226
  const debugPage = getDebug('android:playground');
228
- const promiseExec = promisify(exec);
227
+ const promiseExecFile = promisify(execFile);
229
228
  const LOOPBACK_HOSTS = new Set([
230
229
  'localhost',
231
230
  '127.0.0.1',
@@ -326,7 +325,9 @@ class ScrcpyServer {
326
325
  try {
327
326
  if (this.adbClient) debugPage('use existing adb client');
328
327
  else {
329
- await withTimeout(promiseExec('adb start-server'), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
328
+ await withTimeout(promiseExecFile('adb', [
329
+ 'start-server'
330
+ ]), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
330
331
  debugPage('adb server started');
331
332
  debugPage('initialize adb client');
332
333
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -364,13 +365,18 @@ class ScrcpyServer {
364
365
  }
365
366
  async startScrcpy(adb, options = {}, onProgress) {
366
367
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
367
- const { ReadableStream } = await import("@yume-chan/stream-extra");
368
368
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
369
369
  const currentDir = 'undefined' != typeof __dirname ? __dirname : node_path.dirname(fileURLToPath(import.meta.url));
370
370
  const serverBinPath = node_path.resolve(currentDir, '../../bin/scrcpy-server');
371
371
  try {
372
372
  onProgress?.('pushing-server');
373
- await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from(createReadStream(serverBinPath))), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
373
+ await withTimeout(promiseExecFile('adb', [
374
+ '-s',
375
+ adb.serial,
376
+ 'push',
377
+ serverBinPath,
378
+ DefaultServerPath
379
+ ]), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
374
380
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
375
381
  audio: false,
376
382
  control: true,
package/dist/es/index.mjs CHANGED
@@ -3,8 +3,7 @@ import { AndroidAgent, AndroidDevice, getConnectedDevicesWithDetails } from "@mi
3
3
  import { createScrcpyPreviewDescriptor, definePlaygroundPlatform } from "@midscene/playground";
4
4
  import { PLAYGROUND_SERVER_PORT, SCRCPY_ADB_CONNECT_TIMEOUT_MS, SCRCPY_PREVIEW_METADATA_TIMEOUT_MS, SCRCPY_PUSH_TIMEOUT_MS, SCRCPY_SERVER_PORT, SCRCPY_START_TIMEOUT_MS, SCRCPY_VIDEO_STREAM_TIMEOUT_MS } from "@midscene/shared/constants";
5
5
  import { findAvailablePort } from "@midscene/shared/node";
6
- import { exec } from "node:child_process";
7
- import { createReadStream } from "node:fs";
6
+ import { execFile } from "node:child_process";
8
7
  import { createServer } from "node:http";
9
8
  import { fileURLToPath } from "node:url";
10
9
  import { promisify } from "node:util";
@@ -225,7 +224,7 @@ function scrcpy_server_define_property(obj, key, value) {
225
224
  return obj;
226
225
  }
227
226
  const debugPage = getDebug('android:playground');
228
- const promiseExec = promisify(exec);
227
+ const promiseExecFile = promisify(execFile);
229
228
  const LOOPBACK_HOSTS = new Set([
230
229
  'localhost',
231
230
  '127.0.0.1',
@@ -326,7 +325,9 @@ class ScrcpyServer {
326
325
  try {
327
326
  if (this.adbClient) debugPage('use existing adb client');
328
327
  else {
329
- await withTimeout(promiseExec('adb start-server'), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
328
+ await withTimeout(promiseExecFile('adb', [
329
+ 'start-server'
330
+ ]), SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
330
331
  debugPage('adb server started');
331
332
  debugPage('initialize adb client');
332
333
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -364,13 +365,18 @@ class ScrcpyServer {
364
365
  }
365
366
  async startScrcpy(adb, options = {}, onProgress) {
366
367
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
367
- const { ReadableStream } = await import("@yume-chan/stream-extra");
368
368
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
369
369
  const currentDir = 'undefined' != typeof __dirname ? __dirname : node_path.dirname(fileURLToPath(import.meta.url));
370
370
  const serverBinPath = node_path.resolve(currentDir, '../../bin/scrcpy-server');
371
371
  try {
372
372
  onProgress?.('pushing-server');
373
- await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from(createReadStream(serverBinPath))), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
373
+ await withTimeout(promiseExecFile('adb', [
374
+ '-s',
375
+ adb.serial,
376
+ 'push',
377
+ serverBinPath,
378
+ DefaultServerPath
379
+ ]), SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
374
380
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
375
381
  audio: false,
376
382
  control: true,
package/dist/lib/bin.js CHANGED
@@ -162,7 +162,6 @@ const androidPlaygroundPlatform = (0, playground_namespaceObject.definePlaygroun
162
162
  }
163
163
  });
164
164
  const external_node_child_process_namespaceObject = require("node:child_process");
165
- const external_node_fs_namespaceObject = require("node:fs");
166
165
  const external_node_http_namespaceObject = require("node:http");
167
166
  require("node:url");
168
167
  const external_node_util_namespaceObject = require("node:util");
@@ -251,7 +250,7 @@ function scrcpy_server_define_property(obj, key, value) {
251
250
  return obj;
252
251
  }
253
252
  const debugPage = (0, logger_namespaceObject.getDebug)('android:playground');
254
- const promiseExec = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.exec);
253
+ const promiseExecFile = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
255
254
  const LOOPBACK_HOSTS = new Set([
256
255
  'localhost',
257
256
  '127.0.0.1',
@@ -352,7 +351,9 @@ class ScrcpyServer {
352
351
  try {
353
352
  if (this.adbClient) debugPage('use existing adb client');
354
353
  else {
355
- await withTimeout(promiseExec('adb start-server'), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
354
+ await withTimeout(promiseExecFile('adb', [
355
+ 'start-server'
356
+ ]), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
356
357
  debugPage('adb server started');
357
358
  debugPage('initialize adb client');
358
359
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -390,13 +391,18 @@ class ScrcpyServer {
390
391
  }
391
392
  async startScrcpy(adb, options = {}, onProgress) {
392
393
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
393
- const { ReadableStream } = await import("@yume-chan/stream-extra");
394
394
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
395
395
  const currentDir = __dirname;
396
396
  const serverBinPath = external_node_path_default().resolve(currentDir, '../../bin/scrcpy-server');
397
397
  try {
398
398
  onProgress?.('pushing-server');
399
- await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from((0, external_node_fs_namespaceObject.createReadStream)(serverBinPath))), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
399
+ await withTimeout(promiseExecFile('adb', [
400
+ '-s',
401
+ adb.serial,
402
+ 'push',
403
+ serverBinPath,
404
+ DefaultServerPath
405
+ ]), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
400
406
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
401
407
  audio: false,
402
408
  control: true,
package/dist/lib/index.js CHANGED
@@ -177,7 +177,6 @@ const androidPlaygroundPlatform = (0, playground_namespaceObject.definePlaygroun
177
177
  }
178
178
  });
179
179
  const external_node_child_process_namespaceObject = require("node:child_process");
180
- const external_node_fs_namespaceObject = require("node:fs");
181
180
  const external_node_http_namespaceObject = require("node:http");
182
181
  require("node:url");
183
182
  const external_node_util_namespaceObject = require("node:util");
@@ -266,7 +265,7 @@ function scrcpy_server_define_property(obj, key, value) {
266
265
  return obj;
267
266
  }
268
267
  const debugPage = (0, logger_namespaceObject.getDebug)('android:playground');
269
- const promiseExec = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.exec);
268
+ const promiseExecFile = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
270
269
  const LOOPBACK_HOSTS = new Set([
271
270
  'localhost',
272
271
  '127.0.0.1',
@@ -367,7 +366,9 @@ class ScrcpyServer {
367
366
  try {
368
367
  if (this.adbClient) debugPage('use existing adb client');
369
368
  else {
370
- await withTimeout(promiseExec('adb start-server'), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
369
+ await withTimeout(promiseExecFile('adb', [
370
+ 'start-server'
371
+ ]), constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS, `Timed out starting adb server after ${Math.round(constants_namespaceObject.SCRCPY_ADB_CONNECT_TIMEOUT_MS / 1000)}s`);
371
372
  debugPage('adb server started');
372
373
  debugPage('initialize adb client');
373
374
  this.adbClient = new AdbServerClient(new AdbServerNodeTcpConnector({
@@ -405,13 +406,18 @@ class ScrcpyServer {
405
406
  }
406
407
  async startScrcpy(adb, options = {}, onProgress) {
407
408
  const { AdbScrcpyClient, AdbScrcpyOptions3_3_3 } = await import("@yume-chan/adb-scrcpy");
408
- const { ReadableStream } = await import("@yume-chan/stream-extra");
409
409
  const { DefaultServerPath } = await import("@yume-chan/scrcpy");
410
410
  const currentDir = __dirname;
411
411
  const serverBinPath = external_node_path_default().resolve(currentDir, '../../bin/scrcpy-server');
412
412
  try {
413
413
  onProgress?.('pushing-server');
414
- await withTimeout(AdbScrcpyClient.pushServer(adb, ReadableStream.from((0, external_node_fs_namespaceObject.createReadStream)(serverBinPath))), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
414
+ await withTimeout(promiseExecFile('adb', [
415
+ '-s',
416
+ adb.serial,
417
+ 'push',
418
+ serverBinPath,
419
+ DefaultServerPath
420
+ ]), constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS, `Timed out pushing scrcpy server to device after ${Math.round(constants_namespaceObject.SCRCPY_PUSH_TIMEOUT_MS / 1000)}s`);
415
421
  const scrcpyOptions = new AdbScrcpyOptions3_3_3({
416
422
  audio: false,
417
423
  control: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android-playground",
3
- "version": "1.12.2-beta-20260828072235.0",
3
+ "version": "1.12.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/midscene.git",
@@ -39,10 +39,10 @@
39
39
  "express": "^4.21.2",
40
40
  "open": "10.1.0",
41
41
  "socket.io": "^4.8.1",
42
- "@midscene/android": "1.12.2-beta-20260828072235.0",
43
- "@midscene/core": "1.12.2-beta-20260828072235.0",
44
- "@midscene/playground": "1.12.2-beta-20260828072235.0",
45
- "@midscene/shared": "1.12.2-beta-20260828072235.0"
42
+ "@midscene/android": "1.12.2",
43
+ "@midscene/shared": "1.12.2",
44
+ "@midscene/playground": "1.12.2",
45
+ "@midscene/core": "1.12.2"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@rslib/core": "^0.18.3",
@@ -55,7 +55,7 @@
55
55
  "license": "MIT",
56
56
  "scripts": {
57
57
  "dev": "npm run build:watch",
58
- "dev:server": "npm run build && ./bin/playground",
58
+ "dev:server": "npm run build && ./bin/android-playground",
59
59
  "test": "rstest",
60
60
  "prebuild": "node ../android/scripts/download-scrcpy-server.mjs --target=bin/scrcpy-server",
61
61
  "build": "rslib build",
package/static/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><title>Midscene Android Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.574e3de9.js"></script><script defer src="/static/js/226.8c99280b.js"></script><script defer src="/static/js/index.9b4fda3c.js"></script><link href="/static/css/index.67caac18.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html><head><title>Midscene Android Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.574e3de9.js"></script><script defer src="/static/js/226.8c99280b.js"></script><script defer src="/static/js/index.94e51cf0.js"></script><link href="/static/css/index.67caac18.css" rel="stylesheet"></head><body><div id="root"></div></body></html>