@lynx-js/devtool-connector 0.17.0 → 0.18.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lynx-js/devtool-connector
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add an optional `schema` to `Connector.openApp`, including daemon forwarding. Android opens the schema directly in the requested app, with shell-safe URL handling, instead of launching its default activity. Other transports ignore the option unless supported.
8
+
3
9
  ## 0.17.0
4
10
 
5
11
  ### Patch Changes
package/dist/2.js CHANGED
@@ -1659,7 +1659,7 @@ const DAEMON_SHUTDOWN_PATH = `${DAEMON_WS_PATH}/shutdown`;
1659
1659
  const DAEMON_INSPECTOR_PATH = `${DAEMON_WS_PATH}/inspector`;
1660
1660
  const DAEMON_COMMAND_PATH_PREFIX = "/command/";
1661
1661
  var package_namespaceObject = {
1662
- rE: "0.17.0"
1662
+ rE: "0.18.0"
1663
1663
  };
1664
1664
  const CONNECTOR_VERSION = package_namespaceObject.rE;
1665
1665
  const node_modules_semver = __webpack_require__("../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js");
package/dist/f1.js CHANGED
@@ -503,7 +503,8 @@ class DaemonTransport {
503
503
  await this.#controlRequest("openApp", {
504
504
  deviceId,
505
505
  packageName,
506
- withDataCleared: options?.withDataCleared
506
+ withDataCleared: options?.withDataCleared,
507
+ schema: options?.schema
507
508
  });
508
509
  }
509
510
  async listClients() {
package/dist/h.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AdbServerClient } from "@yume-chan/adb";
1
+ import { AdbServerClient, escapeArg } from "@yume-chan/adb";
2
2
  import node_net, { Server, Socket } from "node:net";
3
3
  import node_os, { platform } from "node:os";
4
4
  import { TransformStream as web_TransformStream, WritableStream as web_WritableStream } from "node:stream/web";
@@ -9043,7 +9043,7 @@ class AndroidTransport {
9043
9043
  throw error;
9044
9044
  }
9045
9045
  }
9046
- async openApp(deviceId, packageName, { withDataCleared } = {}) {
9046
+ async openApp(deviceId, packageName, { withDataCleared, schema } = {}) {
9047
9047
  const env = {
9048
9048
  stack: [],
9049
9049
  error: void 0,
@@ -9067,17 +9067,33 @@ class AndroidTransport {
9067
9067
  ]);
9068
9068
  android_debug(`openApp clear data output ${output}`);
9069
9069
  }
9070
- const knownActivity = this.getKnownApp(packageName)?.activityName;
9071
- let componentName = knownActivity ? `${packageName}/${knownActivity}` : void 0;
9072
- if (!componentName) {
9073
- const queryOutput = await spawnWaitText(adb, createQueryLauncherActivitiesCommandArgs(packageName));
9074
- android_debug(`openApp launcher activities output ${queryOutput}`);
9075
- [componentName] = parseLauncherActivityComponents(queryOutput);
9070
+ let command;
9071
+ if (schema) command = [
9072
+ "am",
9073
+ "start",
9074
+ "-W",
9075
+ "-S",
9076
+ "-a",
9077
+ "android.intent.action.VIEW",
9078
+ "-d",
9079
+ escapeArg(schema),
9080
+ "-p",
9081
+ packageName
9082
+ ];
9083
+ else {
9084
+ const knownActivity = this.getKnownApp(packageName)?.activityName;
9085
+ let componentName = knownActivity ? `${packageName}/${knownActivity}` : void 0;
9086
+ if (!componentName) {
9087
+ const queryOutput = await spawnWaitText(adb, createQueryLauncherActivitiesCommandArgs(packageName));
9088
+ android_debug(`openApp launcher activities output ${queryOutput}`);
9089
+ [componentName] = parseLauncherActivityComponents(queryOutput);
9090
+ }
9091
+ if (!componentName) throw new Error(`No launchable activity found for package ${packageName}.`);
9092
+ command = createOpenAppCommandArgs(componentName);
9076
9093
  }
9077
- if (!componentName) throw new Error(`No launchable activity found for package ${packageName}.`);
9078
- const output = await spawnWaitText(adb, createOpenAppCommandArgs(componentName));
9079
- android_debug(`openApp LAUNCHER output ${output}`);
9080
- if (output.includes("Error: Activity not started") || output.includes("unable to resolve Intent") || /Error type \d+/u.test(output)) throw new Error(`Failed to open app ${packageName}: ${output.trim()}`);
9094
+ const output = await spawnWaitText(adb, command);
9095
+ android_debug(`openApp output ${output}`);
9096
+ if (output.includes("Error:") || output.includes("unable to resolve Intent") || /Error type \d+/u.test(output)) throw new Error(`Failed to open app ${packageName}: ${output.trim()}`);
9081
9097
  } catch (e) {
9082
9098
  env.error = e;
9083
9099
  env.hasError = true;
package/dist/t.js CHANGED
@@ -995,7 +995,8 @@ class DevtoolDaemon {
995
995
  if (!p.deviceId || !p.packageName) throw new Error("deviceId and packageName are required");
996
996
  const transport = await this.#findTransportWithDeviceId(p.deviceId);
997
997
  await transport.openApp(p.deviceId, p.packageName, {
998
- withDataCleared: p.withDataCleared
998
+ withDataCleared: p.withDataCleared,
999
+ schema: p.schema
999
1000
  });
1000
1001
  result = null;
1001
1002
  break;
@@ -19,5 +19,5 @@ export declare class AndroidTransport implements Transport {
19
19
  } | undefined;
20
20
  listAvailableApps(deviceId: string): Promise<App[]>;
21
21
  getAppIcon(deviceId: string, packageName: string): Promise<AppIcon>;
22
- openApp(deviceId: string, packageName: string, { withDataCleared }?: OpenAppOptions): Promise<void>;
22
+ openApp(deviceId: string, packageName: string, { withDataCleared, schema }?: OpenAppOptions): Promise<void>;
23
23
  }
@@ -10,6 +10,8 @@ export declare function requireNumericPort(port: ClientTarget): number;
10
10
  export interface OpenAppOptions {
11
11
  signal?: AbortSignal;
12
12
  withDataCleared?: boolean | undefined;
13
+ /** Open a deep link instead of the launcher on supported transports; ignored otherwise. */
14
+ schema?: string | undefined;
13
15
  }
14
16
  export interface Transport {
15
17
  close(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/devtool-connector",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lynx-community/skills.git",