stim 1.17.2 → 1.19.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 +50 -1
- package/dist/{activity-IRvJY_ru.mjs → activity-BSw0x84R.mjs} +4 -4
- package/dist/{agent-device-usage-output-BK41vnzN.mjs → agent-device-usage-output-Bjxu_VmX.mjs} +8 -8
- package/dist/{android-B9yaNKwa.mjs → android-BXc6BmEi.mjs} +658 -404
- package/dist/{android-B_YNZy61.mjs → android-BdQC6zs1.mjs} +9 -9
- package/dist/android-BvV1gGdN.mjs +4 -0
- package/dist/{android-DE4v59Mb.mjs → android-DE5g_5gv.mjs} +2 -2
- package/dist/{android-cas-ZFpjJBL_.mjs → android-cas-C87geAg-.mjs} +5 -5
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/api-DIf_s86s.mjs +150 -0
- package/dist/api-run.d.mts +1 -0
- package/dist/api-run.mjs +145 -0
- package/dist/api.d.mts +218 -0
- package/dist/api.mjs +2 -0
- package/dist/{app-install-VPkI5WEg.mjs → app-install-CFI4ptUL.mjs} +33 -13
- package/dist/{attempt-Bk2ouQVL.mjs → attempt-DW-mQqM7.mjs} +14 -4
- package/dist/{web-Dl0KSRHf.mjs → browser-web-CDhqQxhv.mjs} +138 -176
- package/dist/{budget-DfcgFdQB.mjs → budget-Dz-kyXLv.mjs} +1391 -58
- package/dist/build-facts-B87vo-Im.d.mts +142 -0
- package/dist/{cache-manifest-DnUHBJaU.mjs → cache-manifest-DiwKSyv9.mjs} +3 -3
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{chrome-BrcVWQyD.mjs → chrome-BTUOo8p2.mjs} +1 -1
- package/dist/cli-C9Zvgbdc.mjs +68 -0
- package/dist/cli.mjs +1 -1
- package/dist/{client-SvBdgObD.mjs → client-CuUo8Nvg.mjs} +381 -49
- package/dist/collector-run.d.mts +6 -0
- package/dist/collector-run.mjs +9 -9
- package/dist/{command-output-CDAIFD-8.mjs → command-output-Bt8ygHE7.mjs} +2 -2
- package/dist/{config-D0DbpZtM.mjs → config-DC5jEtd1.mjs} +9 -5
- package/dist/{created-devices-CpvzBL25.mjs → created-devices-D0s26Hx5.mjs} +2 -2
- package/dist/{dependency-state-CLcBHH2M.mjs → dependency-state-DKaS1OM9.mjs} +2 -2
- package/dist/{detached-entry-CiTEgMR1.mjs → detached-entry-pB_IPfV4.mjs} +1 -1
- package/dist/{dev-client-B-XC4uRH.mjs → dev-client-CDY_zAmD.mjs} +2 -2
- package/dist/{device-C8IOoJPv.mjs → device-BHw0WlHl.mjs} +8 -8
- package/dist/{device-capacity-ZC4XSZ4R.mjs → device-capacity-BoN1jQkO.mjs} +25 -14
- package/dist/device-host-worker.mjs +19 -19
- package/dist/{gradle-dJpre3Yn.mjs → device-ios-B2ruohE-.mjs} +661 -107
- package/dist/{device-lease-DpoS36_u.mjs → device-lease-Cu7PtQpZ.mjs} +9 -9
- package/dist/{device-lease-run-B8YltIH_.mjs → device-lease-run-D38SnZtt.mjs} +4 -4
- package/dist/{device-pool-3o7s5lo4.mjs → device-pool-CP4rAsHx.mjs} +3 -3
- package/dist/{device-remote-hFSkpfQu.mjs → device-remote-B5GiUifk.mjs} +15 -16
- package/dist/{doctor-CFv1fCrF.mjs → doctor-PRJH94v6.mjs} +61 -34
- package/dist/doctor-watchman-wZhyTdp4.mjs +259 -0
- package/dist/{error-diagnostics-C-NMnhrk.mjs → error-diagnostics--v5HGOU0.mjs} +11 -11
- package/dist/{exec-CaErVv7t.mjs → exec-i8GDPwq9.mjs} +93 -6
- package/dist/{gc-DEmkg3Xh.mjs → gc-CyHMcKcn.mjs} +25 -471
- package/dist/{guide-CSmhMTf8.mjs → guide-dRaQJJk9.mjs} +681 -507
- package/dist/{hosted-android-E1Heoqnv.mjs → hosted-android-Bs7fytj7.mjs} +3 -3
- package/dist/{hosted-client-Bp4knSwu.mjs → hosted-client-C5G4h_OJ.mjs} +2 -2
- package/dist/{hosted-ios-BnbeYOUD.mjs → hosted-ios-Bik035eL.mjs} +1 -1
- package/dist/{hosted-logs-OcgIBvCT.mjs → hosted-logs-CI9Az9a4.mjs} +9 -9
- package/dist/{hosted-macos-DcxKjtfH.mjs → hosted-macos-DABm3ScO.mjs} +5 -5
- package/dist/{hosted-native-1Ebbig4w.mjs → hosted-native-DbV2aUVw.mjs} +13 -9
- package/dist/{idle-shutdown-IGyNV8Cr.mjs → idle-shutdown-DYiMBn34.mjs} +7 -8
- package/dist/{ios-DSfnPfse.mjs → ios-BWbHFZVz.mjs} +19 -7
- package/dist/{ios-Cr1h5gnO.mjs → ios-DCrkgXEM.mjs} +1 -1
- package/dist/ios-DYUr9LGc.mjs +8 -0
- package/dist/ios-ITYno9rO.mjs +2241 -0
- package/dist/{ios-device-pAN4t54-.mjs → ios-device-CJ_ZOGky.mjs} +3 -3
- package/dist/{ios-device-Ee7sDXfp.mjs → ios-device-CrW8aMb5.mjs} +1 -1
- package/dist/{ios-state-8L3lgum6.mjs → ios-state-By0XuLTQ.mjs} +1 -1
- package/dist/{launch-verify-lTnWZikR.mjs → launch-verify-DCveSE6d.mjs} +5 -5
- package/dist/{logs-BAaS7gS2.mjs → logs-Bao1HOMy.mjs} +13 -13
- package/dist/{macos-BIRQS90f.mjs → macos-ciyBdTY5.mjs} +194 -132
- package/dist/macos-nIOATJmR.mjs +2 -0
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +349 -47
- package/dist/manifest-CX0d1IkZ.mjs +148 -0
- package/dist/{metro-g8NqiJp-.mjs → metro-DI2AjPF_.mjs} +196 -43
- package/dist/{metro-gateway-C-ijGI2F.mjs → metro-gateway-BxpJLIwh.mjs} +4 -4
- package/dist/{metro-store-CDDZHtPl.mjs → metro-store-BAHFcJm6.mjs} +16 -2
- package/dist/{build-plan-BDsSi09V.mjs → miss-reason-CjQCOKqq.mjs} +207 -249
- package/dist/{named-ports-C8m8EQs2.mjs → named-ports-B4iWH4E-.mjs} +70 -8
- package/dist/{native-runtime-BEK171xQ.mjs → native-runtime-BGxsbfny.mjs} +6 -6
- package/dist/{ndjson-PclOIwVY.mjs → ndjson-LGZAMsqa.mjs} +8 -4
- package/dist/offload-worker.d.mts +3 -45
- package/dist/offload-worker.mjs +11 -11
- package/dist/{ownership-DyRQru0q.mjs → ownership-EB0ySdGK.mjs} +3 -3
- package/dist/{page-QF_Ke10s.mjs → page-Bv9s2KwY.mjs} +1 -1
- package/dist/placement-log-Dxe34rJm.mjs +88 -0
- package/dist/plan-placement-BVY59qa8.mjs +290 -0
- package/dist/{ports-4nYqxPWC.mjs → ports-ByPc0_97.mjs} +3 -3
- package/dist/{prebuild-D7RUMkwN.mjs → prebuild-BKJ3wJI1.mjs} +5 -5
- package/dist/preview-BbSottmO.mjs +986 -0
- package/dist/{rolldown-runtime-BsOwBuO_.mjs → process-identity-Biv3arCO.mjs} +11 -1
- package/dist/project-B5eQ1USs.mjs +612 -0
- package/dist/{pull-request-pxnDCQzn.mjs → pull-request-IHNdMnG8.mjs} +1 -1
- package/dist/pull-requests.mjs +1 -1
- package/dist/react-native-ios-BMh2i25I.mjs +2 -0
- package/dist/react-native-ios-CSpIxexZ.mjs +2083 -0
- package/dist/{recordings-BNgsD1Tr.mjs → recordings-Bv8McZN4.mjs} +1 -1
- package/dist/{reload-DcRxj3qG.mjs → reload-rAPdqeRR.mjs} +14 -15
- package/dist/{remote-cache-Ci4DQYYj.mjs → remote-cache-N3hAEaAL.mjs} +5 -5
- package/dist/{run-CkE9y0nc.mjs → run-lAkle1-c.mjs} +5 -5
- package/dist/{server-bare-BkrSxSsZ.mjs → server-bare-CkIjnegq.mjs} +5 -6
- package/dist/server-expo-DGsdUGX2.mjs +2 -0
- package/dist/{server-expo-CHTyXD0G.mjs → server-expo-n3tUi3Em.mjs} +5 -6
- package/dist/{settings-SR9OmW9h.mjs → settings-2am7TSxp.mjs} +5 -5
- package/dist/{settings-Cfd-0r2d.mjs → settings-CxgngUZk.mjs} +116 -103
- package/dist/{settings-BBpMcDbD.mjs → settings-Djl-mpjX.mjs} +1 -1
- package/dist/settings.schema.json +198 -9
- package/dist/{simslim-BWNrc3M3.mjs → simslim-D9LkJxIO.mjs} +7 -7
- package/dist/{slot-launch-DmjBmpQV.mjs → slot-launch-HV_KtPIw.mjs} +6 -6
- package/dist/{spawn-claims-D0XfSe8u.mjs → spawn-claims-Kqiifsk2.mjs} +1 -1
- package/dist/{spawn-entry-jw19m8Nl.mjs → spawn-entry-Dcb7sDUz.mjs} +1 -0
- package/dist/{stage-CzaiwFsI.mjs → stage-BgaZJVZY.mjs} +14 -3
- package/dist/{start-AlfCPRVU.mjs → start-D8NbxNBb.mjs} +1 -1
- package/dist/{start-DUz3mYdb.mjs → start-DtxthMfI.mjs} +34 -27
- package/dist/{state-PeQiJuIu.mjs → state-D2KtnALG.mjs} +4 -4
- package/dist/{state-DyaNTgfR.mjs → state-Tp4uImDS.mjs} +5 -3
- package/dist/{state-B4PQFXMW.d.mts → state-lKh8shBp.d.mts} +2 -3
- package/dist/{stats-Bq4fJOdB.mjs → stats-8EJ5ivFT.mjs} +6 -6
- package/dist/{status-DlKvVJBE.mjs → status-BEeL6IKz.mjs} +6 -4
- package/dist/{status-BA2pehwf.mjs → status-BOyp0CUl.mjs} +31 -34
- package/dist/{stim-desktop-Cnz8CPnl.mjs → stim-desktop-C65jk_q2.mjs} +1 -1
- package/dist/{stim-installations-QMEI32v1.mjs → stim-installations-DbmUjsLv.mjs} +1 -1
- package/dist/stop-D0UIpZuh.mjs +72 -0
- package/dist/{stop-zF1y04f2.mjs → stop-DRipAg-e.mjs} +2 -2
- package/dist/{stop-DQIasgKp.mjs → stop-zDlknFoz.mjs} +79 -33
- package/dist/supervisor-run.d.mts +24 -22
- package/dist/supervisor-run.mjs +21 -22
- package/dist/{support-CsJNVfOc.mjs → support-CNqYkV0y.mjs} +7 -7
- package/dist/{support-WvD__tSV.mjs → support-DsNaFg6D.mjs} +5 -5
- package/dist/swiftpm-macos-aJzPAj1t.mjs +119 -0
- package/dist/{toolchain-DNyR3NPq.mjs → toolchain-C3xSoyUl.mjs} +475 -269
- package/dist/{trigger-Bemu8ytw.mjs → trigger-CAhmG-4s.mjs} +6 -6
- package/dist/trigger-CoalsMTV.mjs +2 -0
- package/dist/{warm-progress-DF4JRvYI.mjs → warm-progress-pFLB2e6P.mjs} +135 -38
- package/dist/{status-CzS4bPO9.mjs → watchman-BL1IdOtq.mjs} +75 -7
- package/dist/web-DFpFeZu5.mjs +2 -0
- package/dist/web-DbbrPUn0.mjs +127 -0
- package/dist/web-run.mjs +10 -10
- package/dist/{workspace-state-DqcCbpE7.mjs → workspace-state-CR9X86xJ.mjs} +3 -3
- package/dist/{ownership-BMLqyBgJ.mjs → workspaces-Djb2gfi9.mjs} +661 -23
- package/dist/{worktree-Be_7NLKy.mjs → worktree-BL4M1rhB.mjs} +252 -50
- package/dist/{worktree-j3IcFAI5.mjs → worktree-DV-A0LNL.mjs} +1 -1
- package/package.json +10 -5
- package/shim/bundle-response.cjs +2 -1
- package/shim/bundle-response.d.cts +1 -1
- package/shim/expo-metro-config.cjs +1 -1
- package/dist/build-progress-D0WkjCPd.mjs +0 -1036
- package/dist/build-slots-41v_d2x9.mjs +0 -142
- package/dist/cli-CYXb29oE.mjs +0 -51
- package/dist/deps-iKw0eD4P.mjs +0 -438
- package/dist/device-ios-C2Um-XUR.mjs +0 -412
- package/dist/errors-B6W7FkxQ.mjs +0 -15
- package/dist/guide-status-Du-ZQ3FD.mjs +0 -125
- package/dist/idle-BXG__1BA.mjs +0 -176
- package/dist/in-use-CvGOUn-x.mjs +0 -130
- package/dist/ios-BJ4XUSe1.mjs +0 -3867
- package/dist/native-run-D1Q56rAD.mjs +0 -158
- package/dist/preview-B-g9d7kV.mjs +0 -318
- package/dist/process-identity-BmRm1qV0.mjs +0 -12
- package/dist/project-D47Rh0ly.mjs +0 -276
- package/dist/server-expo-CeakhI8P.mjs +0 -2
- package/dist/state-BKa8wNN5.mjs +0 -148
- package/dist/stop-BIiM49EY.mjs +0 -48
- package/dist/stop-cause-rhmGfwvt.mjs +0 -97
- package/dist/trigger-CXts6qt1.mjs +0 -2
- package/dist/watchman-APYjXSQa.mjs +0 -48
- package/dist/workspace-process-lock-2mNzOlaB.mjs +0 -58
- package/dist/workspaces-Bcib97-6.mjs +0 -306
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { d as webLogFile, o as readWebRecord, p as webSupervisorLogFile,
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { o as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { a as sleep, n as ensureWorkspaceStorageSafely } from "./native-runtime-BEK171xQ.mjs";
|
|
20
|
-
import { n as sendToOwnedPage, t as liveWebRecord } from "./page-QF_Ke10s.mjs";
|
|
21
|
-
import { randomUUID } from "node:crypto";
|
|
1
|
+
import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
|
|
2
|
+
import { t as spawnEntry } from "./spawn-entry-Dcb7sDUz.mjs";
|
|
3
|
+
import { l as phaseLine } from "./command-output-Bt8ygHE7.mjs";
|
|
4
|
+
import { p as getProject } from "./config-DC5jEtd1.mjs";
|
|
5
|
+
import { r as readWorkspaceState, v as workspaceDir, x as workspaceLogsDir } from "./workspace-state-CR9X86xJ.mjs";
|
|
6
|
+
import { h as isPackageResolvable, p as detectIsExpo } from "./project-B5eQ1USs.mjs";
|
|
7
|
+
import { G as webSettings, i as SETTING_SHAPE_REMEDY, x as metroPortSetting } from "./settings-CxgngUZk.mjs";
|
|
8
|
+
import { u as resolveProjectMetro } from "./metro-DI2AjPF_.mjs";
|
|
9
|
+
import { d as webLogFile, o as readWebRecord, p as webSupervisorLogFile, s as updateWebRecord } from "./state-D2KtnALG.mjs";
|
|
10
|
+
import { E as teardownBrowserHeld, m as resolveSupervisorTarget } from "./workspaces-Djb2gfi9.mjs";
|
|
11
|
+
import { a as withWorkspaceProcessLock, i as reserveBrowserPort, n as getNamedPort } from "./named-ports-B4iWH4E-.mjs";
|
|
12
|
+
import { o as readNdjsonGenerations } from "./ndjson-LGZAMsqa.mjs";
|
|
13
|
+
import { c as readMetroRecords } from "./launch-verify-DCveSE6d.mjs";
|
|
14
|
+
import { o as resolveWorkspaceMetroPort } from "./start-DtxthMfI.mjs";
|
|
15
|
+
import { n as windowsLauncherArgs } from "./detached-entry-pB_IPfV4.mjs";
|
|
16
|
+
import { a as sleep } from "./native-runtime-BGxsbfny.mjs";
|
|
17
|
+
import { n as sendToOwnedPage, t as liveWebRecord } from "./page-Bv9s2KwY.mjs";
|
|
18
|
+
import { a as findChrome, t as CHROME_INSTALL_REMEDY } from "./chrome-BTUOo8p2.mjs";
|
|
22
19
|
import { mkdirSync, openSync } from "node:fs";
|
|
23
20
|
import chalk from "chalk";
|
|
21
|
+
import { randomUUID } from "node:crypto";
|
|
24
22
|
//#region src/web/launch.ts
|
|
23
|
+
const PORT_PLACEHOLDER = /\{port:([^}]*)\}/g;
|
|
24
|
+
/** Replaces each `{port:<label>}` in a `web.url` template; `metro` is the workspace's Metro port. */
|
|
25
|
+
async function resolveWebUrl(template, { metroPort, namedPort }) {
|
|
26
|
+
let url = template;
|
|
27
|
+
for (const [placeholder, label] of template.matchAll(PORT_PLACEHOLDER)) {
|
|
28
|
+
const port = label === "metro" ? metroPort : await namedPort(label);
|
|
29
|
+
if (port === null) throw new Error(`${placeholder} needs a Metro port, and this workspace has none reserved.`);
|
|
30
|
+
url = url.replace(placeholder, String(port));
|
|
31
|
+
}
|
|
32
|
+
return url;
|
|
33
|
+
}
|
|
25
34
|
const VERIFY_WAIT_MS = 2e4;
|
|
26
35
|
const LOADING_WAIT_MS = 6e4;
|
|
27
36
|
const METRO_WEB_BUNDLE = /\bWeb\s+Bundl(?:ing|ed)\b/i;
|
|
@@ -128,12 +137,10 @@ function webLaunchRemedy(verdict, { url, template, usesMetro, serve }) {
|
|
|
128
137
|
return usesMetro ? METRO_BUILD(url) : nothingServed;
|
|
129
138
|
}
|
|
130
139
|
//#endregion
|
|
131
|
-
//#region src/
|
|
132
|
-
const PORT_PLACEHOLDER = /\{port:([^}]*)\}/g;
|
|
140
|
+
//#region src/web/runtime.ts
|
|
133
141
|
const REGISTER_WAIT_MS = 3e4;
|
|
134
|
-
const POLL_MS = 250;
|
|
135
|
-
|
|
136
|
-
function failure(code, message, remedy) {
|
|
142
|
+
const POLL_MS$1 = 250;
|
|
143
|
+
function failure$1(code, message, remedy) {
|
|
137
144
|
return {
|
|
138
145
|
ok: false,
|
|
139
146
|
error: {
|
|
@@ -143,16 +150,6 @@ function failure(code, message, remedy) {
|
|
|
143
150
|
}
|
|
144
151
|
};
|
|
145
152
|
}
|
|
146
|
-
/** Replaces each `{port:<label>}` in a `web.url` template; `metro` is the workspace's Metro port. */
|
|
147
|
-
async function resolveWebUrl(template, { metroPort, namedPort }) {
|
|
148
|
-
let url = template;
|
|
149
|
-
for (const [placeholder, label] of template.matchAll(PORT_PLACEHOLDER)) {
|
|
150
|
-
const port = label === "metro" ? metroPort : await namedPort(label);
|
|
151
|
-
if (port === null) throw new Error(`${placeholder} needs a Metro port, and this workspace has none reserved.`);
|
|
152
|
-
url = url.replace(placeholder, String(port));
|
|
153
|
-
}
|
|
154
|
-
return url;
|
|
155
|
-
}
|
|
156
153
|
function sameLaunch(record, config) {
|
|
157
154
|
return record.chrome === config.chrome && record.headless === config.headless && record.viewport === config.viewport && record.ignoreCertificateErrors === config.ignoreCertificateErrors;
|
|
158
155
|
}
|
|
@@ -216,77 +213,12 @@ async function waitForSupervisor(root, child, launchId) {
|
|
|
216
213
|
const record = readWebRecord(root);
|
|
217
214
|
if (record?.launchId === launchId && record.targetId) return record;
|
|
218
215
|
if (exited) return null;
|
|
219
|
-
await sleep(POLL_MS);
|
|
216
|
+
await sleep(POLL_MS$1);
|
|
220
217
|
}
|
|
221
218
|
return null;
|
|
222
219
|
}
|
|
223
|
-
async function
|
|
224
|
-
|
|
225
|
-
for (;;) {
|
|
226
|
-
const verdict = webLaunchVerdict({
|
|
227
|
-
records: readNdjsonGenerations(webLogFile(root)),
|
|
228
|
-
metroRecords: expectBundle ? readMetroRecords(workspaceLogsDir(root)) : [],
|
|
229
|
-
since,
|
|
230
|
-
expectBundle,
|
|
231
|
-
elapsedMs: Date.now() - startedAt
|
|
232
|
-
});
|
|
233
|
-
if (verdict) return verdict;
|
|
234
|
-
await sleep(POLL_MS);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
async function runWeb({ root, headed, note }) {
|
|
238
|
-
const startedAt = Date.now();
|
|
239
|
-
await ensureWorkspaceStorageSafely(root, { note });
|
|
240
|
-
if (!getProject(root)) upsertProject(root, {});
|
|
241
|
-
const settings = resolveSettings({
|
|
242
|
-
projectPath: root,
|
|
243
|
-
gitCommonDir: gitCommonDir(root),
|
|
244
|
-
repoRoot: repoRoot(root)
|
|
245
|
-
});
|
|
246
|
-
const [shapeError] = settingShapeErrors(settings);
|
|
247
|
-
if (shapeError) return failure("STIM_BAD_ARG", shapeError, SETTING_SHAPE_REMEDY);
|
|
248
|
-
const web = webSettings(settings);
|
|
249
|
-
const usesMetro = web.url === null || web.url.includes("{port:metro}");
|
|
250
|
-
const pin = usesMetro ? metroPortSetting(root) : null;
|
|
251
|
-
if (pin?.error) return failure("STIM_BAD_ARG", pin.error, SETTING_SHAPE_REMEDY);
|
|
252
|
-
const chrome = findChrome();
|
|
253
|
-
if (!chrome) return failure("STIM_WEB_NO_CHROME", "Google Chrome or Chromium is not installed.", CHROME_INSTALL_REMEDY);
|
|
254
|
-
if (web.url === null && !detectIsExpo(root)) return failure("STIM_WEB_NO_URL", "This is not an Expo app, so Stim does not know which page to open.", "Start your web dev server on a named port, then set the page: `stim settings set web.url 'http://localhost:{port:web}/' --scope workspace`. See `stim guide web`.");
|
|
255
|
-
if (web.url === null && !isPackageResolvable(root, "react-native-web")) return failure("STIM_WEB_DEPS_MISSING", "This Expo app cannot render on the web: react-native-web is not installed.", `Run \`${EXPO_WEB_DEPENDENCIES}\` and \`stim start\`, then run \`stim web\` again.`);
|
|
256
|
-
let metroPort = getProject(root)?.metroPort ?? null;
|
|
257
|
-
if (usesMetro && (pin?.port !== null || metroPort === null)) {
|
|
258
|
-
const result = await resolveWorkspaceMetroPort(root, note, "web");
|
|
259
|
-
if (typeof result !== "number") return failure(result.code, result.message, result.remedy);
|
|
260
|
-
metroPort = result;
|
|
261
|
-
}
|
|
262
|
-
const metro = usesMetro && metroPort !== null ? await resolveProjectMetro(metroPort, root) : null;
|
|
263
|
-
const supervisor = resolveSupervisorTarget({
|
|
264
|
-
state: readWorkspaceState(root)?.supervisor,
|
|
265
|
-
record: getProject(root)?.supervisor,
|
|
266
|
-
reservedPort: metroPort
|
|
267
|
-
});
|
|
268
|
-
const { serve, foreign } = webServePlan({
|
|
269
|
-
usesMetro,
|
|
270
|
-
metro,
|
|
271
|
-
supervisorHeld: supervisor.status !== "none" && supervisor.status !== "stale",
|
|
272
|
-
missingWebPackages: usesMetro && detectIsExpo(root) ? EXPO_WEB_PACKAGES.filter((name) => !isPackageResolvable(root, name)) : []
|
|
273
|
-
});
|
|
274
|
-
let url;
|
|
275
|
-
try {
|
|
276
|
-
url = await resolveWebUrl(web.url ?? "http://localhost:{port:metro}/", {
|
|
277
|
-
metroPort,
|
|
278
|
-
namedPort: (label) => getNamedPort(root, label)
|
|
279
|
-
});
|
|
280
|
-
} catch (error) {
|
|
281
|
-
return failure("STIM_BAD_ARG", `web.url: ${error.message}`, SETTING_SHAPE_REMEDY);
|
|
282
|
-
}
|
|
283
|
-
const config = {
|
|
284
|
-
chrome,
|
|
285
|
-
headless: !headed,
|
|
286
|
-
viewport: web.viewport,
|
|
287
|
-
ignoreCertificateErrors: web.ignoreCertificateErrors
|
|
288
|
-
};
|
|
289
|
-
const launch = await withWorkspaceProcessLock(workspaceDir(root), "web", async () => {
|
|
220
|
+
async function launchOwnedBrowser({ url, config }, { root, note }) {
|
|
221
|
+
return withWorkspaceProcessLock(workspaceDir(root), "web", async () => {
|
|
290
222
|
const live = liveWebRecord(readWebRecord(root));
|
|
291
223
|
if (live && sameLaunch(live, config)) {
|
|
292
224
|
const since = Date.now();
|
|
@@ -308,7 +240,7 @@ async function runWeb({ root, headed, note }) {
|
|
|
308
240
|
}
|
|
309
241
|
}
|
|
310
242
|
const stopped = await teardownBrowserHeld(root);
|
|
311
|
-
if (stopped.status === "failed" || stopped.status === "skipped") return failure("STIM_WEB_BROWSER_HELD", `The previous owned Chrome could not be stopped: ${stopped.reason ?? "unknown reason"}.`, "Run `stim status` and `stim guide errors teardown`.");
|
|
243
|
+
if (stopped.status === "failed" || stopped.status === "skipped") return failure$1("STIM_WEB_BROWSER_HELD", `The previous owned Chrome could not be stopped: ${stopped.reason ?? "unknown reason"}.`, "Run `stim status` and `stim guide errors teardown`.");
|
|
312
244
|
const port = await reserveBrowserPort(root);
|
|
313
245
|
const since = Date.now();
|
|
314
246
|
note(chalk.dim(phaseLine("device", `starting ${config.headless ? "headless " : ""}Chrome on DevTools port ${port}`)));
|
|
@@ -319,7 +251,7 @@ async function runWeb({ root, headed, note }) {
|
|
|
319
251
|
config,
|
|
320
252
|
launchId
|
|
321
253
|
}), launchId);
|
|
322
|
-
if (!record) return failure("STIM_WEB_LAUNCH_FAILED", "The owned Chrome did not start.", `Read ${webSupervisorLogFile(root)} and \`stim logs --errors\`, then run \`stim web\` again.`);
|
|
254
|
+
if (!record) return failure$1("STIM_WEB_LAUNCH_FAILED", "The owned Chrome did not start.", `Read ${webSupervisorLogFile(root)} and \`stim logs --errors\`, then run \`stim web\` again.`);
|
|
323
255
|
return {
|
|
324
256
|
ok: true,
|
|
325
257
|
record,
|
|
@@ -330,80 +262,110 @@ async function runWeb({ root, headed, note }) {
|
|
|
330
262
|
external: true,
|
|
331
263
|
ownerPurpose: "stim web"
|
|
332
264
|
});
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
launched: "unverified",
|
|
339
|
-
kind: "no-response",
|
|
340
|
-
reason: foreign.reason
|
|
341
|
-
} : measured;
|
|
342
|
-
const remedy = foreign ? foreign.remedy : webLaunchRemedy(verdict, {
|
|
343
|
-
url,
|
|
344
|
-
template: web.url,
|
|
345
|
-
usesMetro,
|
|
346
|
-
serve
|
|
347
|
-
});
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/integrations/browser-web.ts
|
|
268
|
+
const POLL_MS = 250;
|
|
269
|
+
function failure(code, message, remedy) {
|
|
348
270
|
return {
|
|
349
|
-
ok:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
version: record.version ?? null,
|
|
355
|
-
running: live !== null,
|
|
356
|
-
pid: live?.chromeProcess?.pid ?? null,
|
|
357
|
-
supervisorPid: live?.pid ?? null,
|
|
358
|
-
url,
|
|
359
|
-
headless: record.headless,
|
|
360
|
-
viewport: record.viewport,
|
|
361
|
-
profile: record.profile,
|
|
362
|
-
cdpEndpoint: live ? cdpEndpoint(live.cdpPort) : null,
|
|
363
|
-
targetId: live?.targetId ?? null,
|
|
364
|
-
reused: launch.reused,
|
|
365
|
-
launched: verdict.launched,
|
|
366
|
-
metroPort: usesMetro ? metroPort : null,
|
|
367
|
-
logs: { dir: workspaceLogsDir(root) },
|
|
368
|
-
durationMs: Date.now() - startedAt
|
|
271
|
+
ok: false,
|
|
272
|
+
error: {
|
|
273
|
+
code,
|
|
274
|
+
message,
|
|
275
|
+
remedy
|
|
369
276
|
}
|
|
370
277
|
};
|
|
371
278
|
}
|
|
372
|
-
function
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
root,
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
|
|
279
|
+
function browserWebProject(root) {
|
|
280
|
+
return { runtime: ({ settings, headed, note }) => ({
|
|
281
|
+
async prepare() {
|
|
282
|
+
const web = webSettings(settings);
|
|
283
|
+
const usesMetro = web.url === null || web.url.includes("{port:metro}");
|
|
284
|
+
const pin = usesMetro ? metroPortSetting(root) : null;
|
|
285
|
+
if (pin?.error) return failure("STIM_BAD_ARG", pin.error, SETTING_SHAPE_REMEDY);
|
|
286
|
+
const chrome = findChrome();
|
|
287
|
+
if (!chrome) return failure("STIM_WEB_NO_CHROME", "Google Chrome or Chromium is not installed.", CHROME_INSTALL_REMEDY);
|
|
288
|
+
if (web.url === null && !detectIsExpo(root)) return failure("STIM_WEB_NO_URL", "This is not an Expo app, so Stim does not know which page to open.", "Start your web dev server on a named port, then set the page: `stim settings set web.url 'http://localhost:{port:web}/' --scope workspace`. See `stim guide web`.");
|
|
289
|
+
if (web.url === null && !isPackageResolvable(root, "react-native-web")) return failure("STIM_WEB_DEPS_MISSING", "This Expo app cannot render on the web: react-native-web is not installed.", `Run \`${EXPO_WEB_DEPENDENCIES}\` and \`stim start\`, then run \`stim web\` again.`);
|
|
290
|
+
let metroPort = getProject(root)?.metroPort ?? null;
|
|
291
|
+
if (usesMetro && (pin?.port !== null || metroPort === null)) {
|
|
292
|
+
const result = await resolveWorkspaceMetroPort(root, note, "web");
|
|
293
|
+
if (typeof result !== "number") return failure(result.code, result.message, result.remedy);
|
|
294
|
+
metroPort = result;
|
|
295
|
+
}
|
|
296
|
+
const metro = usesMetro && metroPort !== null ? await resolveProjectMetro(metroPort, root) : null;
|
|
297
|
+
const supervisor = resolveSupervisorTarget({
|
|
298
|
+
state: readWorkspaceState(root)?.supervisor,
|
|
299
|
+
record: getProject(root)?.supervisor,
|
|
300
|
+
reservedPort: metroPort
|
|
301
|
+
});
|
|
302
|
+
const { serve, foreign } = webServePlan({
|
|
303
|
+
usesMetro,
|
|
304
|
+
metro,
|
|
305
|
+
supervisorHeld: supervisor.status !== "none" && supervisor.status !== "stale",
|
|
306
|
+
missingWebPackages: usesMetro && detectIsExpo(root) ? EXPO_WEB_PACKAGES.filter((name) => !isPackageResolvable(root, name)) : []
|
|
307
|
+
});
|
|
308
|
+
let url;
|
|
309
|
+
try {
|
|
310
|
+
url = await resolveWebUrl(web.url ?? "http://localhost:{port:metro}/", {
|
|
311
|
+
metroPort,
|
|
312
|
+
namedPort: (label) => getNamedPort(root, label)
|
|
313
|
+
});
|
|
314
|
+
} catch (error) {
|
|
315
|
+
return failure("STIM_BAD_ARG", `web.url: ${error.message}`, SETTING_SHAPE_REMEDY);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
ok: true,
|
|
319
|
+
prepared: {
|
|
320
|
+
url,
|
|
321
|
+
config: {
|
|
322
|
+
chrome,
|
|
323
|
+
headless: !headed,
|
|
324
|
+
viewport: web.viewport,
|
|
325
|
+
ignoreCertificateErrors: web.ignoreCertificateErrors
|
|
326
|
+
},
|
|
327
|
+
metroPort: usesMetro ? metroPort : null,
|
|
328
|
+
verification: {
|
|
329
|
+
template: web.url,
|
|
330
|
+
expectBundle: usesMetro,
|
|
331
|
+
serve,
|
|
332
|
+
foreign
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
launch: launchOwnedBrowser,
|
|
338
|
+
async verify({ url, verification: { template, expectBundle, serve, foreign } }, { since }) {
|
|
339
|
+
const startedAt = Date.now();
|
|
340
|
+
let measured;
|
|
341
|
+
for (;;) {
|
|
342
|
+
measured = webLaunchVerdict({
|
|
343
|
+
records: readNdjsonGenerations(webLogFile(root)),
|
|
344
|
+
metroRecords: expectBundle ? readMetroRecords(workspaceLogsDir(root)) : [],
|
|
345
|
+
since,
|
|
346
|
+
expectBundle,
|
|
347
|
+
elapsedMs: Date.now() - startedAt
|
|
348
|
+
});
|
|
349
|
+
if (measured) break;
|
|
350
|
+
await sleep(POLL_MS);
|
|
351
|
+
}
|
|
352
|
+
const verdict = foreign ? {
|
|
353
|
+
launched: "unverified",
|
|
354
|
+
kind: "no-response",
|
|
355
|
+
reason: foreign.reason
|
|
356
|
+
} : measured;
|
|
357
|
+
const remedy = foreign ? foreign.remedy : webLaunchRemedy(verdict, {
|
|
358
|
+
url,
|
|
359
|
+
template,
|
|
360
|
+
usesMetro: expectBundle,
|
|
361
|
+
serve
|
|
362
|
+
});
|
|
363
|
+
return {
|
|
364
|
+
verdict,
|
|
365
|
+
remedy: verdict.reason && remedy ? `${verdict.reason}. ${remedy}` : remedy
|
|
366
|
+
};
|
|
402
367
|
}
|
|
403
|
-
|
|
404
|
-
console.log(facts.running ? `${facts.url} ${launched} in ${facts.version ?? "Chrome"} (pid ${facts.pid}, ${facts.headless ? "headless" : "headed"}, ${facts.viewport}). DevTools: ${facts.cdpEndpoint}. Logs: stim logs --errors.` : `${facts.url} ${launched}, and the owned Chrome is no longer running. Run stim logs --errors, then stim web again.`);
|
|
405
|
-
if (links) console.error(chalk.dim(workspaceLinkLine(links)));
|
|
406
|
-
});
|
|
368
|
+
}) };
|
|
407
369
|
}
|
|
408
370
|
//#endregion
|
|
409
|
-
export {
|
|
371
|
+
export { browserWebProject };
|