peachsim 0.1.792 → 0.1.794

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 (84) hide show
  1. package/cli/app-config.ts +3 -7
  2. package/cli/commands/compat.ts +0 -6
  3. package/cli/desktop-companion.ts +3 -0
  4. package/cli/ws-bridge.ts +103 -3
  5. package/dist-lib/agent-daemon-client.cjs +2 -2
  6. package/dist-lib/agent-events.cjs +2 -2
  7. package/dist-lib/agent-identity.cjs +2 -2
  8. package/dist-lib/agent-sessions.cjs +2 -2
  9. package/dist-lib/attached-projects.cjs +2 -2
  10. package/dist-lib/auth/shared-session.cjs +2 -2
  11. package/dist-lib/backend-origin.cjs +2 -2
  12. package/dist-lib/beta.cjs +2 -2
  13. package/dist-lib/beta.mjs +1 -1
  14. package/dist-lib/bridge-constants.cjs +2 -2
  15. package/dist-lib/bridge-contract-input.cjs +2 -2
  16. package/dist-lib/bridge-contract-input.mjs +1 -1
  17. package/dist-lib/bridge-contract.cjs +2 -2
  18. package/dist-lib/bridge-contract.mjs +1 -1
  19. package/dist-lib/bundle-channel.cjs +9071 -0
  20. package/dist-lib/capture-contract.cjs +2 -2
  21. package/dist-lib/capture-contract.mjs +1 -1
  22. package/dist-lib/cli-constants.cjs +2 -2
  23. package/dist-lib/cloud-contract.cjs +2 -2
  24. package/dist-lib/cloud-contract.mjs +1 -1
  25. package/dist-lib/cloud-test-args.cjs +2 -2
  26. package/dist-lib/cloud-test-args.mjs +1 -1
  27. package/dist-lib/cloud.cjs +2 -2
  28. package/dist-lib/cloud.mjs +1 -1
  29. package/dist-lib/config.cjs +2 -2
  30. package/dist-lib/detox/index.cjs +5 -3
  31. package/dist-lib/dev-bundle-resolution.cjs +2 -2
  32. package/dist-lib/expo-swift-bundle.cjs +8419 -0
  33. package/dist-lib/expo-swift-metadata.cjs +91 -0
  34. package/dist-lib/expo-swift-metadata.mjs +63 -0
  35. package/dist-lib/home-paths.cjs +2 -2
  36. package/dist-lib/host/bridge-host.cjs +238 -130
  37. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  38. package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
  39. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  40. package/dist-lib/host/replacement-module-handler.cjs +2 -2
  41. package/dist-lib/host/websocket-proxy.cjs +2 -2
  42. package/dist-lib/index.cjs +113 -13
  43. package/dist-lib/jump-to-source-babel.cjs +2 -2
  44. package/dist-lib/jump-to-source-native.cjs +2 -2
  45. package/dist-lib/kotlin-host.cjs +2 -2
  46. package/dist-lib/menu.cjs +2 -2
  47. package/dist-lib/menu.mjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.cjs +2 -2
  49. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  50. package/dist-lib/metro-production-bundle.cjs +2 -2
  51. package/dist-lib/metro-production-bundle.mjs +1 -1
  52. package/dist-lib/metro.cjs +110 -12
  53. package/dist-lib/native-app-identity.cjs +2 -2
  54. package/dist-lib/native-app-identity.mjs +1 -1
  55. package/dist-lib/native-firebase-metadata.cjs +2 -2
  56. package/dist-lib/native-firebase-metadata.mjs +1 -1
  57. package/dist-lib/plist.cjs +2 -2
  58. package/dist-lib/plist.mjs +1 -1
  59. package/dist-lib/profiles.cjs +2 -2
  60. package/dist-lib/public-brand.cjs +2 -2
  61. package/dist-lib/react-native-host-modules.cjs +2 -2
  62. package/dist-lib/react-native-host-modules.mjs +1 -1
  63. package/dist-lib/render-mode.cjs +2 -2
  64. package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
  65. package/dist-lib/sdk.cjs +2 -2
  66. package/dist-lib/sdk.mjs +1 -1
  67. package/dist-lib/skills.cjs +462 -170
  68. package/dist-lib/swift-compile.cjs +105 -5
  69. package/dist-lib/swift-compile.mjs +101 -2
  70. package/dist-lib/swift-package.cjs +2 -2
  71. package/dist-lib/swift-package.mjs +1 -1
  72. package/dist-lib/swift-submit.cjs +2 -2
  73. package/dist-lib/swift-submit.mjs +1 -1
  74. package/dist-lib/swift-toolchain.cjs +2 -2
  75. package/dist-lib/swift.cjs +2 -2
  76. package/dist-lib/vite-swift.cjs +64 -8
  77. package/dist-lib/vite.cjs +2 -2
  78. package/package.json +20 -2
  79. package/src/bundle-channel.mjs +251 -0
  80. package/src/expo-swift-bundle.ts +32 -0
  81. package/src/expo-swift-host.ts +152 -128
  82. package/src/expoSwiftContract.ts +88 -0
  83. package/src/swift-compile.ts +111 -1
  84. package/src/swift-host.ts +4 -1
