rnxsim 0.1.419 → 0.1.421

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 (62) hide show
  1. package/cli/cloud-client.ts +164 -12
  2. package/cli/cloud-dispatch.ts +7 -2
  3. package/cli/commands/box/checkout-plane.ts +78 -40
  4. package/cli/commands/platform.ts +30 -9
  5. package/cli/outbound-endpoints.ts +18 -0
  6. package/cli/shell-init.ts +1 -1
  7. package/cli/ws-bridge.ts +7 -5
  8. package/dist-lib/agent-daemon-client.cjs +1 -1
  9. package/dist-lib/agent-events.cjs +1 -1
  10. package/dist-lib/agent-identity.cjs +1 -1
  11. package/dist-lib/agent-sessions.cjs +1 -1
  12. package/dist-lib/attached-projects.cjs +1 -1
  13. package/dist-lib/auth/shared-session.cjs +1 -1
  14. package/dist-lib/backend-origin.cjs +1 -1
  15. package/dist-lib/beta.cjs +1 -1
  16. package/dist-lib/beta.mjs +1 -1
  17. package/dist-lib/bridge-constants.cjs +1 -1
  18. package/dist-lib/bridge-contract-input.cjs +1 -1
  19. package/dist-lib/bridge-contract-input.mjs +1 -1
  20. package/dist-lib/bridge-contract.cjs +1 -1
  21. package/dist-lib/bridge-contract.mjs +1 -1
  22. package/dist-lib/capture-contract.cjs +1 -1
  23. package/dist-lib/capture-contract.mjs +1 -1
  24. package/dist-lib/cli-constants.cjs +1 -1
  25. package/dist-lib/cloud-contract.cjs +1 -1
  26. package/dist-lib/cloud-contract.mjs +1 -1
  27. package/dist-lib/cloud.cjs +447 -0
  28. package/dist-lib/cloud.mjs +419 -0
  29. package/dist-lib/config.cjs +1 -1
  30. package/dist-lib/detox/index.cjs +1 -1
  31. package/dist-lib/dev-bundle-resolution.cjs +6 -4
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +55 -28
  34. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +7 -5
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/menu.cjs +1 -1
  42. package/dist-lib/menu.mjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  45. package/dist-lib/metro-production-bundle.cjs +1 -1
  46. package/dist-lib/metro-production-bundle.mjs +1 -1
  47. package/dist-lib/metro.cjs +4 -3
  48. package/dist-lib/profiles.cjs +1 -1
  49. package/dist-lib/public-brand.cjs +1 -1
  50. package/dist-lib/react-native-host-modules.cjs +1 -1
  51. package/dist-lib/react-native-host-modules.mjs +1 -1
  52. package/dist-lib/render-mode.cjs +1 -1
  53. package/dist-lib/scripts/dev-server-scanner.cjs +9 -6
  54. package/dist-lib/sdk.cjs +1 -1
  55. package/dist-lib/sdk.mjs +1 -1
  56. package/dist-lib/skills.cjs +64 -34
  57. package/dist-lib/vite.cjs +1 -1
  58. package/package.json +8 -1
  59. package/scripts/dev-server-scanner.ts +9 -5
  60. package/src/cloud.ts +499 -0
  61. package/src/dev-bundle-resolution.ts +6 -3
  62. package/src/dev-server-open.ts +3 -2
package/dist-lib/menu.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/menu.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/public-brand.ts
4
4
  var name = "rnx";
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/metro-fingerprint-registry.ts
4
4
  var RNX_METRO_FINGERPRINT_SCHEMA_VERSION = 2;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/metro-production-bundle.ts
