@9l/playwright 0.5.5 → 0.6.0-beta

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.
@@ -0,0 +1,24 @@
1
+ export declare const androidVersions: {
2
+ readonly appium: "3.8.0";
3
+ readonly uiautomator2: "8.7.0";
4
+ };
5
+ export declare const androidRuntimeType = "application/vnd.9l.android-runtime+json";
6
+ export type AndroidRuntime = {
7
+ appPackage: string;
8
+ apkSHA256: string;
9
+ api: string;
10
+ release: string;
11
+ abi: string;
12
+ appium: string;
13
+ uiautomator2: string;
14
+ worker: string;
15
+ } & ({
16
+ emulator: string;
17
+ device?: never;
18
+ deviceHash?: never;
19
+ } | {
20
+ device: 'physical';
21
+ deviceHash: string;
22
+ emulator?: never;
23
+ });
24
+ export declare function validAndroidRuntime(value: unknown): value is AndroidRuntime;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.androidRuntimeType = exports.androidVersions = void 0;
4
+ exports.validAndroidRuntime = validAndroidRuntime;
5
+ // Closed, content-free metadata allowed across the native worker bridge.
6
+ exports.androidVersions = { appium: '3.8.0', uiautomator2: '8.7.0' };
7
+ exports.androidRuntimeType = 'application/vnd.9l.android-runtime+json';
8
+ function validAndroidRuntime(value) {
9
+ if (!value || typeof value !== 'object' || Array.isArray(value))
10
+ return false;
11
+ const r = value;
12
+ const keys = ['appPackage', 'apkSHA256', 'api', 'release', 'abi', 'appium', 'uiautomator2', 'worker',
13
+ ...(r.device === 'physical' ? ['device', 'deviceHash'] : ['emulator'])];
14
+ if (Object.keys(r).length !== keys.length || keys.some(key => typeof r[key] !== 'string'))
15
+ return false;
16
+ const text = r;
17
+ const version = /^[0-9]{1,3}(\.[0-9]{1,5}){0,3}$/;
18
+ return text.appPackage.length <= 200 && /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)+$/.test(text.appPackage) &&
19
+ /^[a-f0-9]{64}$/.test(text.apkSHA256) && /^[a-f0-9]{64}$/.test(text.worker) &&
20
+ /^[0-9]{1,3}$/.test(text.api) && version.test(text.release) && (text.device === 'physical' ? /^[a-f0-9]{64}$/.test(text.deviceHash) : version.test(text.emulator)) &&
21
+ text.appium === exports.androidVersions.appium && text.uiautomator2 === exports.androidVersions.uiautomator2 && ['arm64-v8a', 'x86_64'].includes(text.abi);
22
+ }
@@ -0,0 +1,45 @@
1
+ import { type TargetDriver } from './targets';
2
+ export { androidVersions, androidRuntimeType, validAndroidRuntime, type AndroidRuntime } from './android-runtime';
3
+ /** Explicit aliases for apps without resource IDs. All matches remain strict
4
+ * and scoped to the configured package; arbitrary XPath is not accepted. */
5
+ export type AndroidControl = ({
6
+ accessibilityId: string;
7
+ text?: never;
8
+ accessibilityIdSuffix?: never;
9
+ } | {
10
+ text: string;
11
+ accessibilityId?: never;
12
+ accessibilityIdSuffix?: never;
13
+ } | {
14
+ accessibilityIdSuffix: string;
15
+ text?: never;
16
+ accessibilityId?: never;
17
+ }) & {
18
+ className?: string;
19
+ selected?: boolean;
20
+ };
21
+ export type AndroidTargetOptions = {
22
+ appId: string;
23
+ sdkRoot: string;
24
+ toolsRoot: string;
25
+ apkSHA256: string;
26
+ appPackage: string;
27
+ activity: string;
28
+ controls?: Record<string, AndroidControl>;
29
+ } & ({
30
+ avd: string;
31
+ apk: string;
32
+ headless?: boolean;
33
+ deviceSerial?: never;
34
+ } | {
35
+ /** Experimental attachment: installed, single-base APK only. Never resets,
36
+ * reinstalls or terminates the app. Installs the pinned automation helpers. */
37
+ deviceSerial: string;
38
+ avd?: never;
39
+ apk?: never;
40
+ headless?: never;
41
+ });
42
+ /** Optional local Android adapter. Appium/UiAutomator2 owns native automation;
43
+ * Go still owns scheduling/deadlines/receipts and this worker owns all handles.
44
+ * No emulator, server, action or assertion is retried. */
45
+ export declare function androidTargetDriver(options: AndroidTargetOptions): TargetDriver;
@@ -0,0 +1,525 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validAndroidRuntime = exports.androidRuntimeType = exports.androidVersions = void 0;
4
+ exports.androidTargetDriver = androidTargetDriver;
5
+ const node_child_process_1 = require("node:child_process");
6
+ const node_crypto_1 = require("node:crypto");
7
+ const promises_1 = require("node:fs/promises");
8
+ const node_path_1 = require("node:path");
9
+ const node_os_1 = require("node:os");
10
+ const node_net_1 = require("node:net");
11
+ const promises_2 = require("node:timers/promises");
12
+ const protocol_1 = require("./protocol");
13
+ const targets_1 = require("./targets");
14
+ const android_runtime_1 = require("./android-runtime");
15
+ var android_runtime_2 = require("./android-runtime");
16
+ Object.defineProperty(exports, "androidVersions", { enumerable: true, get: function () { return android_runtime_2.androidVersions; } });
17
+ Object.defineProperty(exports, "androidRuntimeType", { enumerable: true, get: function () { return android_runtime_2.androidRuntimeType; } });
18
+ Object.defineProperty(exports, "validAndroidRuntime", { enumerable: true, get: function () { return android_runtime_2.validAndroidRuntime; } });
19
+ const failure = (reason) => new Error(`9lives Android: ${reason}`);
20
+ const elementKey = 'element-6066-11e4-a52e-4f735466cecf';
21
+ const timeout = (c) => {
22
+ c.signal.throwIfAborted();
23
+ if (c.deadlineMs <= Date.now())
24
+ throw failure('deadline');
25
+ return c.deadlineMs - Date.now();
26
+ };
27
+ // Native command output stays in memory and never becomes an error message,
28
+ // diagnostic artifact or receipt. These commands have explicit, fixed arguments.
29
+ function command(file, args, c, env) {
30
+ return new Promise((yes, no) => (0, node_child_process_1.execFile)(file, args, {
31
+ signal: c.signal, timeout: timeout(c), maxBuffer: 64 * 1024, env,
32
+ }, (error, stdout) => error ? no(failure('device_command_failed')) : yes(stdout.trim())));
33
+ }
34
+ async function freePort() {
35
+ const server = (0, node_net_1.createServer)();
36
+ await new Promise((yes, no) => { server.once('error', no); server.listen(0, '127.0.0.1', yes); });
37
+ const port = server.address().port;
38
+ await new Promise((yes, no) => server.close(error => error ? no(error) : yes()));
39
+ return port;
40
+ }
41
+ // The emulator reports its allocated console port to a private local socket
42
+ // before boot. This ties adb's serial to our child without relying on custom
43
+ // Android properties (which modern images may silently omit).
44
+ async function reportedConsole(path, c, start) {
45
+ const sockets = new Set();
46
+ const server = (0, node_net_1.createServer)();
47
+ const signal = AbortSignal.any([c.signal, AbortSignal.timeout(timeout(c))]);
48
+ let abort = () => { };
49
+ let child;
50
+ let exited = () => { };
51
+ try {
52
+ await new Promise((yes, no) => { server.once('error', no); server.listen(path, yes); });
53
+ return await new Promise((yes, no) => {
54
+ abort = () => no(failure('console_handshake_aborted'));
55
+ signal.addEventListener('abort', abort, { once: true });
56
+ server.once('error', no);
57
+ server.on('connection', socket => {
58
+ sockets.add(socket);
59
+ let value = '';
60
+ socket.on('error', () => no(failure('console_handshake_failed')));
61
+ socket.on('data', bytes => {
62
+ value += bytes.toString('ascii');
63
+ if (value.length > 8)
64
+ no(failure('console_handshake_failed'));
65
+ });
66
+ socket.on('end', () => {
67
+ const port = value.trim();
68
+ if (/^[0-9]{4}$/.test(port) && Number(port) >= 5554 && Number(port) <= 5682 && Number(port) % 2 === 0)
69
+ yes(port);
70
+ else
71
+ no(failure('foreign_emulator'));
72
+ });
73
+ });
74
+ if (signal.aborted)
75
+ abort();
76
+ else {
77
+ child = start();
78
+ exited = () => no(failure('emulator_exited_before_console'));
79
+ child.once('error', exited);
80
+ child.once('exit', exited);
81
+ if (child.exitCode !== null || child.signalCode !== null)
82
+ exited();
83
+ }
84
+ });
85
+ }
86
+ finally {
87
+ signal.removeEventListener('abort', abort);
88
+ child?.removeListener('error', exited);
89
+ child?.removeListener('exit', exited);
90
+ for (const socket of sockets)
91
+ socket.destroy();
92
+ if (server.listening)
93
+ await new Promise(yes => server.close(() => yes()));
94
+ }
95
+ }
96
+ async function stop(child) {
97
+ if (!child || !child.pid || child.exitCode !== null || child.signalCode !== null)
98
+ return;
99
+ const exited = new Promise(yes => child.once('exit', () => yes()));
100
+ child.kill('SIGTERM');
101
+ const timer = setTimeout(() => child.kill('SIGKILL'), 1500);
102
+ try {
103
+ await exited;
104
+ }
105
+ finally {
106
+ clearTimeout(timer);
107
+ }
108
+ }
109
+ /** Optional local Android adapter. Appium/UiAutomator2 owns native automation;
110
+ * Go still owns scheduling/deadlines/receipts and this worker owns all handles.
111
+ * No emulator, server, action or assertion is retried. */
112
+ function androidTargetDriver(options) {
113
+ const physical = options.deviceSerial !== undefined;
114
+ const controls = structuredClone(options.controls ?? {});
115
+ if (!/^[a-zA-Z0-9_-]{1,64}$/.test(options.appId) ||
116
+ (physical ? !/^[a-zA-Z0-9_.:-]{1,128}$/.test(options.deviceSerial) || options.deviceSerial.startsWith('emulator-') || options.avd !== undefined || options.apk !== undefined
117
+ : !/^[a-zA-Z0-9_.-]{1,100}$/.test(options.avd)) ||
118
+ !/^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)+$/.test(options.appPackage) ||
119
+ !/^[a-zA-Z0-9_.]+$/.test(options.activity) || !/^[a-f0-9]{64}$/.test(options.apkSHA256))
120
+ throw failure('invalid_configuration');
121
+ if (Object.keys(controls).length > 128)
122
+ throw failure('invalid_controls');
123
+ for (const [id, control] of Object.entries(controls)) {
124
+ if (!/^[a-zA-Z_][a-zA-Z0-9_]{0,127}$/.test(id) || !control ||
125
+ Object.keys(control).some(k => !['text', 'accessibilityId', 'accessibilityIdSuffix', 'className', 'selected'].includes(k)) ||
126
+ [control.text, control.accessibilityId, control.accessibilityIdSuffix].filter(v => v !== undefined).length !== 1 ||
127
+ typeof (control.text ?? control.accessibilityId ?? control.accessibilityIdSuffix) !== 'string' ||
128
+ !/^[^\x00-\x1f\x7f]{1,128}$/.test(control.text ?? control.accessibilityId ?? control.accessibilityIdSuffix) ||
129
+ (control.className !== undefined && !/^android\.(view|widget)\.[A-Za-z]{1,64}$/.test(control.className)) ||
130
+ (control.selected !== undefined && typeof control.selected !== 'boolean'))
131
+ throw failure('invalid_controls');
132
+ }
133
+ const sdk = (0, node_path_1.resolve)(options.sdkRoot), tools = (0, node_path_1.resolve)(options.toolsRoot);
134
+ const adb = (0, node_path_1.join)(sdk, 'platform-tools', 'adb'), emulatorPath = (0, node_path_1.join)(sdk, 'emulator', 'emulator');
135
+ // Explicit environment allowlist: no application/provider credentials reach
136
+ // Appium, adb or the emulator. Go --pass-env remains necessary for test data.
137
+ const env = {};
138
+ for (const key of ['PATH', 'HOME', 'TMPDIR', 'JAVA_HOME', 'SYSTEMROOT'])
139
+ if (process.env[key])
140
+ env[key] = process.env[key];
141
+ env.ANDROID_HOME = sdk;
142
+ env.ANDROID_SDK_ROOT = sdk;
143
+ let emulator, server;
144
+ let directory, serial = '', base = '', session = '';
145
+ let closing, opening, closed = false, evidence;
146
+ const controller = new AbortController();
147
+ const owner = (0, node_crypto_1.randomUUID)();
148
+ let lease, helperOwned = false, systemPort = 0;
149
+ const policies = new Map();
150
+ const mockStore = '/data/local/tmp/mock_apps.json';
151
+ const mockBackup = `/data/local/tmp/9l-${owner}-mock-apps.json`;
152
+ let mockStorePresent, mockPermission;
153
+ const shell = (script) => ['shell', 'sh', '-c', `'${script}'`];
154
+ const installedBuild = async (c) => {
155
+ if (await adbRun(['get-state'], c) !== 'device' || await adbRun(['shell', 'getprop', 'ro.kernel.qemu'], c) === '1')
156
+ throw failure('not_physical_device');
157
+ const path = await adbRun(['shell', 'pm', 'path', options.appPackage], c);
158
+ // Split builds require a digest of the entire installation; fail closed.
159
+ if (!/^package:(\/data\/app\/[A-Za-z0-9_./=+~\-]+\/base\.apk)$/.test(path))
160
+ throw failure('unsupported_installed_build');
161
+ const digest = await adbRun(['shell', 'sha256sum', path.slice(8)], c);
162
+ if (digest.split(/\s+/)[0] !== options.apkSHA256)
163
+ throw failure('apk_digest_mismatch');
164
+ };
165
+ const children = () => [emulator, server].filter((child) => !!child);
166
+ const check = (c) => {
167
+ timeout(c);
168
+ if (closed || children().some(child => child.exitCode !== null || child.signalCode !== null))
169
+ throw failure('runtime_unavailable');
170
+ };
171
+ const adbRun = (args, c) => command(adb, ['-s', serial, ...args], c, env);
172
+ const request = async (path, c, method = 'GET', body) => {
173
+ check(c);
174
+ const signal = AbortSignal.any([c.signal, controller.signal, AbortSignal.timeout(timeout(c))]);
175
+ let response;
176
+ try {
177
+ response = await fetch(`${base}${path}`, { method, signal, headers: { 'content-type': 'application/json' }, ...(body === undefined ? {} : { body: JSON.stringify(body) }) });
178
+ }
179
+ catch {
180
+ throw failure('transport_failed');
181
+ }
182
+ // Bound every response before parsing; never retain or surface server text.
183
+ const reader = response.body?.getReader();
184
+ if (!reader)
185
+ throw failure('invalid_response');
186
+ const route = path.endsWith('/elements') ? 'find' : path.endsWith('/clear') ? 'clear' : path.endsWith('/value') ? 'value' : 'other';
187
+ const chunks = [];
188
+ let size = 0;
189
+ for (;;) {
190
+ const { done, value } = await reader.read();
191
+ if (done)
192
+ break;
193
+ size += value.length;
194
+ if (size > 64 * 1024) {
195
+ await reader.cancel();
196
+ throw failure(`response_limit_${route}`);
197
+ }
198
+ chunks.push(value);
199
+ }
200
+ let data;
201
+ try {
202
+ data = JSON.parse(Buffer.concat(chunks).toString('utf8'));
203
+ }
204
+ catch {
205
+ throw failure('invalid_response');
206
+ }
207
+ if (!response.ok || !data || !Object.hasOwn(data, 'value') || data.value?.error) {
208
+ const known = ['invalid element state', 'invalid selector', 'no such element', 'stale element reference', 'unknown command', 'unsupported operation', 'timeout', 'unknown error'];
209
+ const code = known.includes(data?.value?.error) ? data.value.error.replaceAll(' ', '_') : 'unknown';
210
+ throw failure(`driver_command_failed_${code}`);
211
+ }
212
+ check(c);
213
+ return data.value;
214
+ };
215
+ const endpoint = (path, c, method = 'GET', body) => {
216
+ if (!session)
217
+ throw failure('session_unavailable');
218
+ return request(`/session/${session}${path}`, c, method, body);
219
+ };
220
+ const matches = async (id, c) => {
221
+ if (!/^[a-zA-Z_][a-zA-Z0-9_]{0,127}$/.test(id))
222
+ throw failure('invalid_resource_id');
223
+ const control = Object.hasOwn(controls, id) ? controls[id] : undefined;
224
+ let selector = `new UiSelector().packageName(${JSON.stringify(options.appPackage)})`;
225
+ if (control) {
226
+ if (control.accessibilityIdSuffix !== undefined) {
227
+ const literal = control.accessibilityIdSuffix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
228
+ selector += `.descriptionMatches(${JSON.stringify(`.*${literal}$`)})`;
229
+ }
230
+ else
231
+ selector += control.accessibilityId === undefined ? `.text(${JSON.stringify(control.text)})` : `.description(${JSON.stringify(control.accessibilityId)})`;
232
+ if (control.className)
233
+ selector += `.className(${JSON.stringify(control.className)})`;
234
+ if (control.selected !== undefined)
235
+ selector += `.selected(${control.selected})`;
236
+ }
237
+ const result = await endpoint('/elements', c, 'POST', control ? { using: '-android uiautomator', value: selector } : { using: 'id', value: `${options.appPackage}:id/${id}` });
238
+ if (!Array.isArray(result) || result.length > 512 || result.some(value => typeof value?.[elementKey] !== 'string' || !/^[a-zA-Z0-9_-]{1,128}$/.test(value[elementKey])))
239
+ throw failure('invalid_elements');
240
+ return result.map(value => value[elementKey]);
241
+ };
242
+ const resolveOne = async (id, c) => {
243
+ const result = await matches(id, c);
244
+ if (result.length !== 1)
245
+ throw failure(result.length ? 'ambiguous_resource_id' : 'missing_resource_id');
246
+ return result[0];
247
+ };
248
+ const handle = (id) => ({
249
+ tap: async (c) => { await endpoint(`/element/${await resolveOne(id, c)}/click`, c, 'POST', {}); },
250
+ fill: async (value, c) => {
251
+ const ref = await resolveOne(id, c);
252
+ await endpoint(`/element/${ref}/clear`, c, 'POST', {});
253
+ await endpoint(`/element/${ref}/value`, c, 'POST', { text: value });
254
+ },
255
+ visible: async (c) => {
256
+ const value = await endpoint(`/element/${await resolveOne(id, c)}/displayed`, c);
257
+ if (typeof value !== 'boolean')
258
+ throw failure('invalid_property');
259
+ return value;
260
+ },
261
+ text: async (c) => {
262
+ const value = await endpoint(`/element/${await resolveOne(id, c)}/text`, c);
263
+ if (typeof value !== 'string' || Buffer.byteLength(value) > 4096)
264
+ throw failure('invalid_property');
265
+ return value;
266
+ },
267
+ state: async (name, c) => {
268
+ const value = await endpoint(`/element/${await resolveOne(id, c)}/attribute/${name}`, c);
269
+ if (value !== 'true' && value !== 'false' && typeof value !== 'boolean')
270
+ throw failure('unavailable_state');
271
+ return value === true || value === 'true';
272
+ },
273
+ });
274
+ const cleanup = async () => {
275
+ await Promise.all([stop(emulator), stop(server)]);
276
+ // Aborting HTTP alone cannot stop an already dispatched native action.
277
+ // Only the exclusively leased automation helper is stopped on a phone.
278
+ if (physical && lease) {
279
+ const c = { signal: new AbortController().signal, deadlineMs: Date.now() + 15000 };
280
+ if (helperOwned) {
281
+ for (const pkg of ['io.appium.uiautomator2.server', 'io.appium.uiautomator2.server.test']) {
282
+ await adbRun(['shell', 'am', 'force-stop', pkg], c);
283
+ }
284
+ const alive = await adbRun(['shell', 'sh', '-c', "'pidof io.appium.uiautomator2.server io.appium.uiautomator2.server.test || true'"], c);
285
+ if (alive)
286
+ throw failure('helper_cleanup_failed');
287
+ // Removing only our own forward never touches another device/session.
288
+ if (systemPort) {
289
+ const forwards = await adbRun(['forward', '--list'], c);
290
+ if (forwards.split('\n').some(line => line.split(/\s+/)[0] === serial && line.split(/\s+/)[1] === `tcp:${systemPort}`)) {
291
+ await adbRun(['forward', '--remove', `tcp:${systemPort}`], c);
292
+ }
293
+ }
294
+ if (mockPermission)
295
+ await adbRun(['shell', 'appops', 'set', 'io.appium.settings', 'android:mock_location', mockPermission], c);
296
+ if (mockStorePresent !== undefined) {
297
+ await adbRun(shell(mockStorePresent ? `cp ${mockBackup} ${mockStore} && rm ${mockBackup}` : `rm -f ${mockStore}`), c);
298
+ mockStorePresent = undefined;
299
+ }
300
+ for (const [key, value] of policies) {
301
+ await adbRun(['shell', 'settings', value === 'null' ? 'delete' : 'put', 'global', key, ...(value === 'null' ? [] : [value])], c);
302
+ if (await adbRun(['shell', 'settings', 'get', 'global', key], c) !== value)
303
+ throw failure('policy_restore_failed');
304
+ }
305
+ }
306
+ if (mockStorePresent === true)
307
+ await adbRun(shell(`rm -f ${mockBackup}`), c);
308
+ mockStorePresent = undefined;
309
+ await (0, promises_1.rm)(lease, { recursive: true });
310
+ lease = undefined;
311
+ }
312
+ if (directory)
313
+ await (0, promises_1.rm)(directory, { recursive: true, force: true });
314
+ };
315
+ const close = () => closing ??= (async () => {
316
+ closed = true;
317
+ controller.abort();
318
+ await Promise.all([stop(emulator), stop(server)]);
319
+ await opening?.catch(() => { });
320
+ await cleanup();
321
+ })();
322
+ return {
323
+ kind: 'android', appId: options.appId, version: protocol_1.targetVersion, capabilities: targets_1.targetCapabilities,
324
+ runtime: () => evidence,
325
+ open(context) {
326
+ if (opening || closed)
327
+ return Promise.reject(failure('already_open_or_closed'));
328
+ const c = { ...context, signal: AbortSignal.any([context.signal, controller.signal]) };
329
+ opening = (async () => {
330
+ check(c);
331
+ let stage = 'configuration';
332
+ try {
333
+ let apkBytes;
334
+ if (!physical) {
335
+ const apk = (0, node_path_1.resolve)(options.apk);
336
+ const info = await (0, promises_1.stat)(apk);
337
+ if (!info.isFile() || info.size > 256 * 1024 * 1024)
338
+ throw failure('invalid_apk');
339
+ apkBytes = await (0, promises_1.readFile)(apk);
340
+ if ((0, node_crypto_1.createHash)('sha256').update(apkBytes).digest('hex') !== options.apkSHA256)
341
+ throw failure('apk_digest_mismatch');
342
+ }
343
+ const appiumPkg = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(tools, 'node_modules/appium/package.json'), 'utf8'));
344
+ const driverPkg = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(tools, 'node_modules/appium-uiautomator2-driver/package.json'), 'utf8'));
345
+ if (appiumPkg.version !== android_runtime_1.androidVersions.appium || driverPkg.version !== android_runtime_1.androidVersions.uiautomator2)
346
+ throw failure('driver_version_mismatch');
347
+ const scratch = process.env.NINELIVES_TARGET_SCRATCH_DIR;
348
+ if (!scratch)
349
+ throw failure('missing_owned_scratch');
350
+ directory = await (0, promises_1.mkdtemp)((0, node_path_1.join)(scratch, 'android-'));
351
+ check(c);
352
+ env.APPIUM_HOME = directory;
353
+ env.TMPDIR = directory;
354
+ await (0, promises_1.mkdir)((0, node_path_1.join)(directory, 'node_modules'));
355
+ for (const pkg of ['appium', 'appium-uiautomator2-driver'])
356
+ await (0, promises_1.symlink)((0, node_path_1.join)(tools, 'node_modules', pkg), (0, node_path_1.join)(directory, 'node_modules', pkg), 'dir');
357
+ const installedAPK = (0, node_path_1.join)(directory, 'fixture.apk');
358
+ if (apkBytes) {
359
+ await (0, promises_1.writeFile)(installedAPK, apkBytes, { mode: 0o400 });
360
+ const badging = await command((0, node_path_1.join)(sdk, 'build-tools/35.0.0/aapt2'), ['dump', 'badging', installedAPK], c, env);
361
+ if (/^package: name='([^']+)'/.exec(badging)?.[1] !== options.appPackage)
362
+ throw failure('apk_package_mismatch');
363
+ }
364
+ await (0, promises_1.writeFile)((0, node_path_1.join)(directory, 'package.json'), JSON.stringify({ private: true, dependencies: { appium: android_runtime_1.androidVersions.appium, 'appium-uiautomator2-driver': android_runtime_1.androidVersions.uiautomator2 } }));
365
+ // The emulator atomically reserves its own available console port.
366
+ // Its private handshake binds the reported adb serial to this child.
367
+ check(c);
368
+ if (physical) {
369
+ stage = 'device_attach';
370
+ serial = options.deviceSerial;
371
+ const leaseRoot = (0, node_path_1.join)((0, node_os_1.homedir)(), '.9lives', 'android-leases');
372
+ const lock = (0, node_path_1.join)(leaseRoot, `9l-android-${(0, node_crypto_1.createHash)('sha256').update(serial).digest('hex')}.lock`);
373
+ // Never recover a stale lease automatically: a killed worker may have
374
+ // left automation running. Manual inspection is required in that case.
375
+ await (0, promises_1.mkdir)(leaseRoot, { recursive: true, mode: 0o700 });
376
+ await (0, promises_1.mkdir)(lock, { mode: 0o700 });
377
+ lease = lock;
378
+ await installedBuild(c);
379
+ if (await adbRun(['shell', 'sh', '-c', "'pidof io.appium.uiautomator2.server io.appium.uiautomator2.server.test || true'"], c))
380
+ throw failure('device_automation_in_use');
381
+ for (const key of ['hidden_api_policy_pre_p_apps', 'hidden_api_policy_p_apps', 'hidden_api_policy']) {
382
+ const value = await adbRun(['shell', 'settings', 'get', 'global', key], c);
383
+ if (!/^(null|-1|0|1|2)$/.test(value))
384
+ throw failure('unsupported_policy');
385
+ policies.set(key, value);
386
+ }
387
+ // The pinned Android driver sets mock-location permission on its
388
+ // Settings helper even with skipDeviceInitialization. Preserve the
389
+ // one helper permission and its private index without reading content.
390
+ if (await adbRun(shell('if pm path io.appium.settings >/dev/null 2>&1; then echo present; else echo absent; fi'), c) === 'present') {
391
+ const op = await adbRun(['shell', 'appops', 'get', 'io.appium.settings', 'android:mock_location'], c);
392
+ mockPermission = /(?:MOCK_LOCATION|mock_location): (allow|deny|ignore|default|foreground)/.exec(op)?.[1];
393
+ if (!mockPermission && /^No operations\./.test(op))
394
+ mockPermission = 'default';
395
+ if (!mockPermission)
396
+ throw failure('unsupported_mock_permission');
397
+ }
398
+ const backup = await adbRun(shell(`if [ -f ${mockStore} ]; then cp ${mockStore} ${mockBackup} && echo present; else echo absent; fi`), c);
399
+ if (!['present', 'absent'].includes(backup))
400
+ throw failure('mock_backup_failed');
401
+ mockStorePresent = backup === 'present';
402
+ // Leave only recovery metadata if the host worker is killed. A stale
403
+ // lease blocks reuse rather than silently abandoning device changes.
404
+ await (0, promises_1.writeFile)((0, node_path_1.join)(lease, 'recovery.json'), JSON.stringify({ policies: Object.fromEntries(policies), mockPermission, mockStorePresent, mockBackup }), { mode: 0o600 });
405
+ }
406
+ else {
407
+ stage = 'emulator_boot';
408
+ // AF_UNIX paths on macOS are limited to 104 bytes, including NUL.
409
+ const consoleSocket = (0, node_path_1.join)(directory, 'c');
410
+ if (Buffer.byteLength(consoleSocket) > 103)
411
+ throw failure('scratch_path_too_long');
412
+ const port = await reportedConsole(consoleSocket, c, () => {
413
+ emulator = (0, node_child_process_1.spawn)(emulatorPath, ['-avd', options.avd, '-read-only', '-no-snapshot', '-no-audio', '-report-console', `unix:${consoleSocket}`, ...(options.headless === false ? [] : ['-no-window']), '-gpu', 'swiftshader_indirect'], { env, stdio: 'ignore' });
414
+ emulator.on('error', () => { });
415
+ return emulator;
416
+ });
417
+ serial = `emulator-${port}`;
418
+ for (;;) {
419
+ check(c);
420
+ try {
421
+ const booted = await adbRun(['shell', 'getprop', 'sys.boot_completed'], c);
422
+ if (booted === '1') {
423
+ break;
424
+ }
425
+ }
426
+ catch (error) {
427
+ check(c);
428
+ if (error instanceof Error && error.message.endsWith('foreign_emulator'))
429
+ throw error;
430
+ }
431
+ await (0, promises_2.setTimeout)(250, undefined, { signal: c.signal });
432
+ }
433
+ stage = 'apk_install';
434
+ await adbRun(['install', '--no-streaming', '-r', installedAPK], c);
435
+ }
436
+ const appiumPort = await freePort();
437
+ base = `http://127.0.0.1:${appiumPort}/${owner}`;
438
+ check(c);
439
+ stage = 'server_start';
440
+ server = (0, node_child_process_1.spawn)(process.execPath, [(0, node_path_1.join)(tools, 'node_modules/appium/index.js'), '--address', '127.0.0.1', '--port', String(appiumPort), '--base-path', `/${owner}`, '--use-drivers', 'uiautomator2', '--log-level', 'error', '--log-no-colors'], { env, cwd: directory, stdio: 'ignore' });
441
+ server.on('error', () => { });
442
+ for (;;) {
443
+ check(c);
444
+ try {
445
+ if ((await request('/status', c)).ready === true)
446
+ break;
447
+ }
448
+ catch {
449
+ check(c);
450
+ }
451
+ await (0, promises_2.setTimeout)(100, undefined, { signal: c.signal });
452
+ }
453
+ stage = 'session_start';
454
+ systemPort = await freePort();
455
+ helperOwned = physical;
456
+ const value = await request('/session', c, 'POST', { capabilities: { alwaysMatch: {
457
+ platformName: 'Android', 'appium:automationName': 'UiAutomator2',
458
+ 'appium:udid': serial, 'appium:appPackage': options.appPackage, 'appium:appActivity': options.activity,
459
+ 'appium:systemPort': systemPort, 'appium:noReset': true, 'appium:autoLaunch': true,
460
+ 'appium:printPageSourceOnFindFailure': false, 'appium:skipLogcatCapture': true,
461
+ 'appium:newCommandTimeout': 60, 'appium:uiautomator2ServerReadTimeout': 15000,
462
+ 'appium:showChromedriverLog': false, 'appium:suppressKillServer': true,
463
+ // A deterministic synthetic fixture uses UiAutomator2's empty IME.
464
+ // This does not qualify software-keyboard interaction or layout.
465
+ ...(!physical ? { 'appium:hideKeyboard': true } : {}),
466
+ ...(physical ? {
467
+ 'appium:fullReset': false, 'appium:dontStopAppOnReset': true,
468
+ 'appium:forceAppLaunch': false, 'appium:shouldTerminateApp': false,
469
+ 'appium:skipDeviceInitialization': true, 'appium:skipUnlock': true,
470
+ 'appium:autoGrantPermissions': false,
471
+ } : {}),
472
+ 'appium:settings[waitForIdleTimeout]': 1000,
473
+ }, firstMatch: [{}] } });
474
+ stage = 'session_identity';
475
+ const returnedUDID = value.capabilities?.['appium:udid'] ?? value.capabilities?.udid;
476
+ if (value.capabilities?.['appium:udid'] !== undefined && value.capabilities?.udid !== undefined && value.capabilities['appium:udid'] !== value.capabilities.udid)
477
+ throw failure('foreign_session');
478
+ if (typeof value.sessionId !== 'string' || !/^[a-zA-Z0-9-]{1,128}$/.test(value.sessionId) || returnedUDID !== serial)
479
+ throw failure('foreign_session');
480
+ session = value.sessionId;
481
+ stage = 'runtime_identity';
482
+ let identity;
483
+ if (physical) {
484
+ await installedBuild(c);
485
+ await adbRun(['shell', 'am', 'start', '-W', '-n', `${options.appPackage}/${options.activity}`], c);
486
+ identity = { device: 'physical', deviceHash: (0, node_crypto_1.createHash)('sha256').update(serial).digest('hex') };
487
+ }
488
+ else {
489
+ const emulatorVersion = await command(emulatorPath, ['-version'], c, env);
490
+ const version = /Android emulator version ([0-9.]+)/.exec(emulatorVersion)?.[1];
491
+ if (!version)
492
+ throw failure('unknown_emulator_version');
493
+ identity = { emulator: version };
494
+ }
495
+ evidence = {
496
+ appPackage: options.appPackage, apkSHA256: options.apkSHA256,
497
+ api: await adbRun(['shell', 'getprop', 'ro.build.version.sdk'], c),
498
+ release: await adbRun(['shell', 'getprop', 'ro.build.version.release'], c),
499
+ abi: await adbRun(['shell', 'getprop', 'ro.product.cpu.abi'], c),
500
+ ...identity, ...android_runtime_1.androidVersions, worker: (0, node_crypto_1.createHash)('sha256').update(`${owner}:${process.pid}`).digest('hex'),
501
+ };
502
+ }
503
+ catch {
504
+ closed = true;
505
+ await cleanup();
506
+ throw failure(`open_failed_${stage}`);
507
+ }
508
+ })();
509
+ return opening;
510
+ },
511
+ async reset(c) {
512
+ if (physical)
513
+ throw failure('reset_unsupported_on_attached_device');
514
+ check(c);
515
+ if (!session)
516
+ throw failure('session_unavailable');
517
+ await adbRun(['shell', 'am', 'force-stop', options.appPackage], c);
518
+ if (await adbRun(['shell', 'pm', 'clear', options.appPackage], c) !== 'Success')
519
+ throw failure('reset_failed');
520
+ await adbRun(['shell', 'am', 'start', '-W', '-n', `${options.appPackage}/${options.activity}`], c);
521
+ },
522
+ async observeTestId(id, c) { return (await matches(id, c)).slice(0, 2).map(() => handle(id)); },
523
+ close,
524
+ };
525
+ }
@@ -6,7 +6,7 @@ export declare const targetVersion = "9l.target/1";
6
6
  export declare const targetStepFile: string;
