react-native-ai-devtools 1.1.4
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 +32 -0
- package/README.md +1250 -0
- package/build/__tests__/helpers/fake-cdp-server.d.ts +56 -0
- package/build/__tests__/helpers/fake-cdp-server.d.ts.map +1 -0
- package/build/__tests__/helpers/fake-cdp-server.js +108 -0
- package/build/__tests__/helpers/fake-cdp-server.js.map +1 -0
- package/build/__tests__/integration/connection-health.test.d.ts +2 -0
- package/build/__tests__/integration/connection-health.test.d.ts.map +1 -0
- package/build/__tests__/integration/connection-health.test.js +151 -0
- package/build/__tests__/integration/connection-health.test.js.map +1 -0
- package/build/__tests__/integration/execute-in-app.test.d.ts +2 -0
- package/build/__tests__/integration/execute-in-app.test.d.ts.map +1 -0
- package/build/__tests__/integration/execute-in-app.test.js +115 -0
- package/build/__tests__/integration/execute-in-app.test.js.map +1 -0
- package/build/__tests__/integration/tools.test.d.ts +2 -0
- package/build/__tests__/integration/tools.test.d.ts.map +1 -0
- package/build/__tests__/integration/tools.test.js +228 -0
- package/build/__tests__/integration/tools.test.js.map +1 -0
- package/build/__tests__/setup.d.ts +2 -0
- package/build/__tests__/setup.d.ts.map +1 -0
- package/build/__tests__/setup.js +11 -0
- package/build/__tests__/setup.js.map +1 -0
- package/build/__tests__/unit/bundle.test.d.ts +2 -0
- package/build/__tests__/unit/bundle.test.d.ts.map +1 -0
- package/build/__tests__/unit/bundle.test.js +53 -0
- package/build/__tests__/unit/bundle.test.js.map +1 -0
- package/build/__tests__/unit/connection-health.test.d.ts +2 -0
- package/build/__tests__/unit/connection-health.test.d.ts.map +1 -0
- package/build/__tests__/unit/connection-health.test.js +28 -0
- package/build/__tests__/unit/connection-health.test.js.map +1 -0
- package/build/__tests__/unit/executor.test.d.ts +2 -0
- package/build/__tests__/unit/executor.test.d.ts.map +1 -0
- package/build/__tests__/unit/executor.test.js +79 -0
- package/build/__tests__/unit/executor.test.js.map +1 -0
- package/build/__tests__/unit/logs.test.d.ts +2 -0
- package/build/__tests__/unit/logs.test.d.ts.map +1 -0
- package/build/__tests__/unit/logs.test.js +81 -0
- package/build/__tests__/unit/logs.test.js.map +1 -0
- package/build/__tests__/unit/metro.test.d.ts +2 -0
- package/build/__tests__/unit/metro.test.d.ts.map +1 -0
- package/build/__tests__/unit/metro.test.js +61 -0
- package/build/__tests__/unit/metro.test.js.map +1 -0
- package/build/__tests__/unit/network.test.d.ts +2 -0
- package/build/__tests__/unit/network.test.d.ts.map +1 -0
- package/build/__tests__/unit/network.test.js +102 -0
- package/build/__tests__/unit/network.test.js.map +1 -0
- package/build/__tests__/unit/tap.test.d.ts +2 -0
- package/build/__tests__/unit/tap.test.d.ts.map +1 -0
- package/build/__tests__/unit/tap.test.js +157 -0
- package/build/__tests__/unit/tap.test.js.map +1 -0
- package/build/core/android.d.ts +265 -0
- package/build/core/android.d.ts.map +1 -0
- package/build/core/android.js +1413 -0
- package/build/core/android.js.map +1 -0
- package/build/core/bundle.d.ts +49 -0
- package/build/core/bundle.d.ts.map +1 -0
- package/build/core/bundle.js +368 -0
- package/build/core/bundle.js.map +1 -0
- package/build/core/connection.d.ts +43 -0
- package/build/core/connection.d.ts.map +1 -0
- package/build/core/connection.js +963 -0
- package/build/core/connection.js.map +1 -0
- package/build/core/connectionState.d.ts +108 -0
- package/build/core/connectionState.d.ts.map +1 -0
- package/build/core/connectionState.js +284 -0
- package/build/core/connectionState.js.map +1 -0
- package/build/core/errorScreenParser.d.ts +30 -0
- package/build/core/errorScreenParser.d.ts.map +1 -0
- package/build/core/errorScreenParser.js +198 -0
- package/build/core/errorScreenParser.js.map +1 -0
- package/build/core/executor.d.ts +113 -0
- package/build/core/executor.d.ts.map +1 -0
- package/build/core/executor.js +1877 -0
- package/build/core/executor.js.map +1 -0
- package/build/core/format.d.ts +8 -0
- package/build/core/format.d.ts.map +1 -0
- package/build/core/format.js +34 -0
- package/build/core/format.js.map +1 -0
- package/build/core/guides.d.ts +14 -0
- package/build/core/guides.d.ts.map +1 -0
- package/build/core/guides.js +261 -0
- package/build/core/guides.js.map +1 -0
- package/build/core/httpServer.d.ts +14 -0
- package/build/core/httpServer.d.ts.map +1 -0
- package/build/core/httpServer.js +2459 -0
- package/build/core/httpServer.js.map +1 -0
- package/build/core/httpServerProcess.d.ts +25 -0
- package/build/core/httpServerProcess.d.ts.map +1 -0
- package/build/core/httpServerProcess.js +153 -0
- package/build/core/httpServerProcess.js.map +1 -0
- package/build/core/index.d.ts +25 -0
- package/build/core/index.d.ts.map +1 -0
- package/build/core/index.js +53 -0
- package/build/core/index.js.map +1 -0
- package/build/core/ios.d.ts +214 -0
- package/build/core/ios.d.ts.map +1 -0
- package/build/core/ios.js +1232 -0
- package/build/core/ios.js.map +1 -0
- package/build/core/logs.d.ts +43 -0
- package/build/core/logs.d.ts.map +1 -0
- package/build/core/logs.js +144 -0
- package/build/core/logs.js.map +1 -0
- package/build/core/metro.d.ts +23 -0
- package/build/core/metro.d.ts.map +1 -0
- package/build/core/metro.js +96 -0
- package/build/core/metro.js.map +1 -0
- package/build/core/network.d.ts +43 -0
- package/build/core/network.d.ts.map +1 -0
- package/build/core/network.js +217 -0
- package/build/core/network.js.map +1 -0
- package/build/core/networkInterceptor.d.ts +3 -0
- package/build/core/networkInterceptor.d.ts.map +1 -0
- package/build/core/networkInterceptor.js +203 -0
- package/build/core/networkInterceptor.js.map +1 -0
- package/build/core/ocr.d.ts +69 -0
- package/build/core/ocr.d.ts.map +1 -0
- package/build/core/ocr.js +212 -0
- package/build/core/ocr.js.map +1 -0
- package/build/core/state.d.ts +17 -0
- package/build/core/state.d.ts.map +1 -0
- package/build/core/state.js +50 -0
- package/build/core/state.js.map +1 -0
- package/build/core/tap.d.ts +91 -0
- package/build/core/tap.d.ts.map +1 -0
- package/build/core/tap.js +542 -0
- package/build/core/tap.js.map +1 -0
- package/build/core/telemetry.d.ts +4 -0
- package/build/core/telemetry.d.ts.map +1 -0
- package/build/core/telemetry.js +289 -0
- package/build/core/telemetry.js.map +1 -0
- package/build/core/types.d.ts +134 -0
- package/build/core/types.d.ts.map +1 -0
- package/build/core/types.js +2 -0
- package/build/core/types.js.map +1 -0
- package/build/httpServerStandalone.d.ts +7 -0
- package/build/httpServerStandalone.d.ts.map +1 -0
- package/build/httpServerStandalone.js +31 -0
- package/build/httpServerStandalone.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +3012 -0
- package/build/index.js.map +1 -0
- package/build/pro/tap.d.ts +91 -0
- package/build/pro/tap.d.ts.map +1 -0
- package/build/pro/tap.js +542 -0
- package/build/pro/tap.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { tmpdir } from "os";
|
|
2
|
+
import { join, dirname } from "path";
|
|
3
|
+
import { writeFile, unlink } from "fs/promises";
|
|
4
|
+
import { existsSync } from "fs";
|
|
5
|
+
import { randomUUID } from "crypto";
|
|
6
|
+
import { createRequire } from "module";
|
|
7
|
+
import { spawn } from "child_process";
|
|
8
|
+
// EasyOCR instance
|
|
9
|
+
let easyOCRInstance = null;
|
|
10
|
+
let easyOCRInitPromise = null;
|
|
11
|
+
/**
|
|
12
|
+
* Promise with timeout helper
|
|
13
|
+
*/
|
|
14
|
+
function withTimeout(promise, ms, errorMsg) {
|
|
15
|
+
return Promise.race([
|
|
16
|
+
promise,
|
|
17
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(errorMsg)), ms))
|
|
18
|
+
]);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get configured OCR languages from environment variable
|
|
22
|
+
* English is always included as fallback
|
|
23
|
+
* Default: "en" (English only)
|
|
24
|
+
* Example: EASYOCR_LANGUAGES="es,fr" for Spanish, French (+ English)
|
|
25
|
+
*/
|
|
26
|
+
function getOCRLanguages() {
|
|
27
|
+
const envLangs = process.env.EASYOCR_LANGUAGES;
|
|
28
|
+
const languages = envLangs
|
|
29
|
+
? envLangs.split(",").map(lang => lang.trim()).filter(Boolean)
|
|
30
|
+
: [];
|
|
31
|
+
// Always include English as fallback
|
|
32
|
+
if (!languages.includes("en")) {
|
|
33
|
+
languages.push("en");
|
|
34
|
+
}
|
|
35
|
+
return languages;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Initialize EasyOCR (Python-based, better for colored backgrounds)
|
|
39
|
+
* Requires Python 3.6+ on the system; easyocr is provided by node-easyocr's bundled venv.
|
|
40
|
+
*/
|
|
41
|
+
async function getEasyOCR() {
|
|
42
|
+
if (easyOCRInstance) {
|
|
43
|
+
return easyOCRInstance;
|
|
44
|
+
}
|
|
45
|
+
if (easyOCRInitPromise) {
|
|
46
|
+
return easyOCRInitPromise;
|
|
47
|
+
}
|
|
48
|
+
easyOCRInitPromise = (async () => {
|
|
49
|
+
try {
|
|
50
|
+
const languages = getOCRLanguages();
|
|
51
|
+
const { EasyOCR } = await import("node-easyocr");
|
|
52
|
+
const ocr = new EasyOCR();
|
|
53
|
+
// node-easyocr's preinstall creates a venv with easyocr, but the
|
|
54
|
+
// runtime hardcodes pythonPath to system 'python3' which won't have it.
|
|
55
|
+
// Resolve the package location and point at its bundled venv instead.
|
|
56
|
+
const require = createRequire(import.meta.url);
|
|
57
|
+
const easyocrPkgDir = dirname(require.resolve("node-easyocr"));
|
|
58
|
+
// Matches the convention in node-easyocr's own setup-python-env.js
|
|
59
|
+
const venvBin = process.platform === "win32" ? "Scripts" : "bin";
|
|
60
|
+
const venvExe = process.platform === "win32" ? "python.exe" : "python";
|
|
61
|
+
const venvPython = join(easyocrPkgDir, "..", "venv", venvBin, venvExe);
|
|
62
|
+
if (existsSync(venvPython)) {
|
|
63
|
+
ocr.pythonPath = venvPython;
|
|
64
|
+
}
|
|
65
|
+
// node-easyocr's JSON parser chokes on easyocr's progress bar output
|
|
66
|
+
// during model downloads. Pre-download models with verbose=False so
|
|
67
|
+
// node-easyocr's init never sees non-JSON output on stdout.
|
|
68
|
+
// Always run with the configured languages since each language has its
|
|
69
|
+
// own recognition model that may need downloading.
|
|
70
|
+
const pythonPath = ocr.pythonPath || "python3";
|
|
71
|
+
const langArg = JSON.stringify(languages);
|
|
72
|
+
await withTimeout(new Promise((resolve, reject) => {
|
|
73
|
+
const proc = spawn(pythonPath, [
|
|
74
|
+
"-c", `import easyocr; easyocr.Reader(${langArg}, verbose=False)`
|
|
75
|
+
]);
|
|
76
|
+
let stderr = "";
|
|
77
|
+
proc.stderr.on("data", (d) => { stderr += d; });
|
|
78
|
+
proc.on("close", (code) => {
|
|
79
|
+
if (code === 0)
|
|
80
|
+
resolve();
|
|
81
|
+
else
|
|
82
|
+
reject(new Error(`EasyOCR model setup failed (code ${code}): ${stderr.trim() || "unknown error"}. Ensure Python 3.6+ is installed.`));
|
|
83
|
+
});
|
|
84
|
+
proc.on("error", reject);
|
|
85
|
+
}), 120000, "EasyOCR model download timeout -- check your network connection");
|
|
86
|
+
await withTimeout(ocr.init(languages), 30000, "EasyOCR init timeout. Ensure Python 3.6+ is available on your system.");
|
|
87
|
+
easyOCRInstance = ocr;
|
|
88
|
+
return ocr;
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
easyOCRInitPromise = null;
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
})();
|
|
95
|
+
return easyOCRInitPromise;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Infer iOS device pixel ratio from screenshot dimensions
|
|
99
|
+
* @3x devices: Most modern iPhones (width >= 1080)
|
|
100
|
+
* @2x devices: Older iPhones, iPads (width 640-1080 or width >= 1500 for iPads)
|
|
101
|
+
* @1x devices: Very old (rare)
|
|
102
|
+
*/
|
|
103
|
+
export function inferIOSDevicePixelRatio(width, height) {
|
|
104
|
+
// Ensure we're looking at the shorter dimension for width
|
|
105
|
+
const shortSide = Math.min(width, height);
|
|
106
|
+
const longSide = Math.max(width, height);
|
|
107
|
+
// iPads are typically @2x regardless of size
|
|
108
|
+
// iPad resolutions have aspect ratios closer to 4:3 (e.g., 2048x2732)
|
|
109
|
+
const aspectRatio = longSide / shortSide;
|
|
110
|
+
if (aspectRatio < 1.5) {
|
|
111
|
+
// Likely an iPad (4:3 ish aspect ratio)
|
|
112
|
+
return 2;
|
|
113
|
+
}
|
|
114
|
+
// iPhones: Check short side dimension
|
|
115
|
+
// @3x phones have short side >= 1080 (e.g., 1170, 1179, 1284, 1290)
|
|
116
|
+
// @2x phones have short side < 1080 (e.g., 640, 750)
|
|
117
|
+
if (shortSide >= 1080) {
|
|
118
|
+
return 3;
|
|
119
|
+
}
|
|
120
|
+
// Older @2x iPhones (iPhone 8, SE, etc.)
|
|
121
|
+
return 2;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Convert OCR coordinates to tap-ready coordinates
|
|
125
|
+
* iOS: (ocrCoord * scaleFactor) / devicePixelRatio (points)
|
|
126
|
+
* Android: ocrCoord * scaleFactor (pixels)
|
|
127
|
+
*/
|
|
128
|
+
function toTapCoord(ocrCoord, scaleFactor, platform, devicePixelRatio = 3) {
|
|
129
|
+
const pixelCoord = ocrCoord * scaleFactor;
|
|
130
|
+
return platform === "ios" ? Math.round(pixelCoord / devicePixelRatio) : Math.round(pixelCoord);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Run OCR using EasyOCR
|
|
134
|
+
* Requires Python 3.6+ on the system; easyocr is provided by node-easyocr's bundled venv.
|
|
135
|
+
*/
|
|
136
|
+
export async function recognizeText(imageBuffer, options) {
|
|
137
|
+
const scaleFactor = options?.scaleFactor ?? 1;
|
|
138
|
+
const platform = options?.platform ?? "ios";
|
|
139
|
+
const devicePixelRatio = options?.devicePixelRatio ?? 3;
|
|
140
|
+
const startTime = Date.now();
|
|
141
|
+
let ocr;
|
|
142
|
+
try {
|
|
143
|
+
ocr = await getEasyOCR();
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
147
|
+
throw new Error(`EasyOCR initialization failed. Ensure Python 3.6+ is available on your system. Error: ${message}`);
|
|
148
|
+
}
|
|
149
|
+
// Write buffer to temp file (EasyOCR requires file path)
|
|
150
|
+
const tempPath = join(tmpdir(), `ocr-${randomUUID()}.png`);
|
|
151
|
+
try {
|
|
152
|
+
await writeFile(tempPath, imageBuffer);
|
|
153
|
+
const results = await withTimeout(ocr.readText(tempPath), 15000, "EasyOCR readText timeout");
|
|
154
|
+
const words = [];
|
|
155
|
+
const textParts = [];
|
|
156
|
+
let totalConfidence = 0;
|
|
157
|
+
for (const result of results) {
|
|
158
|
+
if (result.text && result.bbox) {
|
|
159
|
+
// EasyOCR bbox is [[x1,y1], [x2,y2], [x3,y3], [x4,y4]] (4 corners)
|
|
160
|
+
const x0 = Math.min(result.bbox[0][0], result.bbox[3][0]);
|
|
161
|
+
const y0 = Math.min(result.bbox[0][1], result.bbox[1][1]);
|
|
162
|
+
const x1 = Math.max(result.bbox[1][0], result.bbox[2][0]);
|
|
163
|
+
const y1 = Math.max(result.bbox[2][1], result.bbox[3][1]);
|
|
164
|
+
const centerX = Math.round((x0 + x1) / 2);
|
|
165
|
+
const centerY = Math.round((y0 + y1) / 2);
|
|
166
|
+
words.push({
|
|
167
|
+
text: result.text.trim(),
|
|
168
|
+
confidence: result.confidence * 100,
|
|
169
|
+
bbox: { x0, y0, x1, y1 },
|
|
170
|
+
center: { x: centerX, y: centerY },
|
|
171
|
+
tapCenter: {
|
|
172
|
+
x: toTapCoord(centerX, scaleFactor, platform, devicePixelRatio),
|
|
173
|
+
y: toTapCoord(centerY, scaleFactor, platform, devicePixelRatio)
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
textParts.push(result.text.trim());
|
|
177
|
+
totalConfidence += result.confidence;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
success: true,
|
|
182
|
+
fullText: textParts.join(" "),
|
|
183
|
+
confidence: results.length > 0 ? (totalConfidence / results.length) * 100 : 0,
|
|
184
|
+
words,
|
|
185
|
+
lines: [], // EasyOCR returns words/phrases, not lines
|
|
186
|
+
processingTimeMs: Date.now() - startTime,
|
|
187
|
+
engine: "easyocr"
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
// Clean up temp file
|
|
192
|
+
try {
|
|
193
|
+
await unlink(tempPath);
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
// Ignore cleanup errors
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
export async function terminateOCRWorker() {
|
|
201
|
+
if (easyOCRInstance) {
|
|
202
|
+
try {
|
|
203
|
+
await easyOCRInstance.close();
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
// Ignore close errors
|
|
207
|
+
}
|
|
208
|
+
easyOCRInstance = null;
|
|
209
|
+
easyOCRInitPromise = null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=ocr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocr.js","sourceRoot":"","sources":["../../src/core/ocr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAoEtC,mBAAmB;AACnB,IAAI,eAAe,GAA0C,IAAI,CAAC;AAClE,IAAI,kBAAkB,GAAmD,IAAI,CAAC;AAE9E;;GAEG;AACH,SAAS,WAAW,CAAI,OAAmB,EAAE,EAAU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,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACL,sBAAsB;QAC1B,CAAC;QACD,eAAe,GAAG,IAAI,CAAC;QACvB,kBAAkB,GAAG,IAAI,CAAC;IAC9B,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ConnectedApp, PendingExecution } from "./types.js";
|
|
2
|
+
import { LogBuffer } from "./logs.js";
|
|
3
|
+
import { NetworkBuffer } from "./network.js";
|
|
4
|
+
import { BundleErrorBuffer } from "./bundle.js";
|
|
5
|
+
export declare const logBuffer: LogBuffer;
|
|
6
|
+
export declare const networkBuffer: NetworkBuffer;
|
|
7
|
+
export declare const bundleErrorBuffer: BundleErrorBuffer;
|
|
8
|
+
export declare const connectedApps: Map<string, ConnectedApp>;
|
|
9
|
+
export declare function getTargetPlatform(): string | undefined;
|
|
10
|
+
export declare const pendingExecutions: Map<number, PendingExecution>;
|
|
11
|
+
export declare function getNextMessageId(): number;
|
|
12
|
+
export declare function getActiveSimulatorUdid(): string | null;
|
|
13
|
+
export declare function setActiveSimulatorUdid(udid: string | null, sourceAppKey?: string): void;
|
|
14
|
+
export declare function clearActiveSimulatorIfSource(appKey: string): void;
|
|
15
|
+
export declare function getLastCDPMessageTime(): Date | null;
|
|
16
|
+
export declare function updateLastCDPMessageTime(time: Date | null): void;
|
|
17
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/core/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAC;AAGvE,eAAO,MAAM,SAAS,WAAqB,CAAC;AAG5C,eAAO,MAAM,aAAa,eAAyB,CAAC;AAGpD,eAAO,MAAM,iBAAiB,mBAA6B,CAAC;AAM5D,eAAO,MAAM,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAa,CAAC;AAElE,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAGtD;AAGD,eAAO,MAAM,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAa,CAAC;AAK1E,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAOD,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAEtD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAGvF;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAKjE;AAKD,wBAAgB,qBAAqB,IAAI,IAAI,GAAG,IAAI,CAEnD;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAEhE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LogBuffer } from "./logs.js";
|
|
2
|
+
import { NetworkBuffer } from "./network.js";
|
|
3
|
+
import { BundleErrorBuffer, initBundleErrorBuffer } from "./bundle.js";
|
|
4
|
+
// Global log buffer
|
|
5
|
+
export const logBuffer = new LogBuffer(500);
|
|
6
|
+
// Global network buffer
|
|
7
|
+
export const networkBuffer = new NetworkBuffer(200);
|
|
8
|
+
// Global bundle error buffer
|
|
9
|
+
export const bundleErrorBuffer = new BundleErrorBuffer(100);
|
|
10
|
+
// Initialize bundle error buffer reference in bundle.ts
|
|
11
|
+
initBundleErrorBuffer(bundleErrorBuffer);
|
|
12
|
+
// Connected apps
|
|
13
|
+
export const connectedApps = new Map();
|
|
14
|
+
export function getTargetPlatform() {
|
|
15
|
+
const firstApp = connectedApps.values().next().value;
|
|
16
|
+
return firstApp?.platform;
|
|
17
|
+
}
|
|
18
|
+
// Pending code executions (for executeInApp)
|
|
19
|
+
export const pendingExecutions = new Map();
|
|
20
|
+
// CDP message ID counter
|
|
21
|
+
let _messageId = 1;
|
|
22
|
+
export function getNextMessageId() {
|
|
23
|
+
return _messageId++;
|
|
24
|
+
}
|
|
25
|
+
// Active iOS simulator UDID (resolved from Metro connection)
|
|
26
|
+
// This links the Metro-connected device to its iOS simulator
|
|
27
|
+
let _activeSimulatorUdid = null;
|
|
28
|
+
let _activeSimulatorSourceAppKey = null;
|
|
29
|
+
export function getActiveSimulatorUdid() {
|
|
30
|
+
return _activeSimulatorUdid;
|
|
31
|
+
}
|
|
32
|
+
export function setActiveSimulatorUdid(udid, sourceAppKey) {
|
|
33
|
+
_activeSimulatorUdid = udid;
|
|
34
|
+
_activeSimulatorSourceAppKey = sourceAppKey || null;
|
|
35
|
+
}
|
|
36
|
+
export function clearActiveSimulatorIfSource(appKey) {
|
|
37
|
+
if (_activeSimulatorSourceAppKey === appKey) {
|
|
38
|
+
_activeSimulatorUdid = null;
|
|
39
|
+
_activeSimulatorSourceAppKey = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Last CDP message received timestamp (for connection liveness detection)
|
|
43
|
+
let _lastCDPMessageAt = null;
|
|
44
|
+
export function getLastCDPMessageTime() {
|
|
45
|
+
return _lastCDPMessageAt;
|
|
46
|
+
}
|
|
47
|
+
export function updateLastCDPMessageTime(time) {
|
|
48
|
+
_lastCDPMessageAt = time;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/core/state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEvE,oBA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,CAAC;AACL,CAAC;AAED,0EAA0E;AAC1E,IAAI,iBAAiB,GAAgB,IAAI,CAAC;AAE1C,MAAM,UAAU,qBAAqB;IACjC,OAAO,iBAAiB,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAAiB;IACtD,iBAAiB,GAAG,IAAI,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type TapStrategy = "auto" | "fiber" | "accessibility" | "ocr" | "coordinate";
|
|
2
|
+
export interface TapQuery {
|
|
3
|
+
text?: string;
|
|
4
|
+
testID?: string;
|
|
5
|
+
component?: string;
|
|
6
|
+
x?: number;
|
|
7
|
+
y?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TapOptions {
|
|
10
|
+
text?: string;
|
|
11
|
+
testID?: string;
|
|
12
|
+
component?: string;
|
|
13
|
+
index?: number;
|
|
14
|
+
x?: number;
|
|
15
|
+
y?: number;
|
|
16
|
+
strategy?: TapStrategy;
|
|
17
|
+
maxTraversalDepth?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface TapAttempt {
|
|
20
|
+
strategy: string;
|
|
21
|
+
reason: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TapResult {
|
|
24
|
+
success: boolean;
|
|
25
|
+
method?: string;
|
|
26
|
+
query: TapQuery;
|
|
27
|
+
pressed?: string;
|
|
28
|
+
text?: string;
|
|
29
|
+
screen?: string | null;
|
|
30
|
+
path?: string | null;
|
|
31
|
+
component?: string | null;
|
|
32
|
+
tappedAt?: {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
};
|
|
36
|
+
convertedTo?: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
unit: string;
|
|
40
|
+
};
|
|
41
|
+
platform?: string;
|
|
42
|
+
error?: string;
|
|
43
|
+
attempted?: TapAttempt[];
|
|
44
|
+
matches?: Array<{
|
|
45
|
+
index: number;
|
|
46
|
+
component: string;
|
|
47
|
+
text: string;
|
|
48
|
+
}>;
|
|
49
|
+
suggestion?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function buildQuery(options: TapOptions): TapQuery;
|
|
52
|
+
export declare function isNonAscii(text: string): boolean;
|
|
53
|
+
export declare function getAvailableStrategies(query: TapQuery, strategy: TapStrategy): string[];
|
|
54
|
+
export declare function convertPixelsToPoints(pixelX: number, pixelY: number, platform: "ios" | "android", devicePixelRatio: number, scaleFactor?: number): {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
};
|
|
58
|
+
export declare function getCurrentScreen(): Promise<string | null>;
|
|
59
|
+
export declare function formatTapSuccess(data: {
|
|
60
|
+
method: string;
|
|
61
|
+
query: TapQuery;
|
|
62
|
+
pressed?: string;
|
|
63
|
+
text?: string;
|
|
64
|
+
screen?: string | null;
|
|
65
|
+
path?: string | null;
|
|
66
|
+
component?: string | null;
|
|
67
|
+
tappedAt?: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
};
|
|
71
|
+
convertedTo?: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
unit: string;
|
|
75
|
+
};
|
|
76
|
+
platform?: string;
|
|
77
|
+
}): TapResult;
|
|
78
|
+
export declare function formatTapFailure(data: {
|
|
79
|
+
query: TapQuery;
|
|
80
|
+
screen?: string | null;
|
|
81
|
+
error?: string;
|
|
82
|
+
attempted: TapAttempt[];
|
|
83
|
+
suggestion: string;
|
|
84
|
+
matches?: Array<{
|
|
85
|
+
index: number;
|
|
86
|
+
component: string;
|
|
87
|
+
text: string;
|
|
88
|
+
}>;
|
|
89
|
+
}): TapResult;
|
|
90
|
+
export declare function tap(options: TapOptions): Promise<TapResult>;
|
|
91
|
+
//# sourceMappingURL=tap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../src/core/tap.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,W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