4
4
  var RNXSIM_METRO_MODULE_PATHS_PREFIX = "globalThis.__sootsimModulePaths=";
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -137,9 +137,11 @@ function openRnxDesktopWhenMetroIsReady({
137
137
  const deadline = Date.now() + timeoutMs;
138
138
  return new Promise((resolve) => {
139
139
  let finished = false;
140
+ let retryTimer;
140
141
  const finish = (opened) => {
141
142
  if (finished) return;
142
143
  finished = true;
144
+ clearTimeout(retryTimer);
143
145
  scheduledMetroOpens.delete(key);
144
146
  resolve(opened);
145
147
  };
@@ -152,8 +154,7 @@ function openRnxDesktopWhenMetroIsReady({
152
154
  finish(false);
153
155
  return;
154
156
  }
155
- const timer = setTimeout(check, intervalMs);
156
- timer.unref();
157
+ retryTimer = setTimeout(check, intervalMs);
157
158
  };
158
159
  const check = () => {
159
160
  const request = import_node_http.default.get(
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/react-native-host-modules.ts
4
4
  var REACT_NATIVE_PASSTHROUGH_SPECIFIERS = [
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -521,7 +521,7 @@ function optionalDemoAppsSync() {
521
521
 
522
522
  // scripts/dev-server-scanner.ts
523
523
  var EXEC_EXIT_GRACE_MS = 2e3;
524
- function execGuarded(command, timeout, extra = {}) {
524
+ async function execGuarded(command, timeout, extra = {}) {
525
525
  let child;
526
526
  const ran = new Promise((resolve2, reject) => {
527
527
  child = (0, import_child_process.exec)(command, { encoding: "utf8", timeout, ...extra }, (err, stdout) => {
@@ -529,16 +529,20 @@ function execGuarded(command, timeout, extra = {}) {
529
529
  else resolve2({ stdout });
530
530
  });
531
531
  });
532
+ let deadlineTimer;
532
533
  const deadline = new Promise((_resolve, reject) => {
533
- const timer = setTimeout(() => {
534
+ deadlineTimer = setTimeout(() => {
534
535
  child?.kill("SIGKILL");
535
536
  const err = new Error(`\`${command}\` did not exit within ${timeout}ms`);
536
537
  Object.assign(err, { killed: true });
537
538
  reject(err);
538
539
  }, timeout + EXEC_EXIT_GRACE_MS);
539
- timer.unref?.();
540
540
  });
541
- return Promise.race([ran, deadline]);
541
+ try {
542
+ return await Promise.race([ran, deadline]);
543
+ } finally {
544
+ clearTimeout(deadlineTimer);
545
+ }
542
546
  }
543
547
  var TIMEOUT_MS = 250;
544
548
  var MANIFEST_TIMEOUT_MS = 1500;
@@ -604,7 +608,6 @@ function httpGet(hostname, port, path, method = "GET", timeout = TIMEOUT_MS, hea
604
608
  req.socket?.unref();
605
609
  }, timeout);
606
610
  const abandon = setTimeout(() => req.destroy(), BODY_TIMEOUT_MS);
607
- abandon.unref?.();
608
611
  req.on("close", () => {
609
612
  clearTimeout(giveUp);
610
613
  clearTimeout(abandon);
package/dist-lib/sdk.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/sdk.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -15006,7 +15006,7 @@ var init_optional_demo_registry = __esm({
15006
15006
  });
15007
15007
 
15008
15008
  // scripts/dev-server-scanner.ts
15009
- function execGuarded(command, timeout, extra = {}) {
15009
+ async function execGuarded(command, timeout, extra = {}) {
15010
15010
  let child;
15011
15011
  const ran = new Promise((resolve7, reject) => {
15012
15012
  child = (0, import_child_process.exec)(command, { encoding: "utf8", timeout, ...extra }, (err, stdout) => {
@@ -15014,16 +15014,20 @@ function execGuarded(command, timeout, extra = {}) {
15014
15014
  else resolve7({ stdout });
15015
15015
  });
15016
15016
  });
15017
+ let deadlineTimer;
15017
15018
  const deadline = new Promise((_resolve, reject) => {
15018
- const timer = setTimeout(() => {
15019
+ deadlineTimer = setTimeout(() => {
15019
15020
  child?.kill("SIGKILL");
15020
15021
  const err = new Error(`\`${command}\` did not exit within ${timeout}ms`);
15021
15022
  Object.assign(err, { killed: true });
15022
15023
  reject(err);
15023
15024
  }, timeout + EXEC_EXIT_GRACE_MS);
15024
- timer.unref?.();
15025
15025
  });
15026
- return Promise.race([ran, deadline]);
15026
+ try {
15027
+ return await Promise.race([ran, deadline]);
15028
+ } finally {
15029
+ clearTimeout(deadlineTimer);
15030
+ }
15027
15031
  }
15028
15032
  async function tcpPing(port, timeout = TCP_GATE_MS) {
15029
15033
  try {
@@ -15085,7 +15089,6 @@ function httpGet(hostname, port, path20, method = "GET", timeout = TIMEOUT_MS, h
15085
15089
  req.socket?.unref();
15086
15090
  }, timeout);
15087
15091
  const abandon = setTimeout(() => req.destroy(), BODY_TIMEOUT_MS);
15088
- abandon.unref?.();
15089
15092
  req.on("close", () => {
15090
15093
  clearTimeout(giveUp);
15091
15094
  clearTimeout(abandon);
@@ -18746,7 +18749,7 @@ function looksBinary(filePath, size) {
18746
18749
  if (fd !== void 0) import_node_fs10.default.closeSync(fd);
18747
18750
  }
18748
18751
  }
18749
- var import_node_child_process5, import_node_fs10, import_node_path10, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, CheckoutFilePlane;
18752
+ var import_node_child_process5, import_node_fs10, import_node_path10, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, LIST_FILES_ATTEMPTS, LIST_FILES_RETRY_MS, CheckoutFilePlane;
18750
18753
  var init_checkout_plane = __esm({
18751
18754
  "cli/commands/box/checkout-plane.ts"() {
18752
18755
  "use strict";
@@ -18757,6 +18760,8 @@ var init_checkout_plane = __esm({
18757
18760
  };
18758
18761
  BINARY_SNIFF_BYTES = 8192;
18759
18762
  LIST_FILES_TIMEOUT_MS = 1e4;
18763
+ LIST_FILES_ATTEMPTS = 3;
18764
+ LIST_FILES_RETRY_MS = 25;
18760
18765
  CheckoutFilePlane = class {
18761
18766
  root;
18762
18767
  entries = /* @__PURE__ */ new Map();
@@ -18774,33 +18779,55 @@ var init_checkout_plane = __esm({
18774
18779
  index() {
18775
18780
  return this.entries;
18776
18781
  }
18777
- async refresh() {
18778
- let stdout;
18779
- try {
18780
- const args = this.trackedOnly ? ["ls-files", "-z"] : ["ls-files", "-co", "--exclude-standard", "-z"];
18781
- stdout = (0, import_node_child_process5.execFileSync)("git", args, {
18782
- cwd: this.root,
18783
- encoding: "utf8",
18784
- maxBuffer: 64 * 1024 * 1024,
18785
- timeout: this.listTimeoutMs,
18786
- // stating the environment is not redundant here. bun 1.3.14 resolves
18787
- // the binary for the synchronous form against the PATH it captured at
18788
- // startup and ignores a later change to `process.env.PATH`, so without
18789
- // this it runs a different git than every other call in the process.
18790
- env: process.env
18791
- });
18792
- } catch (error) {
18793
- const message = error instanceof Error ? error.message : String(error);
18794
- const killed = error instanceof Error && "signal" in error && error.signal === "SIGTERM";
18795
- throw new CheckoutRequiresGitError(
18796
- killed ? `git did not list the project's files in ${this.root} within ${this.listTimeoutMs / 1e3}s, so the box has no file set to serve. the checkout may be on a stalled filesystem, or this machine may be too loaded to start a subprocess.` : `could not list the project's files with git in ${this.root}: ${message}`
18797
- );
18798
- }
18782
+ listFiles() {
18783
+ const args = this.trackedOnly ? ["ls-files", "-z"] : ["ls-files", "-co", "--exclude-standard", "-z"];
18784
+ const stdout = (0, import_node_child_process5.execFileSync)("git", args, {
18785
+ cwd: this.root,
18786
+ encoding: "utf8",
18787
+ maxBuffer: 64 * 1024 * 1024,
18788
+ timeout: this.listTimeoutMs,
18789
+ // stating the environment is not redundant here. bun 1.3.14 resolves
18790
+ // the binary for the synchronous form against the PATH it captured at
18791
+ // startup and ignores a later change to `process.env.PATH`, so without
18792
+ // this it runs a different git than every other call in the process.
18793
+ env: process.env
18794
+ });
18799
18795
  if (stdout.length === 0) {
18800
18796
  throw new CheckoutRequiresGitError(
18801
18797
  `git listed no ${this.trackedOnly ? "tracked " : ""}files in ${this.root}. either the checkout contains no eligible files, or this machine could not read the child process's output.`
18802
18798
  );
18803
18799
  }
18800
+ return stdout;
18801
+ }
18802
+ async refresh() {
18803
+ let stdout = "";
18804
+ let lastFailure;
18805
+ for (let attempt = 1; attempt <= LIST_FILES_ATTEMPTS; attempt++) {
18806
+ try {
18807
+ stdout = this.listFiles();
18808
+ lastFailure = void 0;
18809
+ break;
18810
+ } catch (error) {
18811
+ if (error instanceof CheckoutRequiresGitError) {
18812
+ lastFailure = error;
18813
+ } else {
18814
+ const message = error instanceof Error ? error.message : String(error);
18815
+ const killed = error instanceof Error && "signal" in error && error.signal === "SIGTERM";
18816
+ lastFailure = new CheckoutRequiresGitError(
18817
+ killed ? `git did not list the project's files in ${this.root} within ${this.listTimeoutMs / 1e3}s, so the box has no file set to serve. the checkout may be on a stalled filesystem, or this machine may be too loaded to start a subprocess.` : `could not list the project's files with git in ${this.root}: ${message}`
18818
+ );
18819
+ }
18820
+ if (attempt < LIST_FILES_ATTEMPTS) {
18821
+ await new Promise(
18822
+ (resolve7) => setTimeout(resolve7, LIST_FILES_RETRY_MS * attempt)
18823
+ );
18824
+ }
18825
+ }
18826
+ }
18827
+ if (lastFailure) {
18828
+ lastFailure.message = `${lastFailure.message} (${LIST_FILES_ATTEMPTS} attempts)`;
18829
+ throw lastFailure;
18830
+ }
18804
18831
  const next = /* @__PURE__ */ new Map();
18805
18832
  const nextSniffed = /* @__PURE__ */ new Map();
18806
18833
  for (const relative of stdout.split("\0")) {
@@ -22483,11 +22510,12 @@ function createBridge(wsPort, opts = {}) {
22483
22510
  } catch {
22484
22511
  }
22485
22512
  ws.close();
22486
- setTimeout(() => {
22513
+ const terminateGrace = setTimeout(() => {
22487
22514
  if (ws.readyState !== import_ws3.WebSocket.CLOSED) {
22488
22515
  ws.terminate();
22489
22516
  }
22490
- }, 250).unref();
22517
+ }, 250);
22518
+ ws.once("close", () => clearTimeout(terminateGrace));
22491
22519
  }
22492
22520
  };
22493
22521
  }
@@ -22695,12 +22723,14 @@ async function probeExpoManifest(normalizedBaseUrl, port) {
22695
22723
  async (res) => res.ok ? { ok: true, body: await res.text() } : null,
22696
22724
  () => void 0
22697
22725
  );
22726
+ let probeDeadline;
22698
22727
  const answered = await Promise.race([
22699
22728
  pending,
22700
- new Promise(
22701
- (resolve7) => setTimeout(() => resolve7("timeout"), MANIFEST_PROBE_TIMEOUT_MS).unref?.()
22702
- )
22729
+ new Promise((resolve7) => {
22730
+ probeDeadline = setTimeout(() => resolve7("timeout"), MANIFEST_PROBE_TIMEOUT_MS);
22731
+ })
22703
22732
  ]);
22733
+ clearTimeout(probeDeadline);
22704
22734
  if (answered === "timeout" || answered === void 0) return { state: "no-answer" };
22705
22735
  if (answered === null) return { state: "no-manifest" };
22706
22736
  body = answered.body;
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.419 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.421 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rnxsim",
3
- "version": "0.1.419",
3
+ "version": "0.1.421",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for rnx.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -130,6 +130,13 @@
130
130
  "import": "./dist-lib/cloud-contract.mjs",
131
131
  "default": "./dist-lib/cloud-contract.cjs"
132
132
  },
133
+ "./cloud": {
134
+ "types": "./src/cloud.ts",
135
+ "source": "./src/cloud.ts",
136
+ "bun": "./src/cloud.ts",
137
+ "import": "./dist-lib/cloud.mjs",
138
+ "default": "./dist-lib/cloud.cjs"
139
+ },
133
140
  "./capture-contract": {
134
141
  "types": "./src/capture-contract.ts",
135
142
  "source": "./src/capture-contract.ts",
@@ -53,7 +53,7 @@ const EXEC_EXIT_GRACE_MS = 2_000
53
53
  * `/__server-scan` stops answering at all instead of answering "could not
54
54
  * look". so we race the child against a real wall-clock deadline and reject
55
55
  * with `killed`, which callers already read as could-not-look. */
56
- function execGuarded(
56
+ async function execGuarded(
57
57
  command: string,
58
58
  timeout: number,
59
59
  extra: { maxBuffer?: number } = {},
@@ -65,8 +65,9 @@ function execGuarded(
65
65
  else resolve({ stdout })
66
66
  })
67
67
  })
68
+ let deadlineTimer: ReturnType<typeof setTimeout> | undefined
68
69
  const deadline = new Promise<never>((_resolve, reject) => {
69
- const timer = setTimeout(() => {
70
+ deadlineTimer = setTimeout(() => {
70
71
  child?.kill('SIGKILL')
71
72
  const err = new Error(`\`${command}\` did not exit within ${timeout}ms`)
72
73
  // matches the shape `wasKilledByTimeout` reads off a real exec timeout, so
@@ -74,9 +75,13 @@ function execGuarded(
74
75
  Object.assign(err, { killed: true })
75
76
  reject(err)
76
77
  }, timeout + EXEC_EXIT_GRACE_MS)
77
- timer.unref?.()
78
78
  })
79
- return Promise.race([ran, deadline])
79
+ try {
80
+ return await Promise.race([ran, deadline])
81
+ } finally {
82
+ // the race is settled, so drop the deadline rather than leaving it pending.
83
+ clearTimeout(deadlineTimer)
84
+ }
80
85
  }
81
86
 
82
87
  export interface DiscoveredServer {
@@ -234,7 +239,6 @@ function httpGet(
234
239
  // the only thing that ever destroys a connection here. by BODY_TIMEOUT_MS a
235
240
  // server has long since answered or died, so there is no live write to cut.
236
241
  const abandon = setTimeout(() => req.destroy(), BODY_TIMEOUT_MS)
237
- abandon.unref?.()
238
242
  req.on('close', () => {
239
243
  clearTimeout(giveUp)
240
244
  clearTimeout(abandon)