stim 1.18.0 → 1.20.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 +21 -4
- package/dist/{activity-BxnkDZDi.mjs → activity-BrGh9EAI.mjs} +3 -3
- package/dist/{agent-device-usage-output-CZ66YA4T.mjs → agent-device-usage-output-DVyv_hWj.mjs} +7 -7
- package/dist/android-0vv-OruW.mjs +6 -0
- package/dist/android-Brx6EKvJ.mjs +1258 -0
- package/dist/{android-DC3ZLuw0.mjs → android-BsYNR81W.mjs} +103 -45
- package/dist/{android-CBwCNicO.mjs → android-CK3fpEyZ.mjs} +2 -2
- package/dist/{android-cas-BBFyr9CA.mjs → android-cas-DCAuXryb.mjs} +9 -5
- package/dist/android-cas-compiler.mjs +1 -1
- package/dist/api-run.mjs +159 -8
- package/dist/{api-D0VtFhqk.mjs → api-zuX3ynYN.mjs} +9 -7
- package/dist/api.d.mts +104 -4
- package/dist/api.mjs +1 -1
- package/dist/{app-install-D-PUENug.mjs → app-install-0LgaQRT7.mjs} +39 -18
- package/dist/artifact-CnC0mfov.mjs +807 -0
- package/dist/artifact-DClXJNWx.mjs +772 -0
- package/dist/artifact-lifecycle-DzPpBYvK.mjs +30 -0
- package/dist/{web-DTU0uiWj.mjs → browser-web-CzBmhmgs.mjs} +136 -174
- package/dist/{budget-DIhL2BKx.mjs → budget-BONq9vXY.mjs} +3096 -3244
- package/dist/build-BixRI6sB.mjs +462 -0
- package/dist/build-plan-CP0tckNU.mjs +553 -0
- package/dist/{cache-manifest-BI7ozfmH.mjs → cache-manifest-qA3dT2x2.mjs} +1 -1
- package/dist/cache-manifest.mjs +1 -1
- package/dist/ccache-CjHQ5F8g.mjs +142 -0
- package/dist/{chrome-DJnmnS5q.mjs → chrome-Dp2lMLBe.mjs} +1 -1
- package/dist/{cli-DNJMwADx.mjs → cli-B2R8wH1F.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/{client-DzhapoMB.mjs → client-BLy1Pw2V.mjs} +172 -165
- package/dist/collector-run.d.mts +10 -0
- package/dist/collector-run.mjs +7 -7
- package/dist/{command-output-CBtzyIgF.mjs → command-output-BjPN99ZB.mjs} +2 -2
- package/dist/{config-CgYMahz7.mjs → config-D0LhTY3S.mjs} +13 -13
- package/dist/{created-devices-DKbeWsiK.mjs → created-devices-HU_DAb_Q.mjs} +7 -6
- package/dist/{dependency-state-xKoOypBm.mjs → dependency-state-B2m8eqsS.mjs} +2 -2
- package/dist/{detached-entry-BLfcgc4O.mjs → detached-entry-BXq4fIl-.mjs} +1 -1
- package/dist/{dev-client-CLnIH02x.mjs → dev-client-ClATaJoH.mjs} +2 -2
- package/dist/{device-D7oCHGWi.mjs → device-B7lsC0K1.mjs} +8 -8
- package/dist/device-DVCwAFlX.mjs +727 -0
- package/dist/{device-capacity-EUOOYr8T.mjs → device-capacity-Ca_ke1LE.mjs} +25 -15
- package/dist/device-host-worker.mjs +38 -18
- package/dist/{device-ios-6MewKKnc.mjs → device-ios-CRUqPxKw.mjs} +12 -11
- package/dist/{device-lease-Co-EwifR.mjs → device-lease-DHOBXGgS.mjs} +135 -22
- package/dist/{device-lease-run-w1xhCqIW.mjs → device-lease-run-CvDeHTkG.mjs} +4 -4
- package/dist/{device-pool-F5WvRPtD.mjs → device-pool-L2-5GxMy.mjs} +3 -3
- package/dist/{device-remote-tHbd1fKy.mjs → device-remote-Bmg42063.mjs} +17 -69
- package/dist/doctor-C2MSuMMg.mjs +515 -0
- package/dist/{doctor-B9ckYUoU.mjs → doctor-DPAqhVCK.mjs} +334 -721
- package/dist/doctor-watchman-CB4NnVZm.mjs +260 -0
- package/dist/{simslim-EHBQ2R4G.mjs → eas-build-Dw_ec2Km.mjs} +6 -152
- package/dist/{stim-installations-aR_WsNOA.mjs → eas-session-ledger-DZlC-Fq3.mjs} +57 -4
- package/dist/{error-diagnostics-BRXOqDzG.mjs → error-diagnostics-Du7I_GuY.mjs} +17 -12
- package/dist/errors-DzkMYh8Q.mjs +205 -0
- package/dist/{exec-DWhCZDGm.mjs → exec-B81Qodjn.mjs} +69 -15
- package/dist/{gc-Dh6mXOKC.mjs → gc-PWp34zGb.mjs} +23 -22
- package/dist/{gradle-C6GKnunQ.mjs → gradle-C2OEKCCI.mjs} +50 -125
- package/dist/{guide-tm6igAaa.mjs → guide-Dai9lphv.mjs} +862 -538
- package/dist/{hosted-android-Bv285t_t.mjs → hosted-android-DQ-Agsd8.mjs} +5 -5
- package/dist/{hosted-client-C-rMtppF.mjs → hosted-client-Io01s5By.mjs} +9 -3
- package/dist/{hosted-ios-D5mNmtj4.mjs → hosted-ios-DIxFnYp-.mjs} +3 -3
- package/dist/{hosted-logs-DN8Iz4mJ.mjs → hosted-logs-DP-ABU_M.mjs} +8 -8
- package/dist/{hosted-macos-B-wEjlwG.mjs → hosted-macos-Aziw9T_9.mjs} +7 -6
- package/dist/{hosted-native-DeeOG8xZ.mjs → hosted-native-BdAQi21M.mjs} +23 -16
- package/dist/{idle-shutdown-jjtxAn5C.mjs → idle-shutdown-DdMqoSUB.mjs} +7 -7
- package/dist/ios-BZ9dg2Fr.mjs +9 -0
- package/dist/{ios-B3SbOWdw.mjs → ios-CXLIUxXJ.mjs} +180 -24
- package/dist/ios-CZuv6gRv.mjs +1112 -0
- package/dist/{ios-Bvbf0SGY.mjs → ios-VGvNdsv2.mjs} +1 -1
- package/dist/{ios-device-Bn7jWDB1.mjs → ios-device-B1B14xND.mjs} +1 -1
- package/dist/{ios-device-vOaByMhw.mjs → ios-device-BreZOpM0.mjs} +3 -3
- package/dist/ios-project-B9drt_aY.mjs +197 -0
- package/dist/{ios-state-B2pES6Vs.mjs → ios-state-CjrL2qv-.mjs} +1 -1
- package/dist/js-swap-C8icNYIY.mjs +432 -0
- package/dist/launch-DxH0THLP.mjs +745 -0
- package/dist/launch-YrbqaIFj.mjs +1530 -0
- package/dist/{launch-verify-hskNcWkZ.mjs → launch-verify-BzRdbuO1.mjs} +26 -7
- package/dist/{logs-1Ylc1Ri6.mjs → logs-DHaRNfg7.mjs} +11 -11
- package/dist/macos-C0iljhsN.mjs +2 -0
- package/dist/{macos-DF6C7wUU.mjs → macos-V_3Ui7g4.mjs} +125 -155
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +13 -10
- package/dist/{metro-Dh8T4Ytd.mjs → metro-D_j9sN-B.mjs} +209 -43
- package/dist/{metro-gateway-CEUw9RMH.mjs → metro-gateway-BBJldOdi.mjs} +2 -2
- package/dist/miss-reason-BPAzZS0r.mjs +238 -0
- package/dist/{named-ports-BFIz1Shz.mjs → named-ports-C2lvoPsb.mjs} +12 -5
- package/dist/native-android-lHzaew7r.mjs +226 -0
- package/dist/native-gradle-inputs-BQnIdAlL.mjs +356 -0
- package/dist/{native-runtime-D_603JiC.mjs → native-runtime-BRmWL7ru.mjs} +9 -8
- package/dist/native-xcode-inputs-eutS19jU.mjs +307 -0
- package/dist/native-xcode-ios-DP3cHLwu.mjs +434 -0
- package/dist/{ndjson-LGZAMsqa.mjs → ndjson-GOnbyvso.mjs} +6 -6
- package/dist/offload-worker.d.mts +12 -6
- package/dist/offload-worker.mjs +409 -73
- package/dist/{ownership-D6Se7gg_.mjs → ownership-DXzMMSx6.mjs} +2 -2
- package/dist/{placement-log-BcPhRwR4.mjs → placement-log-reFbjqEr.mjs} +7 -3
- package/dist/plan-BDk2AeY_.mjs +260 -0
- package/dist/plan-placement-D_YYlE6N.mjs +73 -0
- package/dist/{ports-BLTtfBq-.mjs → ports-jzvAJXXL.mjs} +3 -3
- package/dist/{prebuild-juCyreaR.mjs → prebuild-Bw44QxVh.mjs} +4 -4
- package/dist/{preview-D5V07Nrl.mjs → preview-BaBJ72Al.mjs} +51 -34
- package/dist/project-B8_duAzW.mjs +1067 -0
- package/dist/project-plan-BPwbLwQu.mjs +10 -0
- package/dist/{pull-request-u4vp7zmK.mjs → pull-request-vOhLNmIb.mjs} +1 -1
- package/dist/pull-requests.mjs +1 -1
- package/dist/react-native-android-chm1DMlA.mjs +921 -0
- package/dist/react-native-build-oAw6gQeW.mjs +239 -0
- package/dist/react-native-doctor-DYXoh-6I.mjs +78 -0
- package/dist/react-native-ios-SCTK_CT5.mjs +595 -0
- package/dist/{recordings-BAWltsVt.mjs → recordings-Bk-VivUV.mjs} +1 -1
- package/dist/{reload-DvyWzVjJ.mjs → reload-D34GkY78.mjs} +17 -14
- package/dist/remote-BU9UyhCJ.mjs +192 -0
- package/dist/{remote-cache-BGg7aGIZ.mjs → remote-cache-Bsts6f6Y.mjs} +5 -5
- package/dist/result-BDoRk1k3.mjs +186 -0
- package/dist/{run-vhtDgpHO.mjs → run-qvff78hv.mjs} +3 -3
- package/dist/{server-bare-B9E7S1aR.mjs → server-bare-dWjAarki.mjs} +6 -6
- package/dist/server-command-7XIKlWtO.mjs +69 -0
- package/dist/{server-expo-DoBHhuzK.mjs → server-expo-CsYu2aKL.mjs} +107 -82
- package/dist/server-expo-DV43vep4.mjs +2 -0
- package/dist/settings-Bbztm4oV.mjs +1503 -0
- package/dist/{settings-Byp2AQ_E.mjs → settings-CT3E71-i.mjs} +6 -7
- package/dist/{state-lKh8shBp.d.mts → settings-vk3mJGSm.d.mts} +4 -2
- package/dist/settings.schema.json +156 -6
- package/dist/simslim-ChMfe8rg.mjs +149 -0
- package/dist/{slot-launch-C1nqh4mu.mjs → slot-launch-B9hn96wd.mjs} +6 -6
- package/dist/{stage-g_WqWeaE.mjs → stage-BNKKdDNc.mjs} +6 -3
- package/dist/start-CbQCSnXQ.mjs +2 -0
- package/dist/{start-D-IeOyoK.mjs → start-CdvcTaXr.mjs} +113 -77
- package/dist/{state-xnqpx3AD.mjs → state-Boo0IMJq.mjs} +4 -2
- package/dist/{state-BG-aAk4k.mjs → state-DI84A-uu.mjs} +29 -10
- package/dist/{stats-DY6ekz8F.mjs → stats-BIIDrjA8.mjs} +6 -6
- package/dist/{status-BEeL6IKz.mjs → status-BDGHwkCs.mjs} +3 -1
- package/dist/{status-DCjZeE-K.mjs → status-DARMkc9q.mjs} +80 -294
- package/dist/status-watch-DvmI3SmN.mjs +296 -0
- package/dist/{stim-desktop-Behws_fi.mjs → stim-desktop-8GQX2OV8.mjs} +1 -1
- package/dist/{stop-DIJtD2GL.mjs → stop-CCZS-C9m.mjs} +2 -2
- package/dist/stop-WQPQHLuy.mjs +72 -0
- package/dist/{stop-BTjs3xbc.mjs → stop-iNemHsJC.mjs} +81 -33
- package/dist/supervisor-run.d.mts +7 -2
- package/dist/supervisor-run.mjs +32 -20
- package/dist/{support-Bwvbrq5-.mjs → support-CnE_SIjt.mjs} +17 -7
- package/dist/{support-BaayeYCf.mjs → support-DCco5fut.mjs} +61 -8
- package/dist/swiftpm-macos-afeNUExW.mjs +119 -0
- package/dist/{native-run-B06FkmZx.mjs → tailnet-CoJUb2tB.mjs} +113 -6
- package/dist/toolchain-BIupIro1.mjs +2 -0
- package/dist/{toolchain-Bnyd_K3A.mjs → toolchain-DqyDXs30.mjs} +225 -315
- package/dist/{trigger-CJMhwXe8.mjs → trigger-C0MWBi8O.mjs} +3 -3
- package/dist/trigger-SHLOWJ4O.mjs +2 -0
- package/dist/{warm-progress-CjB-MP6H.mjs → warm-progress-C3ASD6z5.mjs} +134 -37
- package/dist/{status-Dcr0Qexd.mjs → watchman-CQl51YZu.mjs} +75 -7
- package/dist/web-B3eldHFH.mjs +123 -0
- package/dist/web-BLXpOe6b.mjs +2 -0
- package/dist/web-run.mjs +10 -10
- package/dist/{workspace-state-C59dqG-Z.mjs → workspace-state-CSIFuuDa.mjs} +33 -33
- package/dist/{workspaces-xXItD8Dj.mjs → workspaces-D2xSHBDY.mjs} +1297 -1211
- package/dist/{worktree-BSYlofkq.mjs → worktree-BxDqaTev.mjs} +102 -63
- package/dist/worktree-q7_OZNY0.mjs +2 -0
- package/package.json +8 -6
- package/shim/bundle-response.cjs +2 -1
- package/shim/bundle-response.d.cts +1 -1
- package/shim/expo-metro-config.cjs +1 -1
- package/shim/native-android.gradle +101 -0
- package/dist/android-BKA16DTf.mjs +0 -4
- package/dist/android-BvwuMUJ9.mjs +0 -3572
- package/dist/guide-status-Bhf9SJXc.mjs +0 -125
- package/dist/ios-CPdkoKaa.mjs +0 -3953
- package/dist/ios-DNpdygiv.mjs +0 -7
- package/dist/macos-Ck7OBMNY.mjs +0 -2
- package/dist/metro-store-BAHFcJm6.mjs +0 -106
- package/dist/plan-placement-CtxkCO54.mjs +0 -1859
- package/dist/project-C3ChRLZy.mjs +0 -212
- package/dist/projects-DD7dBTCj.mjs +0 -92
- package/dist/server-expo-Db9HBUoa.mjs +0 -2
- package/dist/settings-CQyMElEP.mjs +0 -701
- package/dist/start-NTc1Ifqs.mjs +0 -2
- package/dist/stop-BGhKMOuH.mjs +0 -48
- package/dist/trigger-DWAq9hkw.mjs +0 -2
- package/dist/web-B6_bFDn7.mjs +0 -2
- package/dist/worktree-BJfnU6r5.mjs +0 -2
- package/dist/worktree-CsKYexJM.mjs +0 -753
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { r as register } from "./cache-manifest-qA3dT2x2.mjs";
|
|
2
|
+
import { g as sharedCompilationCache } from "./workspace-state-CSIFuuDa.mjs";
|
|
3
|
+
import { l as phaseLine } from "./command-output-BjPN99ZB.mjs";
|
|
4
|
+
import { S as resolvePackageJson } from "./project-B8_duAzW.mjs";
|
|
5
|
+
import { p as resolveOptimizations } from "./errors-DzkMYh8Q.mjs";
|
|
6
|
+
import { a as buildGradle, i as assembleTaskFor, n as BUILD_ERROR, o as parseProductFlavors, s as variantNameOf, t as ASSEMBLE_TASK } from "./gradle-C2OEKCCI.mjs";
|
|
7
|
+
import { C as compilationCacheSettings, N as swiftPrefixMappingSupported, O as pickXcodeProject, T as detectXcodeMajor, b as SWIFT_PREFIX_MAPPING_MIN_SWIFT, w as detectSwiftVersion, x as buildXcode } from "./toolchain-DqyDXs30.mjs";
|
|
8
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
9
|
+
import { join, relative } from "node:path";
|
|
10
|
+
import chalk from "chalk";
|
|
11
|
+
/** The ABI name a build for every ABI has to fit; `stim android` narrows a build to the device's. */
|
|
12
|
+
const LONGEST_ANDROID_ABI = "armeabi-v7a";
|
|
13
|
+
function androidPathRoom(root, { abi = null, variant = null, platform = process.platform } = {}) {
|
|
14
|
+
if (platform !== "win32") return null;
|
|
15
|
+
const abiName = abi ?? LONGEST_ANDROID_ABI;
|
|
16
|
+
const tail = 198 + (/release$/i.test(variant ?? "") ? 14 : 5) - 5 + abiName.length;
|
|
17
|
+
const longest = root.length + tail;
|
|
18
|
+
if (longest < 240) return null;
|
|
19
|
+
return {
|
|
20
|
+
root,
|
|
21
|
+
abi: abiName,
|
|
22
|
+
longest,
|
|
23
|
+
maxRootLength: 239 - tail
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function androidPathRoomMessage({ root, abi, longest, maxRootLength }) {
|
|
27
|
+
return `The project root ${root} is ${root.length} characters, so the longest known Android native object path (react_codegen_safeareacontext for ${abi}) reaches ${longest} characters, past the 239 the NDK's ninja can be given on Windows; the root can be at most ${maxRootLength} characters.`;
|
|
28
|
+
}
|
|
29
|
+
function androidPathRoomRemedy({ root }) {
|
|
30
|
+
return `Map the project to a drive letter (\`subst X: "${root}"\`) and run Stim from X:\\, or move it under a shorter root.`;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/integrations/react-native-build.ts
|
|
34
|
+
function gradlewPath(layout) {
|
|
35
|
+
return join(layout.gradleRoot, process.platform === "win32" ? "gradlew.bat" : "gradlew");
|
|
36
|
+
}
|
|
37
|
+
function apkOutputsDir(layout) {
|
|
38
|
+
return join(layout.moduleDir, "build", "outputs", "apk");
|
|
39
|
+
}
|
|
40
|
+
function discoverAndroidProject(root, layout) {
|
|
41
|
+
const dir = layout.gradleRoot;
|
|
42
|
+
if (!existsSync(dir)) return {
|
|
43
|
+
failed: true,
|
|
44
|
+
code: BUILD_ERROR,
|
|
45
|
+
reason: `No ${relative(root, dir) || "."}/ directory in ${root}.`,
|
|
46
|
+
remedy: "Generate it (`npx expo prebuild -p android`, which `stim android` runs itself on an Expo project) or check out the native sources."
|
|
47
|
+
};
|
|
48
|
+
const gradlew = gradlewPath(layout);
|
|
49
|
+
if (!existsSync(gradlew)) return {
|
|
50
|
+
failed: true,
|
|
51
|
+
code: BUILD_ERROR,
|
|
52
|
+
reason: `${gradlew} does not exist, so there is no gradle wrapper to build with.`,
|
|
53
|
+
remedy: `Restore the wrapper (\`gradle wrapper\` in ${relative(root, dir) || "."}/, or regenerate the project with \`npx expo prebuild -p android --clean\`).`
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
androidDir: dir,
|
|
57
|
+
gradlew
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function readProductFlavors(layout) {
|
|
61
|
+
return parseProductFlavors(readOrNull(join(layout.moduleDir, "build.gradle")));
|
|
62
|
+
}
|
|
63
|
+
function productFlavorRefusal({ flavors, variant }) {
|
|
64
|
+
if (variant) return null;
|
|
65
|
+
if (!flavors.known || flavors.dimensions.length === 0) return null;
|
|
66
|
+
let combinations = [[]];
|
|
67
|
+
for (const group of flavors.dimensions) combinations = combinations.flatMap((combination) => group.map((flavor) => combination.concat(flavor)));
|
|
68
|
+
if (combinations.length < 2) return null;
|
|
69
|
+
const count = flavors.dimensions.reduce((total, group) => total + group.length, 0);
|
|
70
|
+
const variants = combinations.map((combination) => variantNameOf(combination.concat("debug")));
|
|
71
|
+
return {
|
|
72
|
+
code: "STIM_BAD_ARG",
|
|
73
|
+
reason: `android/app/build.gradle declares ${count} product flavors, so \`./gradlew ${ASSEMBLE_TASK}\` builds an APK for each of them and nothing says which flavor to install.`,
|
|
74
|
+
remedy: `Pass \`--variant ${variants[0]}\` or set the android.variant setting -- e.g. {"android": {"variant": "${variants[0]}"}} in .stim.json. The debug variants are: ${variants.join(", ")}.`
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function readOrNull(path) {
|
|
78
|
+
try {
|
|
79
|
+
return readFileSync(path, "utf-8");
|
|
80
|
+
} catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function buildAndroid({ root, layout, logWriter, variant = null, abi = null }, options = {}) {
|
|
85
|
+
const project = discoverAndroidProject(root, layout);
|
|
86
|
+
if (project.failed) return {
|
|
87
|
+
ok: false,
|
|
88
|
+
code: project.code,
|
|
89
|
+
reason: project.reason,
|
|
90
|
+
remedy: project.remedy,
|
|
91
|
+
diagnostics: [],
|
|
92
|
+
truncated: 0,
|
|
93
|
+
lastLines: [],
|
|
94
|
+
durationMs: 0
|
|
95
|
+
};
|
|
96
|
+
const room = androidPathRoom(root, {
|
|
97
|
+
abi,
|
|
98
|
+
variant,
|
|
99
|
+
platform: options.platform ?? process.platform
|
|
100
|
+
});
|
|
101
|
+
return buildGradle({
|
|
102
|
+
root,
|
|
103
|
+
logWriter,
|
|
104
|
+
variant,
|
|
105
|
+
project: {
|
|
106
|
+
directory: project.androidDir,
|
|
107
|
+
gradlew: project.gradlew,
|
|
108
|
+
module: layout.module,
|
|
109
|
+
outputsDir: apkOutputsDir(layout)
|
|
110
|
+
},
|
|
111
|
+
task: layout.custom ? `${layout.module}:${assembleTaskFor(variant)}` : assembleTaskFor(variant),
|
|
112
|
+
projectArgs: abi ? [`-PreactNativeArchitectures=${abi}`] : [],
|
|
113
|
+
preflightFailure: room ? {
|
|
114
|
+
code: "STIM_PATH_TOO_LONG",
|
|
115
|
+
reason: androidPathRoomMessage(room),
|
|
116
|
+
remedy: androidPathRoomRemedy(room)
|
|
117
|
+
} : null
|
|
118
|
+
}, options);
|
|
119
|
+
}
|
|
120
|
+
const PREBUILD_REMEDY = "Generate it with `npx expo prebuild -p ios` (stim ios does this automatically for an Expo project with no ios/ directory), or commit the native project.";
|
|
121
|
+
function buildFailure(message, remedy) {
|
|
122
|
+
return { error: {
|
|
123
|
+
code: "STIM_BUILD_FAILED",
|
|
124
|
+
message,
|
|
125
|
+
remedy
|
|
126
|
+
} };
|
|
127
|
+
}
|
|
128
|
+
function discoverXcodeProject(root, dir) {
|
|
129
|
+
let entries;
|
|
130
|
+
try {
|
|
131
|
+
entries = readdirSync(dir);
|
|
132
|
+
} catch {
|
|
133
|
+
return buildFailure(`No ${relative(root, dir) || "."}/ directory in ${root}.`, PREBUILD_REMEDY);
|
|
134
|
+
}
|
|
135
|
+
const picked = pickXcodeProject(entries);
|
|
136
|
+
if (!picked) return buildFailure(`${dir} contains no .xcworkspace and no .xcodeproj.`, PREBUILD_REMEDY);
|
|
137
|
+
return {
|
|
138
|
+
...picked,
|
|
139
|
+
dir,
|
|
140
|
+
appRoot: root,
|
|
141
|
+
path: join(dir, picked.file)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function ccacheEnabled(podfileProperties) {
|
|
145
|
+
if (!podfileProperties || typeof podfileProperties !== "object") return false;
|
|
146
|
+
return podfileProperties["apple.ccacheEnabled"] === "true";
|
|
147
|
+
}
|
|
148
|
+
function readPodfileProperties(iosDir) {
|
|
149
|
+
try {
|
|
150
|
+
const parsed = JSON.parse(readFileSync(join(iosDir, "Podfile.properties.json"), "utf-8"));
|
|
151
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
152
|
+
} catch {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const SWIFT_CACHE_MIN_REACT_NATIVE = {
|
|
157
|
+
major: 0,
|
|
158
|
+
minor: 87
|
|
159
|
+
};
|
|
160
|
+
function reactNativeSupportsSwiftCache(version) {
|
|
161
|
+
if (!version) return false;
|
|
162
|
+
const min = SWIFT_CACHE_MIN_REACT_NATIVE;
|
|
163
|
+
return version.major > min.major || version.major === min.major && version.minor >= min.minor;
|
|
164
|
+
}
|
|
165
|
+
function parseReactNativeVersion(packageJson) {
|
|
166
|
+
if (!packageJson || typeof packageJson !== "object") return null;
|
|
167
|
+
const raw = packageJson.version;
|
|
168
|
+
const m = typeof raw === "string" ? /^(\d+)\.(\d+)\./.exec(raw) : null;
|
|
169
|
+
if (!m || m[1] === void 0 || m[2] === void 0) return null;
|
|
170
|
+
return {
|
|
171
|
+
major: parseInt(m[1], 10),
|
|
172
|
+
minor: parseInt(m[2], 10)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function detectReactNativeVersion(root) {
|
|
176
|
+
const file = resolvePackageJson(root, "react-native");
|
|
177
|
+
if (!file) return null;
|
|
178
|
+
try {
|
|
179
|
+
return parseReactNativeVersion(JSON.parse(readFileSync(file, "utf-8")));
|
|
180
|
+
} catch {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function reactNativeCompilationCacheSettings({ reactNativeVersion = null, ...options }) {
|
|
185
|
+
return compilationCacheSettings({
|
|
186
|
+
...options,
|
|
187
|
+
swiftCacheCompatible: reactNativeSupportsSwiftCache(reactNativeVersion)
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function resolveCompilationCacheSettings({ root, iosDir, derivedDataPath, exec = null, casPath = sharedCompilationCache(), optimizations = resolveOptimizations({}, {}).ios, onNote = (line) => console.error(line) }) {
|
|
191
|
+
const xcodeMajor = detectXcodeMajor(exec);
|
|
192
|
+
const ccache = ccacheEnabled(readPodfileProperties(iosDir));
|
|
193
|
+
const probe = xcodeMajor !== null && xcodeMajor >= 26 && !ccache && optimizations.compilationCache && optimizations.swiftCompilationCache !== false;
|
|
194
|
+
const swiftVersion = probe ? detectSwiftVersion(exec) : null;
|
|
195
|
+
const reactNativeVersion = probe ? detectReactNativeVersion(root) : null;
|
|
196
|
+
const settings = reactNativeCompilationCacheSettings({
|
|
197
|
+
workspaceRoot: root,
|
|
198
|
+
derivedDataPath,
|
|
199
|
+
casPath,
|
|
200
|
+
xcodeMajor,
|
|
201
|
+
swiftVersion,
|
|
202
|
+
reactNativeVersion,
|
|
203
|
+
ccache,
|
|
204
|
+
optimizations
|
|
205
|
+
});
|
|
206
|
+
if (settings.length > 0 && optimizations.compilationCache) {
|
|
207
|
+
register({
|
|
208
|
+
dir: casPath,
|
|
209
|
+
name: "Xcode compilation cache",
|
|
210
|
+
prune: "atomic",
|
|
211
|
+
note: "shared Xcode compilation cache"
|
|
212
|
+
});
|
|
213
|
+
const swift = settings.includes("SWIFT_ENABLE_COMPILE_CACHE=YES") ? settings.includes("SWIFT_ENABLE_PREFIX_MAPPING=YES") ? "Swift on" : "Swift on, unmapped" : swiftVersion && !swiftPrefixMappingSupported(swiftVersion) ? `Swift off, ${swiftVersion.major}.${swiftVersion.minor} < ${SWIFT_PREFIX_MAPPING_MIN_SWIFT.major}.${SWIFT_PREFIX_MAPPING_MIN_SWIFT.minor}` : swiftVersion && reactNativeVersion && !reactNativeSupportsSwiftCache(reactNativeVersion) ? `Swift off, react-native ${reactNativeVersion.major}.${reactNativeVersion.minor} < ${SWIFT_CACHE_MIN_REACT_NATIVE.major}.${SWIFT_CACHE_MIN_REACT_NATIVE.minor}` : "Swift off";
|
|
214
|
+
onNote(chalk.dim(phaseLine("cache", `compilation cache on (CAS at ${casPath}, ${swift})`)));
|
|
215
|
+
}
|
|
216
|
+
return settings;
|
|
217
|
+
}
|
|
218
|
+
async function buildIos(inputs) {
|
|
219
|
+
const { root, iosDir, logWriter, udid, destination, now = () => Date.now() } = inputs;
|
|
220
|
+
if (!root || typeof root !== "string") throw new TypeError("buildIos requires {root}");
|
|
221
|
+
if (!logWriter || typeof logWriter.write !== "function") throw new TypeError("buildIos requires {logWriter} with a write() method");
|
|
222
|
+
if (!udid && !destination) throw new TypeError("buildIos requires {udid} (or an explicit {destination})");
|
|
223
|
+
const startedAt = now();
|
|
224
|
+
return buildXcode({
|
|
225
|
+
...inputs,
|
|
226
|
+
startedAt,
|
|
227
|
+
project: inputs.project ?? discoverXcodeProject(root, iosDir),
|
|
228
|
+
compilationCache: inputs.compilationCache === void 0 ? ({ derivedDataPath, exec }) => resolveCompilationCacheSettings({
|
|
229
|
+
root,
|
|
230
|
+
iosDir,
|
|
231
|
+
derivedDataPath,
|
|
232
|
+
exec,
|
|
233
|
+
optimizations: inputs.optimizations,
|
|
234
|
+
onNote: inputs.onNote
|
|
235
|
+
}) : inputs.compilationCache
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
export { discoverXcodeProject as a, readProductFlavors as c, androidPathRoomRemedy as d, ccacheEnabled as i, androidPathRoom as l, buildAndroid as n, gradlewPath as o, buildIos as r, productFlavorRefusal as s, apkOutputsDir as t, androidPathRoomMessage as u };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { G as resolveIosProjectDir, U as resolveAndroidLayout } from "./settings-Bbztm4oV.mjs";
|
|
2
|
+
import { l as phaseLine } from "./command-output-BjPN99ZB.mjs";
|
|
3
|
+
import { _ as detectIsExpo } from "./project-B8_duAzW.mjs";
|
|
4
|
+
import { I as bundlerPin, i as iosToolchainAsync, n as androidToolchain, t as androidRequirements } from "./toolchain-DqyDXs30.mjs";
|
|
5
|
+
import { a as repairCxxLauncherState, n as detectLinkedLibraryGitMetadata, r as reactNativeDoctorFindings, t as detectFingerprintParity } from "./doctor-DPAqhVCK.mjs";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
//#region src/integrations/react-native-doctor.ts
|
|
8
|
+
function reactNativeProjectDoctor(root) {
|
|
9
|
+
return {
|
|
10
|
+
inspect: reactNativeDoctorFindings,
|
|
11
|
+
async inspectAsync({ options: { platform }, settings }) {
|
|
12
|
+
const parity = await detectFingerprintParity(root, {
|
|
13
|
+
platform,
|
|
14
|
+
iosProjectPath: resolveIosProjectDir(settings, root).relative
|
|
15
|
+
});
|
|
16
|
+
const linkedGit = await detectLinkedLibraryGitMetadata(root, { platform });
|
|
17
|
+
return [parity, linkedGit?.code === parity?.code ? null : linkedGit].filter((finding) => finding !== null);
|
|
18
|
+
},
|
|
19
|
+
offloadTargets({ options: { platform, host = process.platform }, settings, repoRoot }, iosRuntime) {
|
|
20
|
+
const checksIos = platform !== "android" && host === "darwin";
|
|
21
|
+
const androidDir = resolveAndroidLayout(settings, root, repoRoot ?? root).gradleRoot;
|
|
22
|
+
const checksAndroid = platform === "android" || platform === void 0 && (existsSync(androidDir) || detectIsExpo(root));
|
|
23
|
+
if (!checksIos && !checksAndroid) return null;
|
|
24
|
+
return async () => {
|
|
25
|
+
const targets = [];
|
|
26
|
+
if (checksIos) {
|
|
27
|
+
const [local, runtime] = await Promise.all([iosToolchainAsync(root), iosRuntime()]);
|
|
28
|
+
targets.push({
|
|
29
|
+
platform: "ios",
|
|
30
|
+
local,
|
|
31
|
+
runtime,
|
|
32
|
+
cocoapodsPinned: bundlerPin(root) !== null
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (checksAndroid) targets.push({
|
|
36
|
+
platform: "android",
|
|
37
|
+
local: androidToolchain(),
|
|
38
|
+
requires: androidRequirements(root)
|
|
39
|
+
});
|
|
40
|
+
return targets;
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
repair: (platform, settings, repoRoot) => platform === "ios" ? {
|
|
44
|
+
removed: [],
|
|
45
|
+
refused: []
|
|
46
|
+
} : repairCxxLauncherState(root, settings, resolveAndroidLayout(settings, root, repoRoot ?? root)),
|
|
47
|
+
successLines: reactNativeDoctorSuccessLines
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function reactNativeDoctorSuccessLines(platform) {
|
|
51
|
+
const lines = [
|
|
52
|
+
"",
|
|
53
|
+
"Project",
|
|
54
|
+
phaseLine("project", "source checkout, dependencies, local upstream, nested worktrees Watchman would crawl")
|
|
55
|
+
];
|
|
56
|
+
if (platform !== "android") {
|
|
57
|
+
lines.push("", "iOS");
|
|
58
|
+
lines.push(phaseLine("setup", "CocoaPods, warm state, effective Debug simulator architectures"));
|
|
59
|
+
lines.push(phaseLine("caches", "Metro, Xcode compilation, ccache, build provider"));
|
|
60
|
+
lines.push(phaseLine("devices", "remote device, SimSlim profile"));
|
|
61
|
+
}
|
|
62
|
+
if (platform !== "ios") {
|
|
63
|
+
lines.push("", "Android");
|
|
64
|
+
lines.push(phaseLine("setup", "Android SDK, warm state"));
|
|
65
|
+
lines.push(phaseLine("caches", "Metro, Gradle, ccache, build provider"));
|
|
66
|
+
lines.push(phaseLine("devices", "remote device"));
|
|
67
|
+
}
|
|
68
|
+
lines.push("", "Expo and React Native");
|
|
69
|
+
lines.push(phaseLine("services", "EAS session"));
|
|
70
|
+
lines.push(phaseLine("fingerprint", "parity when dependencies are absent"));
|
|
71
|
+
lines.push("", "Handled automatically");
|
|
72
|
+
const suppliedCaches = platform === "ios" ? "Metro transform store, Xcode compilation cache" : platform === "android" ? "Metro transform store, Gradle build cache, ccache" : "Metro transform store, Xcode compilation cache, Gradle build cache, ccache";
|
|
73
|
+
lines.push(phaseLine("caches", suppliedCaches));
|
|
74
|
+
lines.push(phaseLine("meaning", "missing project cache settings are healthy"));
|
|
75
|
+
return lines;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { reactNativeProjectDoctor };
|