stim 1.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/README.md +22 -10
- 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.mjs +1 -1
- 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-4tH64LQ9.mjs → cache-manifest-oeH18ERr.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/cli.mjs +24 -27166
- package/dist/collector-run.mjs +6 -4
- package/dist/command-output-8wHMEde0.mjs +289 -0
- package/dist/{config-7kmtuhO2.mjs → config-D7uu8Gbq.mjs} +43 -12
- 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/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/ownership-B9QIdQOw.mjs +475 -0
- package/dist/ownership-D8HmSv2E.mjs +60 -0
- package/dist/ownership-claim-CeJLEpjD.mjs +569 -0
- package/dist/{project-Dit1CckW.mjs → project-COj6nzzh.mjs} +12 -3
- 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-BmTVVmBB.mjs → server-bare-BYHqEeyw.mjs} +3 -2
- package/dist/{server-expo-CHJe1r6j.mjs → server-expo-BEMr_m6p.mjs} +5 -4
- 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-2nush3MK.mjs → state-IYEY-zi8.mjs} +21 -22
- 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 +0 -1
- package/dist/supervisor-run.mjs +4 -4
- 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 +5 -5
- package/dist/android-jc8MnUyL.mjs +0 -514
- package/dist/metro-store-COLl1pOk.mjs +0 -1249
- package/dist/server-expo-BZJm--wA.mjs +0 -2
|
@@ -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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { u as getConfigDir } from "./config-D7uu8Gbq.mjs";
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
|
-
import { join, resolve } from "path";
|
|
4
3
|
import { homedir } from "os";
|
|
4
|
+
import { join, resolve } from "path";
|
|
5
5
|
import { readCacheManifest, updateCacheManifest } from "@stim-cli/core";
|
|
6
6
|
//#region src/cache-manifest.ts
|
|
7
7
|
function manifestPath() {
|
package/dist/cache-manifest.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as unregister, i as registeredCaches, n as readManifest, r as register, t as manifestPath } from "./cache-manifest-
|
|
1
|
+
import { a as unregister, i as registeredCaches, n as readManifest, r as register, t as manifestPath } from "./cache-manifest-oeH18ERr.mjs";
|
|
2
2
|
export { manifestPath, readManifest, register, registeredCaches, unregister };
|