@@ -0,0 +1,91 @@
1
+ /*! rnx v0.1.794 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } 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/expoSwiftContract.ts
23
+ var expoSwiftContract_exports = {};
24
+ __export(expoSwiftContract_exports, {
25
+ insertExpoSwiftFooter: () => insertExpoSwiftFooter,
26
+ isExpoSwiftCompilationResult: () => isExpoSwiftCompilationResult,
27
+ readExpoSwiftFooter: () => readExpoSwiftFooter,
28
+ readExpoSwiftMetadata: () => readExpoSwiftMetadata
29
+ });
30
+ module.exports = __toCommonJS(expoSwiftContract_exports);
31
+ function record(value) {
32
+ return value !== null && typeof value === "object" && !Array.isArray(value);
33
+ }
34
+ function strings(value) {
35
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
36
+ }
37
+ function isExpoSwiftCompilationResult(value) {
38
+ if (!record(value) || !strings(value.namespaces) || !Array.isArray(value.modules) || value.modules.length > 1 || !Array.isArray(value.failures))
39
+ return false;
40
+ const remaining = new Set(value.namespaces);
41
+ if (remaining.size !== value.namespaces.length) return false;
42
+ for (const artifact of value.modules) {
43
+ if (!record(artifact) || !strings(artifact.namespaces) || artifact.namespaces.length === 0 || !artifact.namespaces.every((namespace) => remaining.delete(namespace)) || typeof artifact.url !== "string" || typeof artifact.hash !== "string" || typeof artifact.icuUrl !== "string" || typeof artifact.rootId !== "string")
44
+ return false;
45
+ }
46
+ for (const failure of value.failures) {
47
+ if (!record(failure) || typeof failure.namespace !== "string" || !remaining.delete(failure.namespace) || typeof failure.diagnostic !== "string")
48
+ return false;
49
+ }
50
+ return remaining.size === 0;
51
+ }
52
+ var FOOTER_PREFIX = "globalThis.__peachExpoSwift=";
53
+ function readExpoSwiftMetadata(value) {
54
+ if (value === null || value === void 0) return null;
55
+ if (!isExpoSwiftCompilationResult(value))
56
+ throw new Error("invalid Expo Swift compilation metadata");
57
+ return value;
58
+ }
59
+ function readExpoSwiftFooter(source) {
60
+ const start = source.lastIndexOf(`
61
+ ${FOOTER_PREFIX}`);
62
+ if (start < 0) return null;
63
+ const end = source.indexOf("\n", start + 1);
64
+ const line = source.slice(start + 1, end < 0 ? void 0 : end);
65
+ if (!line.endsWith(";")) throw new Error("Expo Swift footer is truncated");
66
+ const metadata = readExpoSwiftMetadata(JSON.parse(line.slice(FOOTER_PREFIX.length, -1)));
67
+ if (!metadata) throw new Error("Expo Swift footer has no metadata");
68
+ return metadata;
69
+ }
70
+ function insertExpoSwiftFooter(source, metadata) {
71
+ readExpoSwiftMetadata(metadata);
72
+ const start = source.lastIndexOf(`
73
+ ${FOOTER_PREFIX}`);
74
+ if (start >= 0) {
75
+ readExpoSwiftFooter(source);
76
+ const end = source.indexOf("\n", start + 1);
77
+ source = source.slice(0, start) + (end < 0 ? "" : source.slice(end));
78
+ }
79
+ const json = JSON.stringify(metadata).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
80
+ const footer = `
81
+ ${FOOTER_PREFIX}${json};`;
82
+ const identity = source.lastIndexOf("\nglobalThis.__sootsimModulePaths=");
83
+ return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
84
+ }
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ insertExpoSwiftFooter,
88
+ isExpoSwiftCompilationResult,
89
+ readExpoSwiftFooter,
90
+ readExpoSwiftMetadata
91
+ });
@@ -0,0 +1,63 @@
1
+ /*! rnx v0.1.794 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+
3
+ // src/expoSwiftContract.ts
4
+ function record(value) {
5
+ return value !== null && typeof value === "object" && !Array.isArray(value);
6
+ }
7
+ function strings(value) {
8
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
9
+ }
10
+ function isExpoSwiftCompilationResult(value) {
11
+ if (!record(value) || !strings(value.namespaces) || !Array.isArray(value.modules) || value.modules.length > 1 || !Array.isArray(value.failures))
12
+ return false;
13
+ const remaining = new Set(value.namespaces);
14
+ if (remaining.size !== value.namespaces.length) return false;
15
+ for (const artifact of value.modules) {
16
+ if (!record(artifact) || !strings(artifact.namespaces) || artifact.namespaces.length === 0 || !artifact.namespaces.every((namespace) => remaining.delete(namespace)) || typeof artifact.url !== "string" || typeof artifact.hash !== "string" || typeof artifact.icuUrl !== "string" || typeof artifact.rootId !== "string")
17
+ return false;
18
+ }
19
+ for (const failure of value.failures) {
20
+ if (!record(failure) || typeof failure.namespace !== "string" || !remaining.delete(failure.namespace) || typeof failure.diagnostic !== "string")
21
+ return false;
22
+ }
23
+ return remaining.size === 0;
24
+ }
25
+ var FOOTER_PREFIX = "globalThis.__peachExpoSwift=";
26
+ function readExpoSwiftMetadata(value) {
27
+ if (value === null || value === void 0) return null;
28
+ if (!isExpoSwiftCompilationResult(value))
29
+ throw new Error("invalid Expo Swift compilation metadata");
30
+ return value;
31
+ }
32
+ function readExpoSwiftFooter(source) {
33
+ const start = source.lastIndexOf(`
34
+ ${FOOTER_PREFIX}`);
35
+ if (start < 0) return null;
36
+ const end = source.indexOf("\n", start + 1);
37
+ const line = source.slice(start + 1, end < 0 ? void 0 : end);
38
+ if (!line.endsWith(";")) throw new Error("Expo Swift footer is truncated");
39
+ const metadata = readExpoSwiftMetadata(JSON.parse(line.slice(FOOTER_PREFIX.length, -1)));
40
+ if (!metadata) throw new Error("Expo Swift footer has no metadata");
41
+ return metadata;
42
+ }
43
+ function insertExpoSwiftFooter(source, metadata) {
44
+ readExpoSwiftMetadata(metadata);
45
+ const start = source.lastIndexOf(`
46
+ ${FOOTER_PREFIX}`);
47
+ if (start >= 0) {
48
+ readExpoSwiftFooter(source);
49
+ const end = source.indexOf("\n", start + 1);
50
+ source = source.slice(0, start) + (end < 0 ? "" : source.slice(end));
51
+ }
52
+ const json = JSON.stringify(metadata).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
53
+ const footer = `
54
+ ${FOOTER_PREFIX}${json};`;
55
+ const identity = source.lastIndexOf("\nglobalThis.__sootsimModulePaths=");
56
+ return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
57
+ }
58
+ export {
59
+ insertExpoSwiftFooter,
60
+ isExpoSwiftCompilationResult,
61
+ readExpoSwiftFooter,
62
+ readExpoSwiftMetadata
63
+ };
@@ -1,5 +1,5 @@
1
- /*! rnx v0.1.792 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
1
+ /*! rnx v0.1.794 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
5
5
  var __defProp = Object.defineProperty;
@@ -1,5 +1,5 @@
1
- /*! rnx v0.1.792 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
1
+ /*! rnx v0.1.794 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
5
5
  var __defProp = Object.defineProperty;
@@ -4407,7 +4407,7 @@ async function loadMetroFingerprintRegistry(options = {}) {
4407
4407
  }
4408
4408
  try {
4409
4409
  const payloadUrl = new URL(pointer.payloadUrl, baseUrl).toString();
4410
- const response = await request(payloadUrl, { cache: "force-cache" });
4410
+ const response = await request(payloadUrl);
4411
4411
  if (!response.ok) {
4412
4412
  throw new Error(`RNX Metro fingerprint registry answered ${response.status}`);
4413
4413
  }
@@ -10647,7 +10647,6 @@ function swiftPackagePartition(manifest, resourcePaths = []) {
10647
10647
  }
10648
10648
 
10649
10649
  // src/swift-compile.ts
10650
- var import_meta2 = {};
10651
10650
  var run2 = (0, import_node_util2.promisify)(import_node_child_process3.execFile);
10652
10651
  var WASM_TRIPLE = "wasm32-unknown-wasip1";
10653
10652
  var cores = import_node_os2.default.availableParallelism();
@@ -11517,6 +11516,57 @@ function lowerNSValueTimeBox(source) {
11517
11516
  out = out.slice(0, at) + insert + out.slice(at + remove);
11518
11517
  return out;
11519
11518
  }
11519
+ function lowerNotificationDelegate(source) {
11520
+ const code = swiftCodeMask(source);
11521
+ const selectors = {
11522
+ willPresent: "userNotificationCenter:willPresentNotification:withCompletionHandler:",
11523
+ didReceive: "userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:",
11524
+ openSettingsFor: "userNotificationCenter:openSettingsForNotification:"
11525
+ };
11526
+ const edits = [];
11527
+ const selector = /#(?:selector|Selector)\(\s*UNUserNotificationCenterDelegate\.userNotificationCenter\(\s*_\s*:\s*(willPresent|didReceive|openSettingsFor)\s*:[^)]*\)\s*\)/g;
11528
+ for (const match of code.matchAll(selector)) {
11529
+ edits.push([
11530
+ match.index,
11531
+ match[0].length,
11532
+ `NSSelectorFromString(${JSON.stringify(selectors[match[1]])})`
11533
+ ]);
11534
+ }
11535
+ const receivers = /* @__PURE__ */ new Set();
11536
+ for (const match of code.matchAll(
11537
+ /\b(?:var|let)\s+(\w+)\s*:\s*(?:any\s+)?UNUserNotificationCenterDelegate\??/g
11538
+ ))
11539
+ receivers.add(match[1]);
11540
+ for (const match of code.matchAll(/\blet\s+(\w+)\s*=\s*(?:self\.)?(\w+)\b/g)) {
11541
+ if (receivers.has(match[2])) receivers.add(match[1]);
11542
+ }
11543
+ for (const match of code.matchAll(
11544
+ /\b(\w+)(?:[?!])?\.userNotificationCenter\s*\?(?=\s*\()/g
11545
+ )) {
11546
+ if (receivers.has(match[1]))
11547
+ edits.push([match.index + match[0].lastIndexOf("?"), 1, " "]);
11548
+ }
11549
+ const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
11550
+ for (const owner of code.matchAll(
11551
+ /\b(?:class|extension)\s+[A-Za-z_]\w*[^{}]*\bUNUserNotificationCenterDelegate\b[^{}]*\{/g
11552
+ )) {
11553
+ const open = owner.index + owner[0].length - 1;
11554
+ const close = closingBrace(code, braces, open);
11555
+ const body = code.slice(open + 1, close - 1);
11556
+ for (const method of body.matchAll(/\bfunc\s+userNotificationCenter\s*\(/g)) {
11557
+ const at = open + 1 + method.index;
11558
+ const signature2 = code.slice(at, code.indexOf("{", at));
11559
+ const label = Object.keys(selectors).find(
11560
+ (name2) => new RegExp(`\\b${name2}\\b`).test(signature2)
11561
+ );
11562
+ if (label) edits.push([at, 0, `@ObjC(${JSON.stringify(selectors[label])}) `]);
11563
+ }
11564
+ }
11565
+ let result = source;
11566
+ for (const [at, count, text3] of edits.sort((a, b) => b[0] - a[0]))
11567
+ result = result.slice(0, at) + text3 + result.slice(at + count);
11568
+ return result;
11569
+ }
11520
11570
  function swiftCodeMask(source) {
11521
11571
  const chars = source.split("");
11522
11572
  const blank = (from, to) => {
@@ -11621,7 +11671,10 @@ function swiftCodeMask(source) {
11621
11671
  return chars.join("");
11622
11672
  }
11623
11673
  function swiftSourceAsIOS(original, extraObjCExtensions) {
11624
- const source = liftExtensionOverrides(original, extraObjCExtensions);
11674
+ const source = liftExtensionOverrides(
11675
+ lowerNotificationDelegate(original),
11676
+ extraObjCExtensions
11677
+ );
11625
11678
  const { lineStarts, tokens } = swiftCodeScan(source);
11626
11679
  let offset = 0;
11627
11680
  const conditioned = source.split("\n").map((line) => {
@@ -11724,6 +11777,49 @@ function swiftSourceAsIOS(original, extraObjCExtensions) {
11724
11777
  lowerAVAssetURLCluster(lowerAnyObjectDoubleValue(out + conditioned.slice(copied)))
11725
11778
  );
11726
11779
  }
11780
+ function swiftSourceClosure(files2, roots) {
11781
+ const sources = /* @__PURE__ */ new Map();
11782
+ const owners = /* @__PURE__ */ new Map();
11783
+ const extensions = /* @__PURE__ */ new Map();
11784
+ for (const [file, source] of Object.entries(files2)) {
11785
+ if (!file.endsWith(".swift")) continue;
11786
+ const code = swiftCodeMask(source);
11787
+ const references = new Set(code.match(/[A-Za-z_]\w*/g) ?? []);
11788
+ const pattern = /[{}]|\b(class|struct|enum|protocol|actor|typealias|func|var|let|extension)\s+([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*)/g;
11789
+ let depth = 0;
11790
+ for (const match of code.matchAll(pattern)) {
11791
+ if (match[0] === "{") {
11792
+ depth++;
11793
+ continue;
11794
+ }
11795
+ if (match[0] === "}") {
11796
+ depth--;
11797
+ continue;
11798
+ }
11799
+ if (depth !== 0 || !match[2]) continue;
11800
+ const name2 = match[2].split(".").pop();
11801
+ const index = match[1] === "extension" ? extensions : owners;
11802
+ const set2 = index.get(name2) ?? /* @__PURE__ */ new Set();
11803
+ set2.add(file);
11804
+ index.set(name2, set2);
11805
+ }
11806
+ sources.set(file, references);
11807
+ }
11808
+ const included = /* @__PURE__ */ new Set();
11809
+ const pending = [...roots];
11810
+ const seen = /* @__PURE__ */ new Set();
11811
+ while (pending.length) {
11812
+ const name2 = pending.pop();
11813
+ if (seen.has(name2)) continue;
11814
+ seen.add(name2);
11815
+ for (const file of [...owners.get(name2) ?? [], ...extensions.get(name2) ?? []]) {
11816
+ if (included.has(file)) continue;
11817
+ included.add(file);
11818
+ for (const reference of sources.get(file)) pending.push(reference);
11819
+ }
11820
+ }
11821
+ return Object.fromEntries(Object.entries(files2).filter(([file]) => included.has(file)));
11822
+ }
11727
11823
  function swiftCodeScan(source) {
11728
11824
  const starts = /* @__PURE__ */ new Set();
11729
11825
  const tokens = [];
@@ -12000,7 +12096,7 @@ function compileSwiftProjectUnit(input, options) {
12000
12096
  };
12001
12097
  const hash = swiftArtifactHash(input, options.release, moduleRoot);
12002
12098
  return serialize(root, async () => {
12003
- if (process.platform === "darwin" && process.env.TM_SESSION && process.env.CI !== "true" && process.env.CONTRAST_HEAVY_ADMITTED !== "1" && moduleRoot === import_node_path7.default.resolve(import_meta2.dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
12099
+ if (process.platform === "darwin" && process.env.TM_SESSION && process.env.CI !== "true" && process.env.CONTRAST_HEAVY_ADMITTED !== "1" && moduleRoot === import_node_path7.default.resolve(__sootsim_import_meta_dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
12004
12100
  const requestRoot = (0, import_node_fs7.mkdtempSync)(import_node_path7.default.join(root, ".builder-request-"));
12005
12101
  const output = import_node_path7.default.join(requestRoot, "output");
12006
12102
  const request = import_node_path7.default.join(requestRoot, "request.json");
@@ -12651,7 +12747,6 @@ function swiftInstallSteps(release, wasmSdk) {
12651
12747
  }
12652
12748
 
12653
12749
  // src/swift-distribution.ts
12654
- var import_meta3 = {};
12655
12750
  var SWIFT_ENDPOINT_ENV = "PEACH_SWIFT_ENDPOINT";
12656
12751
  var installs = /* @__PURE__ */ new Map();
12657
12752
  function swiftDistributionRoot() {
@@ -12698,7 +12793,7 @@ function swiftDistributionRoot() {
12698
12793
  return pending;
12699
12794
  }
12700
12795
  async function resolveSwiftModule() {
12701
- const checkout2 = import_node_path11.default.resolve(import_meta3.dirname, "../../sootsim-swift");
12796
+ const checkout2 = import_node_path11.default.resolve(__sootsim_import_meta_dirname, "../../sootsim-swift");
12702
12797
  if (import_node_fs11.default.existsSync(import_node_path11.default.join(checkout2, "toolchain.json"))) {
12703
12798
  try {
12704
12799
  return { root: checkout2, ...swiftModuleToolchain(checkout2) };
@@ -16343,6 +16438,8 @@ function nativeSourceDescriptor(packagePath) {
16343
16438
  }
16344
16439
  return value;
16345
16440
  }
16441
+ var SwiftMissingModulesError = class extends Error {
16442
+ };
16346
16443
  var projects = /* @__PURE__ */ new Map();
16347
16444
  function projectFor(packagePath, hosted) {
16348
16445
  packagePath = import_node_fs18.default.realpathSync(packagePath);
@@ -16846,7 +16943,8 @@ async function compile(packagePath, entry, stamp, moduleRootOverride, hosted, sn
16846
16943
  ...targets.length > 0 ? targets : ["App"]
16847
16944
  ])
16848
16945
  );
16849
- if (missing.size > 0) throw new Error(await missingModulesMessage(packagePath, missing));
16946
+ if (missing.size > 0)
16947
+ throw new SwiftMissingModulesError(await missingModulesMessage(packagePath, missing));
16850
16948
  const artifact = await compileSwiftProjectUnit(input, {
16851
16949
  // the compile rewrites Sources/App in its root before swiftpm builds, and
16852
16950
  // its lock orders one process only: two vites on one root (a lane's dev
@@ -17207,9 +17305,10 @@ async function collectExpoSwiftSources(appRoot) {
17207
17305
  const name2 = module2 && typeof module2 === "object" ? Reflect.get(module2, "name") : null;
17208
17306
  if (typeof className !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(className) || name2 !== null && typeof name2 !== "string")
17209
17307
  throw new Error(`${sourceRoot}: invalid Expo Apple module descriptor`);
17210
- classes.push(
17211
- `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
17212
- );
17308
+ classes.push({
17309
+ name: className.split(".").pop(),
17310
+ registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name2 === null ? "nil" : JSON.stringify(name2)})`
17311
+ });
17213
17312
  }
17214
17313
  const ios = import_node_path20.default.join(canonical, "ios");
17215
17314
  if (import_node_fs19.default.lstatSync(ios).isSymbolicLink())
@@ -17234,21 +17333,33 @@ ${import_node_fs19.default.readFileSync(file, "utf8")}`;
17234
17333
  }
17235
17334
  };
17236
17335
  walk2(ios);
17237
- const unit = { namespace, classes, files: files2 };
17238
- files2[EXPO_SWIFT_ENTRY] = expoEntry([unit]);
17239
- units.push(unit);
17336
+ for (const module2 of classes) {
17337
+ const unit = {
17338
+ namespace,
17339
+ moduleId: `${namespace}.${module2.name}`,
17340
+ classes: [module2.registration],
17341
+ files: swiftSourceClosure(files2, [module2.name])
17342
+ };
17343
+ unit.files[EXPO_SWIFT_ENTRY] = expoEntry([unit]);
17344
+ units.push(unit);
17345
+ }
17240
17346
  }
17241
17347
  if (units.length === 0) return null;
17242
17348
  const allFiles = Object.assign(
17243
17349
  {},
17244
17350
  ...units.map((unit) => unit.files)
17245
17351
  );
17246
- const targets = units.map((unit) => ({
17247
- name: unit.namespace,
17248
- path: `Sources/${unit.namespace}`
17352
+ const targets = [...new Set(units.map((unit) => unit.namespace))].map((namespace) => ({
17353
+ name: namespace,
17354
+ path: `Sources/${namespace}`
17249
17355
  }));
17250
17356
  const dependencies = swiftTargetDependencies(allFiles, targets);
17251
- const byNamespace = new Map(units.map((unit) => [unit.namespace, unit]));
17357
+ const byNamespace = /* @__PURE__ */ new Map();
17358
+ for (const unit of units) {
17359
+ const entries = byNamespace.get(unit.namespace) ?? [];
17360
+ entries.push(unit);
17361
+ byNamespace.set(unit.namespace, entries);
17362
+ }
17252
17363
  for (const unit of units) {
17253
17364
  const included = /* @__PURE__ */ new Set([unit.namespace]);
17254
17365
  const visit3 = (namespace) => {
@@ -17277,7 +17388,7 @@ let package = Package(name: "PeachExpo", targets: [${[...included].map((name2) =
17277
17388
  function expoEntry(units) {
17278
17389
  return `import SwiftUI
17279
17390
  import ExpoModulesCore
17280
- ${units.map((unit) => `import ${unit.namespace}`).join("\n")}
17391
+ ${[...new Set(units.map((unit) => unit.namespace))].map((namespace) => `import ${namespace}`).join("\n")}
17281
17392
 
17282
17393
  @main struct PeachExpoApp: RNXPackage {
17283
17394
  init() { MainActor.assumeIsolated { PeachExpoRuntime.register([${units.flatMap((unit) => unit.classes).join(", ")}]) } }
@@ -17293,6 +17404,112 @@ ${units.map((unit) => `import ${unit.namespace}`).join("\n")}
17293
17404
  }
17294
17405
  var compiling = /* @__PURE__ */ new Map();
17295
17406
  var failedCompilations = /* @__PURE__ */ new Map();
17407
+ async function compileExpoSwiftModules(root, base, publishArtifact) {
17408
+ const units = await collectExpoSwiftSources(root);
17409
+ if (!units) return null;
17410
+ const module2 = await resolveSwiftModule();
17411
+ if (!module2 && publishArtifact)
17412
+ throw new Error("No local Swift toolchain or distribution is available");
17413
+ const result = {
17414
+ namespaces: units.map((unit) => unit.moduleId),
17415
+ modules: [],
17416
+ failures: []
17417
+ };
17418
+ const key2 = (0, import_node_crypto9.createHash)("sha256").update(import_node_fs19.default.realpathSync(root)).digest("hex");
17419
+ const linked = [];
17420
+ for (const unit of units) {
17421
+ if (!module2) {
17422
+ result.failures.push({
17423
+ namespace: unit.moduleId,
17424
+ diagnostic: "No local Swift toolchain or distribution is available"
17425
+ });
17426
+ continue;
17427
+ }
17428
+ try {
17429
+ const packagePath = import_node_path20.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, unit.moduleId);
17430
+ syncSwiftTree(
17431
+ packagePath,
17432
+ new Map(
17433
+ Object.entries(unit.files).map(([name2, source]) => [
17434
+ import_node_path20.default.join(packagePath, name2),
17435
+ source
17436
+ ])
17437
+ )
17438
+ );
17439
+ const stamp = sourceStamp(packagePath, module2.root);
17440
+ const failed = failedCompilations.get(packagePath);
17441
+ if (failed?.stamp === stamp) {
17442
+ result.failures.push({
17443
+ namespace: unit.moduleId,
17444
+ diagnostic: failed.diagnostic
17445
+ });
17446
+ continue;
17447
+ }
17448
+ failedCompilations.delete(packagePath);
17449
+ await artifactFor(projectFor(packagePath), EXPO_SWIFT_ENTRY, module2.root).catch(
17450
+ (error) => {
17451
+ const diagnostic = error instanceof Error ? error.message : String(error);
17452
+ if (/^.+:\d+(?::\d+)?: error:/m.test(diagnostic) && sourceStamp(packagePath, module2.root) === stamp)
17453
+ failedCompilations.set(packagePath, { stamp, diagnostic });
17454
+ throw error;
17455
+ }
17456
+ );
17457
+ linked.push(unit);
17458
+ } catch (error) {
17459
+ const diagnostic = error instanceof Error ? error.message : String(error);
17460
+ const sourceErrors = diagnostic.match(/^.+:\d+(?::\d+)?: error:.*$/gm);
17461
+ if (publishArtifact && !sourceErrors && !(error instanceof SwiftMissingModulesError))
17462
+ throw error;
17463
+ result.failures.push({
17464
+ namespace: unit.moduleId,
17465
+ diagnostic: sourceErrors ? sourceErrors.join("\n") : diagnostic
17466
+ });
17467
+ }
17468
+ }
17469
+ if (module2 && linked.length) {
17470
+ const files2 = Object.assign(
17471
+ {},
17472
+ ...linked.map((unit) => unit.files)
17473
+ );
17474
+ files2[EXPO_SWIFT_ENTRY] = expoEntry(linked);
17475
+ const targets = [
17476
+ ...new Set(
17477
+ Object.keys(files2).flatMap((name2) => {
17478
+ const match = /^Sources\/([^/]+)\//.exec(name2);
17479
+ return match && match[1] !== "PeachExpoApp" ? [match[1]] : [];
17480
+ })
17481
+ )
17482
+ ];
17483
+ files2["Package.swift"] = `// swift-tools-version: 6.0
17484
+ import PackageDescription
17485
+ let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.target(name: ${JSON.stringify(name2)}, path: ${JSON.stringify(`Sources/${name2}`)})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
17486
+ `;
17487
+ const packagePath = import_node_path20.default.join(import_node_os9.default.tmpdir(), "peach-expo-swift", key2, "linked-app");
17488
+ syncSwiftTree(
17489
+ packagePath,
17490
+ new Map(
17491
+ Object.entries(files2).map(([name2, source]) => [
17492
+ import_node_path20.default.join(packagePath, name2),
17493
+ source
17494
+ ])
17495
+ )
17496
+ );
17497
+ const artifact = await artifactFor(
17498
+ projectFor(packagePath),
17499
+ EXPO_SWIFT_ENTRY,
17500
+ module2.root
17501
+ );
17502
+ await publishArtifact?.(artifact);
17503
+ result.modules.push({
17504
+ namespaces: linked.map((unit) => unit.moduleId),
17505
+ url: `${base}/__peach/swift/${artifact.hash}.wasm`,
17506
+ hash: artifact.hash,
17507
+ icuUrl: icuUrl(base, artifact),
17508
+ rootId: `${key2}/Expo`
17509
+ });
17510
+ }
17511
+ return result;
17512
+ }
17296
17513
  async function handleExpoSwiftRequest(req, res) {
17297
17514
  const url = new URL(req.url ?? "/", "http://localhost");
17298
17515
  if (!url.pathname.startsWith("/__peach/swift") && url.pathname !== EXPO_SWIFT_ROUTE)
@@ -17324,118 +17541,9 @@ async function handleExpoSwiftRequest(req, res) {
17324
17541
  let pending = compiling.get(root);
17325
17542
  if (!pending) {
17326
17543
  pending = (async () => {
17327
- const units = await collectExpoSwiftSources(root);
17328
- if (!units) return null;
17329
- const module2 = await resolveSwiftModule();
17330
- const result = {
17331
- namespaces: units.map((unit) => unit.namespace),
17332
- modules: [],
17333
- failures: []
17334
- };
17335
- const key2 = (0, import_node_crypto9.createHash)("sha256").update(import_node_fs19.default.realpathSync(root)).digest("hex");
17336
17544
  const host2 = req.headers.host;
17337
17545
  if (!host2) throw new Error("Expo Swift request has no host");
17338
- const base = `http://${host2}`;
17339
- const linked = [];
17340
- for (const unit of units) {
17341
- if (!module2) {
17342
- result.failures.push({
17343
- namespace: unit.namespace,
17344
- diagnostic: "No local Swift toolchain or distribution is available"
17345
- });
17346
- continue;
17347
- }
17348
- try {
17349
- const packagePath = import_node_path20.default.join(
17350
- import_node_os9.default.tmpdir(),
17351
- "peach-expo-swift",
17352
- key2,
17353
- unit.namespace
17354
- );
17355
- syncSwiftTree(
17356
- packagePath,
17357
- new Map(
17358
- Object.entries(unit.files).map(([name2, source]) => [
17359
- import_node_path20.default.join(packagePath, name2),
17360
- source
17361
- ])
17362
- )
17363
- );
17364
- const stamp = sourceStamp(packagePath, module2.root);
17365
- const failed = failedCompilations.get(packagePath);
17366
- if (failed?.stamp === stamp) {
17367
- result.failures.push({
17368
- namespace: unit.namespace,
17369
- diagnostic: failed.diagnostic
17370
- });
17371
- continue;
17372
- }
17373
- failedCompilations.delete(packagePath);
17374
- await artifactFor(
17375
- projectFor(packagePath),
17376
- EXPO_SWIFT_ENTRY,
17377
- module2.root
17378
- ).catch((error) => {
17379
- const diagnostic = error instanceof Error ? error.message : String(error);
17380
- if (/^.+:\d+(?::\d+)?: error:/m.test(diagnostic) && sourceStamp(packagePath, module2.root) === stamp)
17381
- failedCompilations.set(packagePath, { stamp, diagnostic });
17382
- throw error;
17383
- });
17384
- linked.push(unit);
17385
- } catch (error) {
17386
- result.failures.push({
17387
- namespace: unit.namespace,
17388
- diagnostic: error instanceof Error ? error.message : String(error)
17389
- });
17390
- }
17391
- }
17392
- if (module2 && linked.length) {
17393
- const files2 = Object.assign(
17394
- {},
17395
- ...linked.map((unit) => unit.files)
17396
- );
17397
- files2[EXPO_SWIFT_ENTRY] = expoEntry(linked);
17398
- const targets = [
17399
- ...new Set(
17400
- Object.keys(files2).flatMap((name2) => {
17401
- const match = /^Sources\/([^/]+)\//.exec(name2);
17402
- return match && match[1] !== "PeachExpoApp" ? [match[1]] : [];
17403
- })
17404
- )
17405
- ];
17406
- files2["Package.swift"] = `// swift-tools-version: 6.0
17407
- import PackageDescription
17408
- let package = Package(name: "PeachExpo", targets: [${targets.map((name2) => `.target(name: ${JSON.stringify(name2)}, path: ${JSON.stringify(`Sources/${name2}`)})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
17409
- `;
17410
- const packagePath = import_node_path20.default.join(
17411
- import_node_os9.default.tmpdir(),
17412
- "peach-expo-swift",
17413
- key2,
17414
- "linked-app"
17415
- );
17416
- syncSwiftTree(
17417
- packagePath,
17418
- new Map(
17419
- Object.entries(files2).map(([name2, source]) => [
17420
- import_node_path20.default.join(packagePath, name2),
17421
- source
17422
- ])
17423
- )
17424
- );
17425
- const artifact = await artifactFor(
17426
- projectFor(packagePath),
17427
- EXPO_SWIFT_ENTRY,
17428
- module2.root
17429
- );
17430
- result.modules.push({
17431
- namespaces: linked.map((unit) => unit.namespace),
17432
- url: `${base}/__peach/swift/${artifact.hash}.wasm`,
17433
- hash: artifact.hash,
17434
- icuUrl: icuUrl(base, artifact),
17435
- rootId: `${key2}/Expo`
17436
- });
17437
- }
17438
- return result;
17546
+ return compileExpoSwiftModules(root, `http://${host2}`);
17439
17547
  })();
17440
17548
  compiling.set(root, pending);
17441
17549
  }
@@ -1,5 +1,5 @@
1
- /*! rnx v0.1.792 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
1
+ /*! rnx v0.1.794 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
5
5
  var __defProp = Object.defineProperty;
@@ -1,5 +1,5 @@
1
- /*! rnx v0.1.792 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
1
+ /*! rnx v0.1.794 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.792 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.794 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/host/fetch-proxy-overrides.ts
4
4
  var FETCH_PROXY_NATIVE_USER_AGENT_HEADER = "x-sootsim-native-user-agent";