sootsim 0.0.1 → 0.0.3

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.
Files changed (122) hide show
  1. package/README.md +12 -0
  2. package/dist-cli/bin.js +16 -10
  3. package/dist-cli/chunks/agent-D5NBV32O.js +61 -0
  4. package/dist-cli/chunks/agent-wrapper-Y7I5QGHM.js +15 -0
  5. package/dist-cli/chunks/assert-EJ7DQS2H.js +47 -0
  6. package/dist-cli/chunks/auto-bootstrap-Q7GNLISM.js +2 -0
  7. package/dist-cli/chunks/{chunk-7X6OPSRD.js → chunk-2FPPPJE5.js} +2 -2
  8. package/dist-cli/chunks/{chunk-G5MR66EB.js → chunk-3K6VDPVD.js} +2 -2
  9. package/dist-cli/chunks/{chunk-PWXPA745.js → chunk-3SLEIN6B.js} +1 -1
  10. package/dist-cli/chunks/chunk-3WPAEUOO.js +1 -0
  11. package/dist-cli/chunks/chunk-44CBTM22.js +2 -0
  12. package/dist-cli/chunks/chunk-46LRF7PH.js +5 -0
  13. package/dist-cli/chunks/chunk-4RYT6AQV.js +16 -0
  14. package/dist-cli/chunks/chunk-5AG24UFX.js +119 -0
  15. package/dist-cli/chunks/chunk-5IPP4HAW.js +5 -0
  16. package/dist-cli/chunks/{chunk-J2S3OCWA.js → chunk-AFTHIY3L.js} +1 -1
  17. package/dist-cli/chunks/chunk-BU3TZP4Y.js +11 -0
  18. package/dist-cli/chunks/chunk-BYLX2DO4.js +27 -0
  19. package/dist-cli/chunks/chunk-CPMW2QLM.js +1 -0
  20. package/dist-cli/chunks/{chunk-YCETS3B3.js → chunk-CQ6PX2EU.js} +2 -2
  21. package/dist-cli/chunks/chunk-D4JFMCXD.js +2 -0
  22. package/dist-cli/chunks/chunk-EEBR5YP5.js +62 -0
  23. package/dist-cli/chunks/chunk-EQ7G3UHS.js +4 -0
  24. package/dist-cli/chunks/{chunk-64TOMNZX.js → chunk-FTRI7SVV.js} +2 -2
  25. package/dist-cli/chunks/{chunk-GPVPHE2B.js → chunk-H3JVJXOC.js} +2 -2
  26. package/dist-cli/chunks/chunk-LV5U7TI4.js +1 -0
  27. package/dist-cli/chunks/chunk-NKJLTISU.js +4 -0
  28. package/dist-cli/chunks/chunk-O2HBPZW5.js +22 -0
  29. package/dist-cli/chunks/{chunk-KSACMDXK.js → chunk-OG5CKIPC.js} +2 -2
  30. package/dist-cli/chunks/{chunk-E522F5JW.js → chunk-P5C3UASK.js} +1 -1
  31. package/dist-cli/chunks/chunk-REYWQVAH.js +2 -0
  32. package/dist-cli/chunks/chunk-RLS6PHBW.js +4 -0
  33. package/dist-cli/chunks/chunk-SUZR2SZZ.js +34 -0
  34. package/dist-cli/chunks/{chunk-OROM7DZI.js → chunk-USRNDVQ3.js} +1 -1
  35. package/dist-cli/chunks/{chunk-JSF5LPNT.js → chunk-UZL5ZZ4E.js} +5 -5
  36. package/dist-cli/chunks/{chunk-QOBRRY5X.js → chunk-VI3VW5BL.js} +1 -1
  37. package/dist-cli/chunks/chunk-WUYJFYOW.js +2 -0
  38. package/dist-cli/chunks/chunk-X2W4IRXK.js +3 -0
  39. package/dist-cli/chunks/chunk-XJBPH4JR.js +308 -0
  40. package/dist-cli/chunks/chunk-ZSRMXBGK.js +2 -0
  41. package/dist-cli/chunks/{compat-MRN2ORY5.js → compat-5KSMOWLB.js} +4 -4
  42. package/dist-cli/chunks/{config-CO5IYWUY.js → config-NJB6PQHU.js} +5 -5
  43. package/dist-cli/chunks/control-2F3AGZAO.js +2 -0
  44. package/dist-cli/chunks/{daemon-G4XVRFHM.js → daemon-MLG65V4S.js} +2 -2
  45. package/dist-cli/chunks/{debug-ZNSZTWT6.js → debug-QVOBTTLP.js} +4 -4
  46. package/dist-cli/chunks/demo-app-registry-XRYNJ4GC.js +2 -0
  47. package/dist-cli/chunks/{detox-JEGYNTYV.js → detox-ZZSNZL4T.js} +2 -2
  48. package/dist-cli/chunks/{device-BS34FAFM.js → device-PQB3YGHN.js} +2 -2
  49. package/dist-cli/chunks/drivers-GWDQEGWD.js +2 -0
  50. package/dist-cli/chunks/electron-JB26VHOO.js +15 -0
  51. package/dist-cli/chunks/flow-7JRQXMFV.js +2 -0
  52. package/dist-cli/chunks/{hints-7Z656W4H.js → hints-IGYDXXDS.js} +2 -2
  53. package/dist-cli/chunks/home-paths-CEGSGQTD.js +2 -0
  54. package/dist-cli/chunks/{inspect-NAHXP2M5.js → inspect-DSU6ELRM.js} +153 -165
  55. package/dist-cli/chunks/install-K6IJKADG.js +65 -0
  56. package/dist-cli/chunks/{install-desktop-PYIZIH67.js → install-desktop-SC3LNFFF.js} +8 -4
  57. package/dist-cli/chunks/install-dev-desktop-4DP3UY2X.js +100 -0
  58. package/dist-cli/chunks/keys-R5LAPAAL.js +19 -0
  59. package/dist-cli/chunks/launch-K3WJV4QA.js +16 -0
  60. package/dist-cli/chunks/{login-Z5Z54HUJ.js → login-A23PYJAW.js} +5 -5
  61. package/dist-cli/chunks/{logout-T2QDYGCB.js → logout-AJ24PH5O.js} +2 -2
  62. package/dist-cli/chunks/{maestro-4AXTS7OE.js → maestro-YALWKKGU.js} +2 -2
  63. package/dist-cli/chunks/{preview-NMGWHWMX.js → preview-D35EEONY.js} +2 -2
  64. package/dist-cli/chunks/{profile-6RGJA4FR.js → profile-MAF7NM5Q.js} +3 -3
  65. package/dist-cli/chunks/record-ZCPQNGFW.js +37 -0
  66. package/dist-cli/chunks/runtime-Z2WIXYUN.js +25 -0
  67. package/dist-cli/chunks/{screenshot-R3GCCSCI.js → screenshot-NQVZYC3C.js} +3 -3
  68. package/dist-cli/chunks/screenshot-mode-E45D2ZFH.js +17 -0
  69. package/dist-cli/chunks/{screenshots-4UQJE4NC.js → screenshots-I4SQI4DA.js} +2 -2
  70. package/dist-cli/chunks/server-ZUXKJRR5.js +29 -0
  71. package/dist-cli/chunks/{skills-2PPKPL4B.js → skills-N4U63E5W.js} +2 -2
  72. package/dist-cli/chunks/store-4A6X4GBJ.js +2 -0
  73. package/dist-cli/chunks/{test-5LFKOQ4M.js → test-VBD6N3AR.js} +3 -3
  74. package/dist-cli/chunks/upload-Y6FZ5XF2.js +2 -0
  75. package/dist-cli/chunks/{whoami-H6FW34JS.js → whoami-4K6JGMWH.js} +2 -2
  76. package/dist-lib/agent-daemon-client.cjs +414 -0
  77. package/dist-lib/agent-events.cjs +48 -0
  78. package/dist-lib/agent-sessions.cjs +692 -0
  79. package/dist-lib/attached-projects.cjs +448 -0
  80. package/dist-lib/auth/shared-session.cjs +174 -0
  81. package/dist-lib/backend-origin.cjs +70 -0
  82. package/dist-lib/bridge-constants.cjs +32 -0
  83. package/dist-lib/cli-constants.cjs +32 -0
  84. package/dist-lib/config.cjs +88 -0
  85. package/dist-lib/dev-bundle-resolution.cjs +236 -0
  86. package/dist-lib/home-paths.cjs +234 -0
  87. package/dist-lib/host/bridge-host.cjs +3458 -0
  88. package/dist-lib/index.cjs +361 -0
  89. package/dist-lib/metro.cjs +215 -0
  90. package/dist-lib/render-mode.cjs +54 -0
  91. package/dist-lib/vite-base.cjs +4217 -0
  92. package/dist-lib/vite.cjs +178 -0
  93. package/package.json +80 -13
  94. package/scripts/postinstall.cjs +70 -0
  95. package/dist-cli/chunks/bridge-host-2EY7Z4AO.js +0 -2
  96. package/dist-cli/chunks/chunk-3C3ZH7PP.js +0 -4
  97. package/dist-cli/chunks/chunk-3R4ZZESY.js +0 -119
  98. package/dist-cli/chunks/chunk-74XPLOV4.js +0 -2
  99. package/dist-cli/chunks/chunk-7LMDCMSI.js +0 -8
  100. package/dist-cli/chunks/chunk-A2CZQIWO.js +0 -1
  101. package/dist-cli/chunks/chunk-CKZ376AY.js +0 -322
  102. package/dist-cli/chunks/chunk-E5UBZEYR.js +0 -2
  103. package/dist-cli/chunks/chunk-HOIHCO7S.js +0 -3
  104. package/dist-cli/chunks/chunk-KQWZZ56P.js +0 -2
  105. package/dist-cli/chunks/chunk-KSB6MSZ4.js +0 -34
  106. package/dist-cli/chunks/chunk-KXYKAYYB.js +0 -51
  107. package/dist-cli/chunks/chunk-MBFP2LVH.js +0 -3
  108. package/dist-cli/chunks/chunk-MPSZ5EWF.js +0 -16
  109. package/dist-cli/chunks/chunk-X2U72K7X.js +0 -1
  110. package/dist-cli/chunks/control-Y7TKKB6D.js +0 -2
  111. package/dist-cli/chunks/dev-ZUKCZQEX.js +0 -25
  112. package/dist-cli/chunks/dev-checkout-IEZVVTCN.js +0 -2
  113. package/dist-cli/chunks/drivers-46PFFIDF.js +0 -2
  114. package/dist-cli/chunks/electron-P2KOPX2S.js +0 -15
  115. package/dist-cli/chunks/flow-VVOF6UNC.js +0 -2
  116. package/dist-cli/chunks/install-EPUJX4AT.js +0 -67
  117. package/dist-cli/chunks/record-IE27Z2GA.js +0 -37
  118. package/dist-cli/chunks/screenshot-mode-SZQDNGYE.js +0 -17
  119. package/dist-cli/chunks/server-AN2G5KO4.js +0 -21
  120. package/dist-cli/chunks/store-PU5ES4YQ.js +0 -2
  121. package/dist-cli/chunks/upload-BYNPC54C.js +0 -2
  122. package/dist-cli/chunks/vite-plugin-5AEUUBKP.js +0 -9