7
7
  export declare function selectedTarget(env?: NodeJS.ProcessEnv): {
8
8
  name: string;
9
- kind: "web" | "android-fake";
9
+ kind: "web" | "android-fake" | "android";
10
10
  appId: string;
11
11
  id: string;
12
12
  };
package/dist/protocol.js CHANGED
@@ -19,8 +19,8 @@ exports.targetVersion = '9l.target/1';
19
19
  exports.targetStepFile = (0, node_fs_1.realpathSync)((0, node_path_1.join)(__dirname, 'targets.js'));
20
20
  function selectedTarget(env = process.env) {
21
21
  const name = env.NINELIVES_TARGET;
22
- if (!name || !/^(web|android-fake):[a-zA-Z0-9_-]{1,64}$/.test(name)) {
23
- throw new Error('9lives target requires --sdk --target web:<app-alias> or android-fake:<app-alias>');
22
+ if (!name || !/^(web|android-fake|android):[a-zA-Z0-9_-]{1,64}$/.test(name)) {
23
+ throw new Error('9lives target requires --sdk --target web:<app-alias>, android:<app-alias> or android-fake:<app-alias>');
24
24
  }
25
25
  const [kind, appId] = name.split(':');
26
26
  return { name, kind, appId, id: (0, node_crypto_1.createHash)('sha256').update(name).digest('hex') };
package/dist/reporter.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const node_crypto_1 = require("node:crypto");
4
4
  const node_fs_1 = require("node:fs");
5
5
  const protocol_1 = require("./protocol");
6
+ const android_runtime_1 = require("./android-runtime");
6
7
  function insideAssertion(step) {
7
8
  for (let ancestor = step.parent; ancestor; ancestor = ancestor.parent) {
8
9
  if (ancestor.category === 'expect')
@@ -76,6 +77,27 @@ class EngineReporter {
76
77
  this.emit('engine_error');
77
78
  return;
78
79
  }
80
+ for (const attachment of result.attachments) {
81
+ if (attachment.name !== '9l.android-runtime')
82
+ continue;
83
+ if (this.target?.kind !== 'android' || attachment.contentType !== android_runtime_1.androidRuntimeType || !attachment.body || attachment.body.length > 2048) {
84
+ this.emit('engine_error');
85
+ return;
86
+ }
87
+ let runtime;
88
+ try {
89
+ runtime = JSON.parse(attachment.body.toString('utf8'));
90
+ }
91
+ catch {
92
+ this.emit('engine_error');
93
+ return;
94
+ }
95
+ if (!(0, android_runtime_1.validAndroidRuntime)(runtime)) {
96
+ this.emit('engine_error');
97
+ return;
98
+ }
99
+ this.emit('target_runtime', { testId: this.testId(test), retry: result.retry, runtime });
100
+ }
79
101
  this.emit('test_end', {
80
102
  testId: this.testId(test), retry: result.retry, status: result.status, expectedStatus: test.expectedStatus,
81
103
  artifacts: result.attachments.map((attachment, index) => ({
package/dist/targets.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { type Page } from '@playwright/test';
2
2
  import { targetVersion } from './protocol';
3
+ import { type AndroidRuntime } from './android-runtime';
3
4
  export declare const targetCapabilities: readonly ["open", "reset", "test-id", "tap", "fill", "visible", "text", "state"];
4
5
  export type TargetIdentity = {
5
- kind: 'web' | 'android-fake';
6
+ kind: 'web' | 'android-fake' | 'android';
6
7
  appId: string;
7
8
  };
8
9
  export type TargetContext = {
@@ -32,8 +33,9 @@ export interface TargetDriver extends TargetIdentity {
32
33
  /** Observe at most two matches; two means ambiguous and must fail. */
33
34
  observeTestId(id: string, context: TargetContext): Promise<readonly TargetHandle[]>;
34
35
  close(): Promise<void>;
36
+ runtime?(): AndroidRuntime | undefined;
35
37
  }
36
- /** Deterministic shared operations. No semantic judge, replay or native driver. */
38
+ /** Deterministic shared operations; browser/device handles stay in the worker. */
37
39
  export declare class TargetApp {
38
40
  private driver;
39
41
  private options;
package/dist/targets.js CHANGED
@@ -6,6 +6,7 @@ exports.createTargetTest = createTargetTest;
6
6
  const test_1 = require("@playwright/test");
7
7
  const promises_1 = require("node:timers/promises");
8
8
  const protocol_1 = require("./protocol");
9
+ const android_runtime_1 = require("./android-runtime");
9
10
  exports.targetCapabilities = ['open', 'reset', 'test-id', 'tap', 'fill', 'visible', 'text', 'state'];
10
11
  const defaultOperationMs = 5_000;
11
12
  const defaultAssertionMs = 5_000;
@@ -24,7 +25,7 @@ class TargetStopped extends Error {
24
25
  }
25
26
  const stopped = (reason, cause) => new TargetStopped(reason, cause);
26
27
  const boundedText = (value, max) => typeof value === 'string' && Buffer.byteLength(value) <= max;
27
- /** Deterministic shared operations. No semantic judge, replay or native driver. */
28
+ /** Deterministic shared operations; browser/device handles stay in the worker. */
28
29
  class TargetApp {
29
30
  driver;
30
31
  options;
@@ -79,7 +80,7 @@ class TargetApp {
79
80
  }
80
81
  /** Permanently stop this session, including a pending mutation. */
81
82
  cancel() { this.stop('canceled'); }
82
- async perform(operation, body, timeoutMs = defaultOperationMs) {
83
+ async perform(operation, body, timeoutMs = defaultOperationMs, maxTimeoutMs = maxOperationMs, deadlineReason = () => 'deadline') {
83
84
  // The SDK location marks this as a typed target step for the reporter.
84
85
  return test_1.test.step(`9l target ${operation}`, async () => {
85
86
  if (this.controller.signal.aborted)
@@ -88,7 +89,7 @@ class TargetApp {
88
89
  this.stop('concurrent_operation');
89
90
  throw stopped(this.reason);
90
91
  }
91
- if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > maxOperationMs) {
92
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > maxTimeoutMs) {
92
93
  this.stop('invalid_timeout', false);
93
94
  throw stopped(this.reason);
94
95
  }
@@ -99,15 +100,19 @@ class TargetApp {
99
100
  let settled = false;
100
101
  void work.then(() => { settled = true; }, () => { settled = true; });
101
102
  // Abort and reject at the deadline: a late result never succeeds. The
102
- // grace only decides whether to close the driver, if work is still pending.
103
- const timer = setTimeout(() => {
104
- this.stop('deadline', false);
105
- setTimeout(() => { if (!settled)
106
- this.release(); }, settleMs);
107
- }, Math.max(0, deadlineMs - Date.now()));
103
+ // Android close stops native work; web retains its artifact-preservation grace.
104
+ const expire = () => {
105
+ this.stop(deadlineMs < this.options.deadlineMs ? deadlineReason() : 'deadline', false);
106
+ if (this.driver.kind === 'android')
107
+ this.release();
108
+ else
109
+ setTimeout(() => { if (!settled)
110
+ this.release(); }, settleMs);
111
+ };
112
+ const timer = setTimeout(expire, Math.max(0, deadlineMs - Date.now()));
108
113
  let abort = () => { };
109
114
  try {
110
- return await Promise.race([
115
+ const result = await Promise.race([
111
116
  work,
112
117
  new Promise((_, reject) => {
113
118
  abort = () => reject(stopped(this.reason));
@@ -116,10 +121,19 @@ class TargetApp {
116
121
  abort();
117
122
  }),
118
123
  ]);
124
+ // A driver completion can run before an overdue timer. Enforce the
125
+ // bound here too, so late success or transport failure cannot win.
126
+ if (!signal.aborted && Date.now() >= deadlineMs)
127
+ expire();
128
+ if (signal.aborted)
129
+ throw stopped(this.reason);
130
+ return result;
119
131
  }
120
132
  catch (error) {
121
133
  // Keep the first reason (deadline, cancellation, a missing control...)
122
134
  // and the local cause. Neither crosses the engine bridge.
135
+ if (!signal.aborted && Date.now() >= deadlineMs)
136
+ expire();
123
137
  if (signal.aborted)
124
138
  throw error instanceof TargetStopped ? error : stopped(this.reason, error);
125
139
  this.stop(error instanceof TargetStopped ? error.reason : 'operation_failed', false);
@@ -132,7 +146,17 @@ class TargetApp {
132
146
  }
133
147
  }, { location: stepLocation });
134
148
  }
135
- open(options = {}) { return this.perform('open', context => this.driver.open(context), options.timeoutMs); }
149
+ open(options = {}) {
150
+ return this.perform('open', async (context) => {
151
+ await this.driver.open(context);
152
+ if (this.driver.kind === 'android') {
153
+ const runtime = this.driver.runtime?.();
154
+ if (!(0, android_runtime_1.validAndroidRuntime)(runtime))
155
+ throw stopped('missing_android_runtime');
156
+ await test_1.test.info().attach('9l.android-runtime', { body: Buffer.from(JSON.stringify(runtime)), contentType: android_runtime_1.androidRuntimeType });
157
+ }
158
+ }, options.timeoutMs ?? (this.driver.kind === 'android' ? 180_000 : undefined), this.driver.kind === 'android' ? 180_000 : maxOperationMs);
159
+ }
136
160
  reset(options = {}) { return this.perform('reset', context => this.driver.reset(context), options.timeoutMs); }
137
161
  getByTestId(id) {
138
162
  const observe = async (context) => {
@@ -150,30 +174,43 @@ class TargetApp {
150
174
  throw stopped('missing_test_id');
151
175
  return handle;
152
176
  };
153
- const assertion = (operation, check, timeoutMs = defaultAssertionMs) => this.perform(operation, async (context) => {
154
- // At most maxObservations polls within the bound; the poll ends before
155
- // the deadline so a false assertion fails by itself.
156
- const interval = Math.max(25, Math.ceil(timeoutMs / maxObservations));
157
- let last;
158
- for (let poll = 0; poll < maxObservations; poll++) {
159
- context.signal.throwIfAborted();
160
- try {
161
- const handle = await observe(context);
162
- if (handle && await check(handle, context))
163
- return;
177
+ const assertion = (operation, check, timeoutMs = defaultAssertionMs) => {
178
+ let observedFalse = false;
179
+ return this.perform(operation, async (context) => {
180
+ // A completed mismatch is an assertion failure at this polling bound,
181
+ // even if a later read stalls. Without one, a deadline is inconclusive.
182
+ const interval = Math.max(25, Math.ceil(timeoutMs / maxObservations));
183
+ let last;
184
+ for (let poll = 0; poll < maxObservations; poll++) {
185
+ context.signal.throwIfAborted();
186
+ try {
187
+ const handle = await observe(context);
188
+ if (handle) {
189
+ if (await check(handle, context))
190
+ return;
191
+ }
192
+ // A completed empty observation is also a failed assertion.
193
+ observedFalse = true;
194
+ }
195
+ catch (error) {
196
+ // Ambiguity, invalid input and cancellation are not transient.
197
+ if (error instanceof TargetStopped || context.signal.aborted)
198
+ throw error;
199
+ last = error;
200
+ }
201
+ if (Date.now() + interval >= context.deadlineMs)
202
+ break;
203
+ await (0, promises_1.setTimeout)(interval, undefined, { signal: context.signal });
164
204
  }
165
- catch (error) {
166
- // Ambiguity, invalid input and cancellation are not transient.
167
- if (error instanceof TargetStopped || context.signal.aborted)
168
- throw error;
169
- last = error;
170
- }
171
- if (Date.now() + interval >= context.deadlineMs)
172
- break;
173
- await (0, promises_1.setTimeout)(interval, undefined, { signal: context.signal });
174
- }
175
- throw stopped('assertion_failed', last);
176
- }, timeoutMs);
205
+ if (observedFalse)
206
+ throw stopped('assertion_failed', last);
207
+ // Failed reads alone establish no business mismatch. Keep their
208
+ // operation failure distinct from an executed false comparison.
209
+ if (last !== undefined)
210
+ throw last;
211
+ throw stopped('deadline');
212
+ }, timeoutMs, maxOperationMs, () => observedFalse ? 'assertion_failed' : 'deadline');
213
+ };
177
214
  return {
178
215
  tap: (options = {}) => this.perform('tap', async (context) => (await required(context)).tap(context), options.timeoutMs),
179
216
  fill: (value, options = {}) => this.perform('fill', async (context) => {
@@ -266,7 +303,7 @@ function createTargetTest(options) {
266
303
  return test_1.test.extend({ app: async ({}, use, info) => {
267
304
  const target = resolve();
268
305
  owned(target, info);
269
- if (target.kind !== 'android-fake' || !options.native)
306
+ if ((target.kind !== 'android-fake' && target.kind !== 'android') || !options.native)
270
307
  throw stopped('unsupported_target');
271
308
  await useApp(target, options.native(target), use);
272
309
  } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@9l/playwright",
3
- "version": "0.5.5",
3
+ "version": "0.6.0-beta",
4
4
  "description": "Playwright fixtures and the versioned 9lives Go engine bridge",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/Quality-Max/9lives-runner#local-playwright-sdk",
@@ -15,7 +15,8 @@
15
15
  "types": "dist/index.d.ts",
16
16
  "exports": {
17
17
  ".": {"types": "./dist/index.d.ts", "default": "./dist/index.js"},
18
- "./reporter": {"types": "./dist/reporter.d.ts", "default": "./dist/reporter.js"}
18
+ "./reporter": {"types": "./dist/reporter.d.ts", "default": "./dist/reporter.js"},
19
+ "./android": {"types": "./dist/android.d.ts", "default": "./dist/android.js"}
19
20
  },
20
21
  "files": ["dist", "LICENSE", "NOTICE", "README.md"],
21
22
  "scripts": {"build": "tsc -p tsconfig.json"},