stim 0.0.0 → 1.1.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 +21 -0
- package/README.md +162 -0
- package/dist/android-CC5bUer7.mjs +204 -0
- package/dist/android-DnZlT3aU.mjs +2279 -0
- package/dist/android-cas-DGlTStWu.mjs +1078 -0
- package/dist/android-cas-compiler.d.mts +1 -0
- package/dist/android-cas-compiler.mjs +71 -0
- package/dist/android-xmyGBNy5.mjs +665 -0
- package/dist/app-install-oZIQRbdD.mjs +1141 -0
- package/dist/build-lock-vE45ZzJZ.mjs +645 -0
- package/dist/build-slots-CgacA9zQ.mjs +152 -0
- package/dist/cache-manifest-oeH18ERr.mjs +66 -0
- package/dist/cache-manifest.d.mts +27 -0
- package/dist/cache-manifest.mjs +2 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +40 -0
- package/dist/collector-run.d.mts +119 -0
- package/dist/collector-run.mjs +541 -0
- package/dist/command-output-8wHMEde0.mjs +289 -0
- package/dist/config-D7uu8Gbq.mjs +381 -0
- package/dist/deps-64wVnpZc.mjs +435 -0
- package/dist/dev-client-Bvky1hya.mjs +557 -0
- package/dist/device-DJKv5Qej.mjs +250 -0
- package/dist/device-lease-D-G3SgVe.mjs +335 -0
- package/dist/device-pool-BlHXnYYs.mjs +408 -0
- package/dist/device-remote-CCgkG82J.mjs +1209 -0
- package/dist/doctor-BRF9aAJ3.mjs +530 -0
- package/dist/doctor-DlVxTtMq.mjs +1137 -0
- package/dist/error-diagnostics-B5IJwv3-.mjs +636 -0
- package/dist/errors-B6W7FkxQ.mjs +15 -0
- package/dist/exec-bsN9MJXb.mjs +63 -0
- package/dist/gc-DhXdgSdt.mjs +1651 -0
- package/dist/guide-DrhrDBo5.mjs +4319 -0
- package/dist/ios-BZxKPuqP.mjs +382 -0
- package/dist/ios-CK1Vrk6Q.mjs +2721 -0
- package/dist/ios-device-CYbuRNXR.mjs +81 -0
- package/dist/ios-device-CdSm0GDw.mjs +413 -0
- package/dist/logs-Dxoy16Qv.mjs +176 -0
- package/dist/logs-query-oqn47Ffx.mjs +273 -0
- package/dist/metro-B01H3EuD.mjs +184 -0
- package/dist/metro-store-CDDZHtPl.mjs +92 -0
- package/dist/ndjson-DcAtEx_K.mjs +131 -0
- package/dist/ndjson-DvHSsNU9.d.mts +16 -0
- package/dist/ownership-B9QIdQOw.mjs +475 -0
- package/dist/ownership-D8HmSv2E.mjs +60 -0
- package/dist/ownership-claim-CeJLEpjD.mjs +569 -0
- package/dist/process-output-C7IlIzd7.mjs +40 -0
- package/dist/project-COj6nzzh.mjs +243 -0
- package/dist/reclaim-BPvN2HlP.mjs +347 -0
- package/dist/reload-DYZEBbZy.mjs +332 -0
- package/dist/remote-cache-DOi5-zLj.mjs +934 -0
- package/dist/server-bare-BYHqEeyw.mjs +352 -0
- package/dist/server-expo-BEMr_m6p.mjs +312 -0
- package/dist/server-expo-rb0k-0w7.mjs +2 -0
- package/dist/settings-BSwrY4FZ.mjs +687 -0
- package/dist/spawn-entry-nCE6m770.mjs +14 -0
- package/dist/start-ByCylYtB.mjs +822 -0
- package/dist/state-IYEY-zi8.mjs +268 -0
- package/dist/stats-DZ4Q5J-7.mjs +62 -0
- package/dist/stats-wqxPm7Tv.mjs +307 -0
- package/dist/status-Dia0XTqG.mjs +363 -0
- package/dist/stop-BApyaF21.mjs +591 -0
- package/dist/stop-D6o5zAdm.mjs +3 -0
- package/dist/supervisor-run.d.mts +84 -0
- package/dist/supervisor-run.mjs +210 -0
- package/dist/workspace-process-lock-CxOO9-pf.mjs +47 -0
- package/dist/worktree-Dx3ZC5lS.mjs +539 -0
- package/dist/worktree-DxEmUI_n.mjs +1322 -0
- package/dist/xcode-CDB6fytw.mjs +1705 -0
- package/package.json +61 -8
- package/shim/android-cas-pch.cmake +35 -0
- package/shim/android-cas.gradle +29 -0
- package/shim/android-cas.toolchain.cmake +12 -0
- package/shim/android-optimizations.gradle +30 -0
- package/shim/bundle-response.cjs +46 -0
- package/shim/bundle-response.d.cts +5 -0
- package/shim/expo-metro-config.cjs +188 -0
- package/shim/metro-cache-generation.cjs +20 -0
- package/shim/metro-cache-generation.d.cts +5 -0
- package/skill/SKILL.md +14 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { u as getConfigDir } from "./config-D7uu8Gbq.mjs";
|
|
2
|
+
import { a as formatElapsed } from "./command-output-8wHMEde0.mjs";
|
|
3
|
+
import { d as readClaimSet, f as releaseClaim, h as tryAcquireClaim, s as isClaimRefusal } from "./ownership-claim-CeJLEpjD.mjs";
|
|
4
|
+
import { readdirSync, statSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
//#region src/engine/build-slots.ts
|
|
7
|
+
const SLOT_PREFIX = "slot-";
|
|
8
|
+
const SLOT_LABEL = "build slot";
|
|
9
|
+
const SLOT_POLL_MS = 1e3;
|
|
10
|
+
const SLOT_PROGRESS_MS = 3e4;
|
|
11
|
+
const SLOT_CEILING_MS = 54e5;
|
|
12
|
+
function sleepAsync(ms) {
|
|
13
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
14
|
+
}
|
|
15
|
+
function buildSlotsDir() {
|
|
16
|
+
return join(getConfigDir(), "build-slots");
|
|
17
|
+
}
|
|
18
|
+
function buildSlotPath(index) {
|
|
19
|
+
return join(buildSlotsDir(), `${SLOT_PREFIX}${index}`);
|
|
20
|
+
}
|
|
21
|
+
function toRecord(holder) {
|
|
22
|
+
const details = holder.details;
|
|
23
|
+
return {
|
|
24
|
+
pid: holder.owner.pid,
|
|
25
|
+
index: typeof details.index === "number" ? details.index : null,
|
|
26
|
+
projectRoot: typeof details.projectRoot === "string" ? details.projectRoot : null,
|
|
27
|
+
startedAt: holder.startedAt || null,
|
|
28
|
+
logFile: typeof details.logFile === "string" ? details.logFile : null
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function tryAcquireBuildSlot({ max, root = null, logFile = null }) {
|
|
32
|
+
if (!max || max <= 0) return {
|
|
33
|
+
acquired: true,
|
|
34
|
+
unlimited: true
|
|
35
|
+
};
|
|
36
|
+
let refusal = null;
|
|
37
|
+
let busy = false;
|
|
38
|
+
for (let index = 0; index < max; index++) {
|
|
39
|
+
const path = buildSlotPath(index);
|
|
40
|
+
let attempt;
|
|
41
|
+
try {
|
|
42
|
+
attempt = tryAcquireClaim({
|
|
43
|
+
root: path,
|
|
44
|
+
mode: "exclusive",
|
|
45
|
+
label: SLOT_LABEL,
|
|
46
|
+
details: {
|
|
47
|
+
index,
|
|
48
|
+
projectRoot: root,
|
|
49
|
+
logFile
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
} catch (err) {
|
|
53
|
+
if (!isClaimRefusal(err)) throw err;
|
|
54
|
+
refusal ??= err;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (attempt.pending) releaseClaim(attempt.pending);
|
|
58
|
+
if (!attempt.acquired) {
|
|
59
|
+
busy = true;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
acquired: true,
|
|
64
|
+
path,
|
|
65
|
+
index,
|
|
66
|
+
slot: {
|
|
67
|
+
pid: attempt.acquired.owner.pid,
|
|
68
|
+
index,
|
|
69
|
+
projectRoot: root,
|
|
70
|
+
startedAt: attempt.acquired.startedAt,
|
|
71
|
+
logFile
|
|
72
|
+
},
|
|
73
|
+
claim: attempt.acquired
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (refusal && !busy) throw refusal;
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
function slotWaitingLine({ max, elapsedMs }) {
|
|
80
|
+
return `${"build".padEnd(11)} waiting for a build slot (all ${max} in use, ${formatElapsed(elapsedMs)} elapsed)`;
|
|
81
|
+
}
|
|
82
|
+
async function acquireBuildSlot({ max, root = null, logFile = null, now = Date.now, out = () => {}, sleep = sleepAsync, intervalMs = SLOT_POLL_MS, progressMs = SLOT_PROGRESS_MS, ceilingMs = SLOT_CEILING_MS }) {
|
|
83
|
+
if (!max || max <= 0) return {
|
|
84
|
+
acquired: true,
|
|
85
|
+
unlimited: true
|
|
86
|
+
};
|
|
87
|
+
const started = now();
|
|
88
|
+
let lastProgress = started;
|
|
89
|
+
for (;;) {
|
|
90
|
+
const got = tryAcquireBuildSlot({
|
|
91
|
+
max,
|
|
92
|
+
root,
|
|
93
|
+
logFile
|
|
94
|
+
});
|
|
95
|
+
if (got) return got;
|
|
96
|
+
const elapsed = now() - started;
|
|
97
|
+
if (elapsed >= ceilingMs) {
|
|
98
|
+
const err = /* @__PURE__ */ new Error(`Waited ${formatElapsed(elapsed)} for one of ${max} build slots, and every slot is held by a process that is still running, or by a holder Stim cannot identify. Slots live under ` + buildSlotsDir() + "; remove a slot directory whose builder is not really building, or raise concurrency.maxBuilds.");
|
|
99
|
+
err.code = "STIM_BUILD_SLOT_TIMEOUT";
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
102
|
+
if (now() - lastProgress >= progressMs) {
|
|
103
|
+
lastProgress = now();
|
|
104
|
+
out(slotWaitingLine({
|
|
105
|
+
max,
|
|
106
|
+
elapsedMs: elapsed
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
await sleep(intervalMs);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function releaseBuildSlot(handle) {
|
|
113
|
+
if (!handle || handle.unlimited) return false;
|
|
114
|
+
return releaseClaim(handle.claim);
|
|
115
|
+
}
|
|
116
|
+
function listBuildSlots() {
|
|
117
|
+
const dir = buildSlotsDir();
|
|
118
|
+
let names;
|
|
119
|
+
try {
|
|
120
|
+
names = readdirSync(dir);
|
|
121
|
+
} catch {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
const slots = [];
|
|
125
|
+
for (const name of names) {
|
|
126
|
+
if (!name.startsWith(SLOT_PREFIX)) continue;
|
|
127
|
+
const path = join(dir, name);
|
|
128
|
+
try {
|
|
129
|
+
if (!statSync(path).isDirectory()) continue;
|
|
130
|
+
} catch {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const survey = readClaimSet(path);
|
|
134
|
+
const holder = survey.live[0] ?? survey.dead[0];
|
|
135
|
+
const info = holder ? toRecord(holder) : null;
|
|
136
|
+
const index = Number(name.slice(5));
|
|
137
|
+
slots.push({
|
|
138
|
+
path,
|
|
139
|
+
name,
|
|
140
|
+
index: Number.isFinite(index) ? index : null,
|
|
141
|
+
pid: info?.pid ?? null,
|
|
142
|
+
projectRoot: info?.projectRoot ?? null,
|
|
143
|
+
startedAt: info?.startedAt ?? null,
|
|
144
|
+
logFile: info?.logFile ?? null,
|
|
145
|
+
alive: survey.live.length > 0,
|
|
146
|
+
unresolved: survey.unresolved.length > 0
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return slots;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export { listBuildSlots as n, releaseBuildSlot as r, acquireBuildSlot as t };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { u as getConfigDir } from "./config-D7uu8Gbq.mjs";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
import { join, resolve } from "path";
|
|
5
|
+
import { readCacheManifest, updateCacheManifest } from "@stim-cli/core";
|
|
6
|
+
//#region src/cache-manifest.ts
|
|
7
|
+
function manifestPath() {
|
|
8
|
+
return join(getConfigDir(), "caches.json");
|
|
9
|
+
}
|
|
10
|
+
function expand(dir) {
|
|
11
|
+
return resolve(dir.startsWith("~") ? join(homedir(), dir.slice(1)) : dir);
|
|
12
|
+
}
|
|
13
|
+
function readManifest(path = manifestPath()) {
|
|
14
|
+
return {
|
|
15
|
+
version: 1,
|
|
16
|
+
caches: cacheEntries(readCacheManifest(path).caches)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function cacheEntries(caches) {
|
|
20
|
+
return caches.filter((cache) => typeof cache.dir === "string");
|
|
21
|
+
}
|
|
22
|
+
function register(entry, path = manifestPath()) {
|
|
23
|
+
if (!entry?.dir) throw new Error("a cache registration needs a `dir`");
|
|
24
|
+
const dir = expand(entry.dir);
|
|
25
|
+
const record = {
|
|
26
|
+
dir,
|
|
27
|
+
name: entry.name || dir,
|
|
28
|
+
prune: entry.prune === "atomic" ? "atomic" : "entries",
|
|
29
|
+
entriesDepth: normalizeDepth(entry.entriesDepth),
|
|
30
|
+
note: entry.note || "registered by the project",
|
|
31
|
+
registeredBy: entry.registeredBy || process.cwd()
|
|
32
|
+
};
|
|
33
|
+
if (entry.layout) record.layout = entry.layout;
|
|
34
|
+
updateCacheManifest(path, (caches) => {
|
|
35
|
+
return [...cacheEntries(caches).filter((cache) => expand(cache.dir) !== dir), record];
|
|
36
|
+
});
|
|
37
|
+
return record;
|
|
38
|
+
}
|
|
39
|
+
function normalizeDepth(value) {
|
|
40
|
+
const n = Number(value);
|
|
41
|
+
if (!Number.isInteger(n) || n < 1) return 1;
|
|
42
|
+
return n;
|
|
43
|
+
}
|
|
44
|
+
function unregister(dir, path = manifestPath()) {
|
|
45
|
+
const target = expand(dir);
|
|
46
|
+
let removed = false;
|
|
47
|
+
updateCacheManifest(path, (caches) => {
|
|
48
|
+
const entries = cacheEntries(caches);
|
|
49
|
+
const remaining = entries.filter((cache) => expand(cache.dir) !== target);
|
|
50
|
+
removed = remaining.length !== entries.length;
|
|
51
|
+
return remaining;
|
|
52
|
+
});
|
|
53
|
+
return removed;
|
|
54
|
+
}
|
|
55
|
+
function registeredCaches(path = manifestPath()) {
|
|
56
|
+
return readManifest(path).caches.filter((c) => c.dir && existsSync(c.dir)).map((c) => ({
|
|
57
|
+
name: c.name,
|
|
58
|
+
dir: c.dir,
|
|
59
|
+
prune: c.prune === "atomic" ? "atomic" : "entries",
|
|
60
|
+
entriesDepth: normalizeDepth(c.entriesDepth),
|
|
61
|
+
note: c.note,
|
|
62
|
+
layout: c.layout
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { unregister as a, registeredCaches as i, readManifest as n, register as r, manifestPath as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/cache-manifest.d.ts
|
|
2
|
+
interface CacheEntry {
|
|
3
|
+
dir: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
prune?: "atomic" | "entries";
|
|
6
|
+
entriesDepth?: number;
|
|
7
|
+
note?: string;
|
|
8
|
+
registeredBy?: string;
|
|
9
|
+
layout?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function manifestPath(): string;
|
|
12
|
+
declare function readManifest(path?: string): {
|
|
13
|
+
version: number;
|
|
14
|
+
caches: CacheEntry[];
|
|
15
|
+
};
|
|
16
|
+
declare function register(entry: CacheEntry, path?: string): CacheEntry;
|
|
17
|
+
declare function unregister(dir: string, path?: string): boolean;
|
|
18
|
+
declare function registeredCaches(path?: string): {
|
|
19
|
+
name: string | undefined;
|
|
20
|
+
dir: string;
|
|
21
|
+
prune: "atomic" | "entries";
|
|
22
|
+
entriesDepth: number;
|
|
23
|
+
note: string | undefined;
|
|
24
|
+
layout: string | undefined;
|
|
25
|
+
}[];
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CacheEntry, manifestPath, readManifest, register, registeredCaches, unregister };
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
//#region bin/cli.ts
|
|
5
|
+
const commands = /* @__PURE__ */ new Map([
|
|
6
|
+
["doctor", () => import("./doctor-BRF9aAJ3.mjs")],
|
|
7
|
+
["worktree", () => import("./worktree-DxEmUI_n.mjs")],
|
|
8
|
+
["start", () => import("./start-ByCylYtB.mjs")],
|
|
9
|
+
["stop", () => import("./stop-D6o5zAdm.mjs")],
|
|
10
|
+
["ios", () => import("./ios-CK1Vrk6Q.mjs")],
|
|
11
|
+
["android", () => import("./android-DnZlT3aU.mjs")],
|
|
12
|
+
["reload", () => import("./reload-DYZEBbZy.mjs")],
|
|
13
|
+
["device", () => import("./device-DJKv5Qej.mjs")],
|
|
14
|
+
["logs", () => import("./logs-Dxoy16Qv.mjs")],
|
|
15
|
+
["status", () => import("./status-Dia0XTqG.mjs")],
|
|
16
|
+
["stats", () => import("./stats-DZ4Q5J-7.mjs")],
|
|
17
|
+
["gc", () => import("./gc-DhXdgSdt.mjs")],
|
|
18
|
+
["guide", () => import("./guide-DrhrDBo5.mjs")]
|
|
19
|
+
]);
|
|
20
|
+
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
21
|
+
const program = new Command();
|
|
22
|
+
program.name("stim").description("Isolated React Native dev environments per project/worktree").version(pkg.version);
|
|
23
|
+
try {
|
|
24
|
+
const first = process.argv[2];
|
|
25
|
+
const loadCommand = commands.get((first === "help" ? process.argv[3] : first) ?? "");
|
|
26
|
+
if (loadCommand) (await loadCommand()).default(program, pkg.version);
|
|
27
|
+
else if (first !== "--version" && first !== "-V") {
|
|
28
|
+
const modules = await Promise.all([...commands.values()].map((load) => load()));
|
|
29
|
+
for (const module of modules) module.default(program, pkg.version);
|
|
30
|
+
}
|
|
31
|
+
await program.parseAsync();
|
|
32
|
+
} catch (err) {
|
|
33
|
+
if (err?.code === "STIM_CONFIG_CORRUPT") {
|
|
34
|
+
console.error(err.message);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { t as NdjsonWriter } from "./ndjson-DvHSsNU9.mjs";
|
|
2
|
+
import { ChildProcess, SpawnOptions } from "child_process";
|
|
3
|
+
import { ChildProcess as ChildProcess$1 } from "node:child_process";
|
|
4
|
+
//#region src/exec.d.ts
|
|
5
|
+
interface ExecOptions {
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
cwd?: string;
|
|
8
|
+
env?: Record<string, string>;
|
|
9
|
+
omitEnv?: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
interface Executor {
|
|
12
|
+
run(cmd: string, opts?: ExecOptions): string;
|
|
13
|
+
runFile(file: string, args?: string[], opts?: ExecOptions): string;
|
|
14
|
+
runQuiet(cmd: string, opts?: ExecOptions): string | null;
|
|
15
|
+
runFileQuiet(file: string, args?: string[], opts?: ExecOptions): string | null;
|
|
16
|
+
spawn(cmd: string, args?: readonly string[], opts?: SpawnOptions): ChildProcess;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/collector/android.d.ts
|
|
20
|
+
declare function androidClockOffset(serial: string, { exec, now }?: {
|
|
21
|
+
exec?: Executor;
|
|
22
|
+
now?: () => number;
|
|
23
|
+
}): number | null;
|
|
24
|
+
interface PidResolution {
|
|
25
|
+
ok?: boolean;
|
|
26
|
+
pid?: number;
|
|
27
|
+
failed?: boolean;
|
|
28
|
+
reason?: string;
|
|
29
|
+
}
|
|
30
|
+
interface PidWatcher {
|
|
31
|
+
stop(): void;
|
|
32
|
+
probe(): number | null;
|
|
33
|
+
readonly pid: number | null;
|
|
34
|
+
}
|
|
35
|
+
declare function watchAppPid({ serial, packageName, pid, intervalMs, exec, onChange, resolve, setTimer, clearTimer }: {
|
|
36
|
+
serial: string;
|
|
37
|
+
packageName: string;
|
|
38
|
+
pid: number | null;
|
|
39
|
+
intervalMs?: number | null;
|
|
40
|
+
exec?: Executor | null;
|
|
41
|
+
onChange: (nextPid: number) => void | Promise<void>;
|
|
42
|
+
resolve?: (serial: string, packageName: string, opts: {
|
|
43
|
+
exec?: Executor | null;
|
|
44
|
+
}) => number | null;
|
|
45
|
+
setTimer?: (fn: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
46
|
+
clearTimer?: (t: ReturnType<typeof setTimeout>) => void;
|
|
47
|
+
}): PidWatcher;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/collector/state.d.ts
|
|
50
|
+
declare function registerCollector(root: string, platform: string, record: Record<string, unknown>): Record<string, unknown>;
|
|
51
|
+
declare function unregisterCollector(root: string, platform: string, pid: number, processToken: string): Record<string, unknown>;
|
|
52
|
+
declare function readCollectors(root: string): Record<string, unknown>;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/collector/run.d.ts
|
|
55
|
+
declare const PLATFORMS: string[];
|
|
56
|
+
interface ParsedCollectorArgs {
|
|
57
|
+
platform?: string;
|
|
58
|
+
root?: string;
|
|
59
|
+
udid?: string;
|
|
60
|
+
bundleId?: string;
|
|
61
|
+
appName?: string;
|
|
62
|
+
appExecutable?: string | null;
|
|
63
|
+
serial?: string | null;
|
|
64
|
+
packageName?: string | null;
|
|
65
|
+
physical?: boolean;
|
|
66
|
+
payloadUrl?: string | null;
|
|
67
|
+
error?: string;
|
|
68
|
+
}
|
|
69
|
+
declare function parseArgs(argv: string[]): ParsedCollectorArgs;
|
|
70
|
+
interface RunCollectorOptions {
|
|
71
|
+
platform: string;
|
|
72
|
+
root: string;
|
|
73
|
+
udid?: string | null;
|
|
74
|
+
appName?: string | null;
|
|
75
|
+
appExecutable?: string | null;
|
|
76
|
+
bundleId?: string | null;
|
|
77
|
+
serial?: string | null;
|
|
78
|
+
packageName?: string | null;
|
|
79
|
+
physical?: boolean;
|
|
80
|
+
payloadUrl?: string | null;
|
|
81
|
+
startStream?: ((opts: {
|
|
82
|
+
platform: string;
|
|
83
|
+
udid?: string | null;
|
|
84
|
+
appName?: string | null;
|
|
85
|
+
appExecutable?: string | null;
|
|
86
|
+
bundleId?: string | null;
|
|
87
|
+
serial?: string | null;
|
|
88
|
+
physical?: boolean;
|
|
89
|
+
payloadUrl?: string | null;
|
|
90
|
+
pid?: number | null;
|
|
91
|
+
}) => ChildProcess$1) | null;
|
|
92
|
+
resolvePid?: ((opts: {
|
|
93
|
+
serial?: string | null;
|
|
94
|
+
packageName?: string | null;
|
|
95
|
+
timeoutMs: number;
|
|
96
|
+
}) => Promise<PidResolution>) | null;
|
|
97
|
+
pidTimeoutMs?: number;
|
|
98
|
+
pidOf?: ((serial: string, packageName: string, opts: {
|
|
99
|
+
exec?: Executor | null;
|
|
100
|
+
}) => number | null) | null;
|
|
101
|
+
pidWatchMs?: number | null;
|
|
102
|
+
watchPid?: typeof watchAppPid;
|
|
103
|
+
resolveClockOffset?: typeof androidClockOffset;
|
|
104
|
+
now?: () => number;
|
|
105
|
+
onExit?: (code: number) => void;
|
|
106
|
+
attachSignals?: boolean;
|
|
107
|
+
stderr?: (line: string) => void;
|
|
108
|
+
}
|
|
109
|
+
interface RunCollectorHandle {
|
|
110
|
+
child: ChildProcess$1 | null;
|
|
111
|
+
writer: NdjsonWriter;
|
|
112
|
+
finish: (code: number, level: string, msg: string, event: string) => void;
|
|
113
|
+
startedAt: string;
|
|
114
|
+
pid: number | null;
|
|
115
|
+
}
|
|
116
|
+
declare function runCollector({ platform, root, udid, appName, appExecutable, bundleId, serial, packageName, physical, payloadUrl, startStream, resolvePid, pidTimeoutMs, pidOf, pidWatchMs, watchPid, resolveClockOffset, now, onExit, attachSignals, stderr }: RunCollectorOptions): Promise<RunCollectorHandle | null>;
|
|
117
|
+
declare function main(argv?: string[]): Promise<void>;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { PLATFORMS, ParsedCollectorArgs, RunCollectorHandle, RunCollectorOptions, main, parseArgs, readCollectors, registerCollector, runCollector, unregisterCollector };
|