@@ -0,0 +1,32 @@
1
+ /*! sootsim v0.0.3 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/bridge-constants.ts
23
+ var bridge_constants_exports = {};
24
+ __export(bridge_constants_exports, {
25
+ DEFAULT_SOOTSIM_BRIDGE_PORT: () => DEFAULT_SOOTSIM_BRIDGE_PORT
26
+ });
27
+ module.exports = __toCommonJS(bridge_constants_exports);
28
+ var DEFAULT_SOOTSIM_BRIDGE_PORT = 7668;
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ DEFAULT_SOOTSIM_BRIDGE_PORT
32
+ });
@@ -0,0 +1,32 @@
1
+ /*! sootsim v0.0.3 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/cli-constants.ts
23
+ var cli_constants_exports = {};
24
+ __export(cli_constants_exports, {
25
+ DEFAULT_SOOTSIM_SHELL_URL: () => DEFAULT_SOOTSIM_SHELL_URL
26
+ });
27
+ module.exports = __toCommonJS(cli_constants_exports);
28
+ var DEFAULT_SOOTSIM_SHELL_URL = "http://localhost:5173/";
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ DEFAULT_SOOTSIM_SHELL_URL
32
+ });
@@ -0,0 +1,88 @@
1
+ /*! sootsim v0.0.3 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/config.ts
23
+ var config_exports = {};
24
+ __export(config_exports, {
25
+ SOOTSIM_CONFIG_QUERY_PARAM: () => SOOTSIM_CONFIG_QUERY_PARAM,
26
+ applySootSimConfigToUrl: () => applySootSimConfigToUrl,
27
+ defineConfig: () => defineConfig,
28
+ hasSootSimConfig: () => hasSootSimConfig,
29
+ mergeSootSimConfig: () => mergeSootSimConfig,
30
+ readSootSimConfigFromSearchParams: () => readSootSimConfigFromSearchParams
31
+ });
32
+ module.exports = __toCommonJS(config_exports);
33
+ var SOOTSIM_CONFIG_QUERY_PARAM = "sootsimConfig";
34
+ function defineConfig(config) {
35
+ return config;
36
+ }
37
+ function hasOwnKeys(value) {
38
+ return !!value && Object.keys(value).length > 0;
39
+ }
40
+ function hasSootSimConfig(config) {
41
+ if (!config) return false;
42
+ return hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.env) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialState);
43
+ }
44
+ function mergeSootSimConfig(base, override) {
45
+ if (!hasSootSimConfig(base) && !hasSootSimConfig(override)) return void 0;
46
+ if (!hasSootSimConfig(base)) return override ? { ...override } : void 0;
47
+ if (!hasSootSimConfig(override)) return base ? { ...base } : void 0;
48
+ return {
49
+ modules: { ...base.modules || {}, ...override.modules || {} },
50
+ turboModules: { ...base.turboModules || {}, ...override.turboModules || {} },
51
+ env: { ...base.env || {}, ...override.env || {} },
52
+ settings: {
53
+ ...base.settings || {},
54
+ ...override.settings || {}
55
+ },
56
+ initialState: { ...base.initialState || {}, ...override.initialState || {} }
57
+ };
58
+ }
59
+ function readSootSimConfigFromSearchParams(searchParams) {
60
+ const raw = searchParams.get(SOOTSIM_CONFIG_QUERY_PARAM);
61
+ if (!raw) return void 0;
62
+ try {
63
+ const parsed = JSON.parse(raw);
64
+ return hasSootSimConfig(parsed) ? parsed : void 0;
65
+ } catch (error) {
66
+ const message = error instanceof Error ? error.message : String(error);
67
+ console.warn(`[sootsim] invalid ${SOOTSIM_CONFIG_QUERY_PARAM}: ${message}`);
68
+ return void 0;
69
+ }
70
+ }
71
+ function applySootSimConfigToUrl(url, config) {
72
+ const parsed = new URL(url);
73
+ if (hasSootSimConfig(config)) {
74
+ parsed.searchParams.set(SOOTSIM_CONFIG_QUERY_PARAM, JSON.stringify(config));
75
+ } else {
76
+ parsed.searchParams.delete(SOOTSIM_CONFIG_QUERY_PARAM);
77
+ }
78
+ return parsed.toString();
79
+ }
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ SOOTSIM_CONFIG_QUERY_PARAM,
83
+ applySootSimConfigToUrl,
84
+ defineConfig,
85
+ hasSootSimConfig,
86
+ mergeSootSimConfig,
87
+ readSootSimConfigFromSearchParams
88
+ });
@@ -0,0 +1,236 @@
1
+ /*! sootsim v0.0.3 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/dev-bundle-resolution.ts
23
+ var dev_bundle_resolution_exports = {};
24
+ __export(dev_bundle_resolution_exports, {
25
+ DEFAULT_TEST_DRIVE_PORT: () => DEFAULT_TEST_DRIVE_PORT,
26
+ assumeDevBundleForPort: () => assumeDevBundleForPort,
27
+ inferManifestFramework: () => inferManifestFramework,
28
+ probePortBundle: () => probePortBundle,
29
+ resolveConnectionInput: () => resolveConnectionInput
30
+ });
31
+ module.exports = __toCommonJS(dev_bundle_resolution_exports);
32
+
33
+ // src/backend-origin.ts
34
+ function normalizeHostname(hostname) {
35
+ return hostname.replace(/^\[|\]$/g, "").toLowerCase();
36
+ }
37
+ function isLoopbackHost(hostname) {
38
+ const normalized = normalizeHostname(hostname);
39
+ return normalized === "localhost" || normalized.endsWith(".localhost") || normalized === "0.0.0.0" || normalized === "::1" || /^127(?:\.\d{1,3}){3}$/.test(normalized);
40
+ }
41
+
42
+ // src/native-dev-bundle-url.ts
43
+ var ONE_BUNDLE_PATH = "/node_modules/one/metro-entry.bundle?platform=ios&dev=true&minify=false";
44
+ var METRO_BUNDLE_PATH = "/index.bundle?platform=ios&dev=true&hot=true&minify=false";
45
+ function isAbsoluteHttpUrl(url) {
46
+ return /^https?:\/\//i.test(url);
47
+ }
48
+ function isNativeDevBundlePath(pathname) {
49
+ return pathname.endsWith(".bundle");
50
+ }
51
+ function normalizeNativeDevBundleUrl(bundleUrl) {
52
+ try {
53
+ const isAbsolute = isAbsoluteHttpUrl(bundleUrl);
54
+ const parsed = new URL(bundleUrl, "http://soot.local");
55
+ if (!isNativeDevBundlePath(parsed.pathname)) return bundleUrl;
56
+ if (!parsed.searchParams.has("dev")) parsed.searchParams.set("dev", "true");
57
+ if (!parsed.searchParams.has("minify")) {
58
+ parsed.searchParams.set("minify", "false");
59
+ }
60
+ if (isAbsolute) return parsed.toString();
61
+ return `${parsed.pathname}${parsed.search}${parsed.hash}`;
62
+ } catch {
63
+ return bundleUrl;
64
+ }
65
+ }
66
+
67
+ // src/dev-bundle-resolution.ts
68
+ var DEFAULT_TEST_DRIVE_PORT = 8081;
69
+ function buildUnresolvedTargetError(targetLabel) {
70
+ return new Error(
71
+ `could not resolve a native bundle for ${targetLabel}. pass an explicit bundle URL or open Connect and choose the app there.`
72
+ );
73
+ }
74
+ function inferManifestFramework(launchUrl, sdkVersion) {
75
+ if (launchUrl?.includes("/one/metro-entry.bundle")) return "one";
76
+ if (typeof sdkVersion === "string" && sdkVersion) return "expo";
77
+ return "unknown";
78
+ }
79
+ function buildBaseUrl(protocol, host, port) {
80
+ return `${protocol}//${host}:${port}`;
81
+ }
82
+ function shouldProxyLoopbackProbe(targetUrl) {
83
+ if (typeof window === "undefined") return false;
84
+ try {
85
+ const parsed = new URL(targetUrl);
86
+ return isLoopbackHost(parsed.hostname) && isLoopbackHost(window.location.hostname) && parsed.origin !== window.location.origin;
87
+ } catch {
88
+ return false;
89
+ }
90
+ }
91
+ async function fetchDevProbe(targetUrl, init) {
92
+ const requestInit = {
93
+ ...init,
94
+ cache: init?.cache ?? "no-store"
95
+ };
96
+ if (!shouldProxyLoopbackProbe(targetUrl)) {
97
+ return fetch(targetUrl, requestInit);
98
+ }
99
+ return fetch(`/__fetch-proxy?url=${encodeURIComponent(targetUrl)}`, requestInit);
100
+ }
101
+ function assumeDevBundleForPort(port, options = {}) {
102
+ const framework = options.framework ?? "one";
103
+ const host = options.host ?? "localhost";
104
+ const protocol = options.protocol ?? "http:";
105
+ const bundlePath = framework === "metro" ? METRO_BUNDLE_PATH : ONE_BUNDLE_PATH;
106
+ return {
107
+ bundleUrl: `${buildBaseUrl(protocol, host, port)}${bundlePath}`,
108
+ port,
109
+ framework
110
+ };
111
+ }
112
+ function getDefaultPortForProtocol(protocol) {
113
+ return protocol === "https:" ? 443 : 80;
114
+ }
115
+ function isBaseServerUrl(url) {
116
+ const path = url.pathname || "/";
117
+ return (path === "/" || path === "") && !url.search && !url.hash;
118
+ }
119
+ async function hasDirectOneBundle(baseUrl) {
120
+ try {
121
+ const oneRes = await fetchDevProbe(`${baseUrl}${ONE_BUNDLE_PATH}`, {
122
+ method: "HEAD"
123
+ });
124
+ return oneRes.ok;
125
+ } catch {
126
+ return false;
127
+ }
128
+ }
129
+ async function probeBaseUrlBundle(baseUrl, port) {
130
+ const normalizedBaseUrl = baseUrl.replace(/\/+$/, "");
131
+ try {
132
+ const manifestRes = await fetchDevProbe(`${normalizedBaseUrl}/`, {
133
+ headers: { "expo-platform": "ios" }
134
+ });
135
+ if (manifestRes.ok) {
136
+ const manifest = await manifestRes.json();
137
+ const client = manifest?.extra?.expoClient || manifest?.extra || {};
138
+ const launchUrl = typeof manifest?.launchAsset?.url === "string" ? manifest.launchAsset.url : void 0;
139
+ if (launchUrl || client.name) {
140
+ const framework = inferManifestFramework(launchUrl, client.sdkVersion);
141
+ const bundleUrl = framework === "one" && await hasDirectOneBundle(normalizedBaseUrl) ? `${normalizedBaseUrl}${ONE_BUNDLE_PATH}` : normalizeNativeDevBundleUrl(
142
+ launchUrl || `${normalizedBaseUrl}${METRO_BUNDLE_PATH}`
143
+ );
144
+ return {
145
+ bundleUrl,
146
+ port,
147
+ framework,
148
+ projectName: client.name
149
+ };
150
+ }
151
+ }
152
+ } catch {
153
+ }
154
+ try {
155
+ const oneRes = await fetchDevProbe(`${normalizedBaseUrl}${ONE_BUNDLE_PATH}`, {
156
+ method: "HEAD"
157
+ });
158
+ if (oneRes.ok) {
159
+ return {
160
+ bundleUrl: `${normalizedBaseUrl}${ONE_BUNDLE_PATH}`,
161
+ port,
162
+ framework: "one"
163
+ };
164
+ }
165
+ } catch {
166
+ }
167
+ try {
168
+ const metroBundleRes = await fetchDevProbe(
169
+ `${normalizedBaseUrl}${METRO_BUNDLE_PATH}`,
170
+ {
171
+ method: "HEAD"
172
+ }
173
+ );
174
+ if (metroBundleRes.ok) {
175
+ return {
176
+ bundleUrl: `${normalizedBaseUrl}${METRO_BUNDLE_PATH}`,
177
+ port,
178
+ framework: "metro"
179
+ };
180
+ }
181
+ } catch {
182
+ }
183
+ try {
184
+ const statusRes = await fetchDevProbe(`${normalizedBaseUrl}/status`);
185
+ if (statusRes.ok) {
186
+ const text = await statusRes.text();
187
+ if (text.includes("packager-status:running")) {
188
+ return {
189
+ bundleUrl: `${normalizedBaseUrl}${METRO_BUNDLE_PATH}`,
190
+ port,
191
+ framework: "metro"
192
+ };
193
+ }
194
+ }
195
+ } catch {
196
+ }
197
+ return null;
198
+ }
199
+ async function probePortBundle(port) {
200
+ return probeBaseUrlBundle(buildBaseUrl("http:", "localhost", port), port);
201
+ }
202
+ async function resolveConnectionInput(input) {
203
+ const trimmed = input.trim();
204
+ if (/^\d+$/.test(trimmed)) {
205
+ const port2 = parseInt(trimmed, 10);
206
+ const resolved = await probePortBundle(port2);
207
+ if (resolved) return resolved;
208
+ throw buildUnresolvedTargetError(`localhost:${port2}`);
209
+ }
210
+ const bundleUrl = trimmed.startsWith("http") ? trimmed : `http://${trimmed}`;
211
+ let parsed;
212
+ try {
213
+ parsed = new URL(bundleUrl);
214
+ } catch {
215
+ throw new Error(
216
+ `could not parse "${input}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`
217
+ );
218
+ }
219
+ const protocol = parsed.protocol || "http:";
220
+ const port = parsed.port ? parseInt(parsed.port, 10) : getDefaultPortForProtocol(protocol);
221
+ const baseUrl = buildBaseUrl(protocol, parsed.hostname, port);
222
+ if (isLoopbackHost(parsed.hostname) && isBaseServerUrl(parsed)) {
223
+ const resolved = await probeBaseUrlBundle(baseUrl, port);
224
+ if (resolved) return resolved;
225
+ throw buildUnresolvedTargetError(baseUrl);
226
+ }
227
+ return { bundleUrl: parsed.toString(), port, framework: "unknown" };
228
+ }
229
+ // Annotate the CommonJS export names for ESM import in node:
230
+ 0 && (module.exports = {
231
+ DEFAULT_TEST_DRIVE_PORT,
232
+ assumeDevBundleForPort,
233
+ inferManifestFramework,
234
+ probePortBundle,
235
+ resolveConnectionInput
236
+ });
@@ -0,0 +1,234 @@
1
+ /*! sootsim v0.0.3 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
+ "use strict";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/home-paths.ts
33
+ var home_paths_exports = {};
34
+ __export(home_paths_exports, {
35
+ ACTIVE_RUNTIME_FILE: () => ACTIVE_RUNTIME_FILE,
36
+ CONFIG_FILE: () => CONFIG_FILE,
37
+ DAEMON_HEARTBEAT_STALE_MS: () => DAEMON_HEARTBEAT_STALE_MS,
38
+ DAEMON_LOCKFILE: () => DAEMON_LOCKFILE,
39
+ SOOTSIM_HOME_ENV: () => SOOTSIM_HOME_ENV,
40
+ activeRuntimeDir: () => activeRuntimeDir,
41
+ activeRuntimeFile: () => activeRuntimeFile,
42
+ cacheDir: () => cacheDir,
43
+ claimDaemonLockfile: () => claimDaemonLockfile,
44
+ compareSemver: () => compareSemver,
45
+ configFilePath: () => configFilePath,
46
+ daemonLockfilePath: () => daemonLockfilePath,
47
+ electronDir: () => electronDir,
48
+ electronVersionDir: () => electronVersionDir,
49
+ ensureSootsimHome: () => ensureSootsimHome,
50
+ isDaemonLockfileFresh: () => isDaemonLockfileFresh,
51
+ listInstalledRuntimes: () => listInstalledRuntimes,
52
+ readActiveRuntime: () => readActiveRuntime,
53
+ readDaemonLockfile: () => readDaemonLockfile,
54
+ removeDaemonLockfile: () => removeDaemonLockfile,
55
+ runtimeDir: () => runtimeDir,
56
+ runtimesDir: () => runtimesDir,
57
+ sootsimHomeDir: () => sootsimHomeDir,
58
+ writeActiveRuntime: () => writeActiveRuntime,
59
+ writeDaemonLockfile: () => writeDaemonLockfile
60
+ });
61
+ module.exports = __toCommonJS(home_paths_exports);
62
+ var import_fs = __toESM(require("fs"), 1);
63
+ var import_os = require("os");
64
+ var import_path = __toESM(require("path"), 1);
65
+ var SOOTSIM_HOME_ENV = "SOOTSIM_HOME";
66
+ var ACTIVE_RUNTIME_FILE = "active";
67
+ var DAEMON_LOCKFILE = "daemon.json";
68
+ var CONFIG_FILE = "config.json";
69
+ var DAEMON_HEARTBEAT_STALE_MS = 3e4;
70
+ function sootsimHomeDir() {
71
+ const override = process.env[SOOTSIM_HOME_ENV];
72
+ if (override && override.length > 0) return import_path.default.resolve(override);
73
+ return import_path.default.join((0, import_os.homedir)(), ".sootsim");
74
+ }
75
+ function runtimesDir() {
76
+ return import_path.default.join(sootsimHomeDir(), "runtimes");
77
+ }
78
+ function runtimeDir(version) {
79
+ return import_path.default.join(runtimesDir(), version);
80
+ }
81
+ function activeRuntimeFile() {
82
+ return import_path.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
83
+ }
84
+ function electronDir() {
85
+ return import_path.default.join(sootsimHomeDir(), "electron");
86
+ }
87
+ function electronVersionDir(version) {
88
+ return import_path.default.join(electronDir(), version);
89
+ }
90
+ function cacheDir() {
91
+ return import_path.default.join(sootsimHomeDir(), "cache");
92
+ }
93
+ function daemonLockfilePath() {
94
+ return import_path.default.join(sootsimHomeDir(), DAEMON_LOCKFILE);
95
+ }
96
+ function configFilePath() {
97
+ return import_path.default.join(sootsimHomeDir(), CONFIG_FILE);
98
+ }
99
+ function ensureSootsimHome() {
100
+ import_fs.default.mkdirSync(sootsimHomeDir(), { recursive: true });
101
+ import_fs.default.mkdirSync(runtimesDir(), { recursive: true });
102
+ import_fs.default.mkdirSync(cacheDir(), { recursive: true });
103
+ }
104
+ function readActiveRuntime() {
105
+ try {
106
+ const value = import_fs.default.readFileSync(activeRuntimeFile(), "utf8").trim();
107
+ return value.length > 0 ? value : null;
108
+ } catch {
109
+ return null;
110
+ }
111
+ }
112
+ function writeActiveRuntime(version) {
113
+ import_fs.default.mkdirSync(runtimesDir(), { recursive: true });
114
+ import_fs.default.writeFileSync(activeRuntimeFile(), `${version}
115
+ `, "utf8");
116
+ }
117
+ function listInstalledRuntimes() {
118
+ try {
119
+ return import_fs.default.readdirSync(runtimesDir(), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort(compareSemver);
120
+ } catch {
121
+ return [];
122
+ }
123
+ }
124
+ function compareSemver(a, b) {
125
+ const parse = (v) => {
126
+ const hyphen = v.indexOf("-");
127
+ const core = hyphen >= 0 ? v.slice(0, hyphen) : v;
128
+ const pre = hyphen >= 0 ? v.slice(hyphen + 1) : "";
129
+ const parts = core.split(".").map((n) => Number.parseInt(n, 10));
130
+ if (parts.some((n) => !Number.isFinite(n))) return [[Number.POSITIVE_INFINITY], v];
131
+ return [parts, pre];
132
+ };
133
+ const [an, ap] = parse(a);
134
+ const [bn, bp] = parse(b);
135
+ for (let i = 0; i < Math.max(an.length, bn.length); i++) {
136
+ const av = an[i] ?? 0;
137
+ const bv = bn[i] ?? 0;
138
+ if (av !== bv) return av - bv;
139
+ }
140
+ if (ap === bp) return 0;
141
+ if (!ap) return 1;
142
+ if (!bp) return -1;
143
+ return ap < bp ? -1 : 1;
144
+ }
145
+ function activeRuntimeDir() {
146
+ const version = readActiveRuntime();
147
+ if (!version) return null;
148
+ const dir = runtimeDir(version);
149
+ try {
150
+ if (import_fs.default.statSync(dir).isDirectory()) return dir;
151
+ } catch {
152
+ }
153
+ return null;
154
+ }
155
+ var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
156
+ function readDaemonLockfile() {
157
+ try {
158
+ const fd = import_fs.default.openSync(daemonLockfilePath(), "r");
159
+ try {
160
+ const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
161
+ const bytesRead = import_fs.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
162
+ const raw = buf.subarray(0, bytesRead).toString("utf8");
163
+ const parsed = JSON.parse(raw);
164
+ if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number") {
165
+ return parsed;
166
+ }
167
+ return null;
168
+ } finally {
169
+ import_fs.default.closeSync(fd);
170
+ }
171
+ } catch {
172
+ return null;
173
+ }
174
+ }
175
+ function isDaemonLockfileFresh(lock, now = Date.now()) {
176
+ if (!lock) return false;
177
+ if (now - lock.heartbeatAt > DAEMON_HEARTBEAT_STALE_MS) return false;
178
+ try {
179
+ process.kill(lock.pid, 0);
180
+ return true;
181
+ } catch {
182
+ return false;
183
+ }
184
+ }
185
+ function writeDaemonLockfile(data) {
186
+ ensureSootsimHome();
187
+ const tmp = `${daemonLockfilePath()}.tmp`;
188
+ import_fs.default.writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
189
+ `, "utf8");
190
+ import_fs.default.renameSync(tmp, daemonLockfilePath());
191
+ }
192
+ function claimDaemonLockfile(data) {
193
+ ensureSootsimHome();
194
+ const existing = readDaemonLockfile();
195
+ if (existing && isDaemonLockfileFresh(existing) && existing.pid !== data.pid) {
196
+ return false;
197
+ }
198
+ writeDaemonLockfile(data);
199
+ return true;
200
+ }
201
+ function removeDaemonLockfile() {
202
+ try {
203
+ import_fs.default.unlinkSync(daemonLockfilePath());
204
+ } catch {
205
+ }
206
+ }
207
+ // Annotate the CommonJS export names for ESM import in node:
208
+ 0 && (module.exports = {
209
+ ACTIVE_RUNTIME_FILE,
210
+ CONFIG_FILE,
211
+ DAEMON_HEARTBEAT_STALE_MS,
212
+ DAEMON_LOCKFILE,
213
+ SOOTSIM_HOME_ENV,
214
+ activeRuntimeDir,
215
+ activeRuntimeFile,
216
+ cacheDir,
217
+ claimDaemonLockfile,
218
+ compareSemver,
219
+ configFilePath,
220
+ daemonLockfilePath,
221
+ electronDir,
222
+ electronVersionDir,
223
+ ensureSootsimHome,
224
+ isDaemonLockfileFresh,
225
+ listInstalledRuntimes,
226
+ readActiveRuntime,
227
+ readDaemonLockfile,
228
+ removeDaemonLockfile,
229
+ runtimeDir,
230
+ runtimesDir,
231
+ sootsimHomeDir,
232
+ writeActiveRuntime,
233
+ writeDaemonLockfile
234
+ });