peachsim 0.1.1635 → 0.1.1640

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 (129) hide show
  1. package/README.md +5 -1
  2. package/cli/app-config.ts +14 -5
  3. package/cli/app-stubs.ts +62 -13
  4. package/cli/bridge-flow-runner.ts +2 -2
  5. package/cli/cloud-client.ts +60 -40
  6. package/cli/commands/doctor.ts +13 -5
  7. package/cli/commands/flow.ts +1 -1
  8. package/cli/commands/inspect/shared.ts +9 -4
  9. package/cli/commands/inspect.ts +65 -47
  10. package/cli/commands/preview.ts +1 -1
  11. package/cli/commands/record.ts +97 -47
  12. package/cli/commands/swift.ts +9 -3
  13. package/cli/commands/upload.ts +48 -42
  14. package/cli/drivers/playwright-sim-host.ts +65 -42
  15. package/cli/main.ts +1 -1
  16. package/cli/outbound-endpoints.ts +7 -5
  17. package/cli/pause-aware-timeout.ts +4 -0
  18. package/cli/ws-bridge.ts +19 -10
  19. package/detox/attempt-events.cjs +62 -5
  20. package/detox/attempt-events.d.cts +7 -0
  21. package/detox/expectations.ts +7 -3
  22. package/detox/index.ts +121 -47
  23. package/detox/motion-change.cjs +170 -21
  24. package/detox/motion-change.d.cts +32 -0
  25. package/detox/navigation-lifecycle.ts +35 -3
  26. package/dist-lib/agent-daemon-client.cjs +1 -1
  27. package/dist-lib/agent-events.cjs +1 -1
  28. package/dist-lib/attached-projects.cjs +1 -1
  29. package/dist-lib/auth/shared-session.cjs +1 -1
  30. package/dist-lib/backend-origin.cjs +8 -7
  31. package/dist-lib/beta.cjs +1 -1
  32. package/dist-lib/beta.mjs +1 -1
  33. package/dist-lib/bridge-constants.cjs +1 -1
  34. package/dist-lib/bridge-contract-input.cjs +1 -1
  35. package/dist-lib/bridge-contract-input.mjs +1 -1
  36. package/dist-lib/bridge-contract.cjs +1 -1
  37. package/dist-lib/bridge-contract.mjs +1 -1
  38. package/dist-lib/bundle-channel.cjs +4038 -1983
  39. package/dist-lib/capture-contract.cjs +1 -1
  40. package/dist-lib/capture-contract.mjs +1 -1
  41. package/dist-lib/cloud-contract.cjs +1 -1
  42. package/dist-lib/cloud-contract.mjs +1 -1
  43. package/dist-lib/cloud-test-args.cjs +1 -1
  44. package/dist-lib/cloud-test-args.mjs +1 -1
  45. package/dist-lib/cloud.cjs +1 -1
  46. package/dist-lib/cloud.mjs +1 -1
  47. package/dist-lib/config.cjs +1 -1
  48. package/dist-lib/config.mjs +1 -1
  49. package/dist-lib/detox/index.cjs +509 -86
  50. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  51. package/dist-lib/expo-swift-bundle.cjs +3551 -1574
  52. package/dist-lib/expo-swift-metadata.cjs +9 -7
  53. package/dist-lib/expo-swift-metadata.mjs +9 -7
  54. package/dist-lib/home-paths.cjs +1 -1
  55. package/dist-lib/host/bridge-host.cjs +43633 -2635
  56. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  57. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  58. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  59. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  60. package/dist-lib/host/websocket-proxy.cjs +1 -1
  61. package/dist-lib/index.cjs +2748 -128
  62. package/dist-lib/jump-to-source-babel.cjs +1 -1
  63. package/dist-lib/jump-to-source-native.cjs +1 -1
  64. package/dist-lib/kotlin-host.cjs +1 -1
  65. package/dist-lib/menu.cjs +1 -1
  66. package/dist-lib/menu.mjs +1 -1
  67. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  68. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  69. package/dist-lib/metro-production-bundle.cjs +1 -1
  70. package/dist-lib/metro-production-bundle.mjs +1 -1
  71. package/dist-lib/metro.cjs +2547 -83
  72. package/dist-lib/native-app-identity-project.cjs +237 -50
  73. package/dist-lib/native-app-identity-project.mjs +237 -50
  74. package/dist-lib/native-app-identity.cjs +29 -30
  75. package/dist-lib/native-app-identity.mjs +29 -30
  76. package/dist-lib/native-firebase-metadata.cjs +1 -1
  77. package/dist-lib/native-firebase-metadata.mjs +1 -1
  78. package/dist-lib/plist.cjs +1 -1
  79. package/dist-lib/plist.mjs +1 -1
  80. package/dist-lib/profiles.cjs +1 -1
  81. package/dist-lib/public-brand.cjs +1 -1
  82. package/dist-lib/react-native-host-modules.cjs +2 -2
  83. package/dist-lib/react-native-host-modules.mjs +2 -2
  84. package/dist-lib/scripts/dev-server-scanner.cjs +8 -6
  85. package/dist-lib/sdk.cjs +1 -1
  86. package/dist-lib/sdk.mjs +1 -1
  87. package/dist-lib/skills.cjs +65403 -22739
  88. package/dist-lib/swift-compile.cjs +93 -32
  89. package/dist-lib/swift-compile.mjs +93 -32
  90. package/dist-lib/swift-package.cjs +1 -1
  91. package/dist-lib/swift-package.mjs +1 -1
  92. package/dist-lib/swift-submit.cjs +7 -5
  93. package/dist-lib/swift-submit.mjs +7 -5
  94. package/dist-lib/swift-toolchain.cjs +316 -41
  95. package/dist-lib/swift.cjs +1 -1
  96. package/dist-lib/vite-swift.cjs +7335 -5432
  97. package/dist-lib/vite.cjs +2857 -12
  98. package/dist-lib/worklet-executable.cjs +14 -2
  99. package/dist-lib/worklet-executable.mjs +14 -2
  100. package/package.json +1 -1
  101. package/src/backend-origin.ts +13 -6
  102. package/src/expo-swift-host.ts +5 -2
  103. package/src/expoKotlinContract.ts +4 -7
  104. package/src/expoSwiftContract.ts +4 -6
  105. package/src/host/staged-host-files.ts +9 -0
  106. package/src/native-app-identity-project.ts +1 -4
  107. package/src/native-app-identity.ts +1 -4
  108. package/src/nativeAppIconContract.ts +1 -4
  109. package/src/output-lock-stdio.ts +36 -0
  110. package/src/react-native-bridge-modules.ts +21 -6
  111. package/src/react-native-host-modules.ts +4 -1
  112. package/src/settings-bundle.ts +1 -4
  113. package/src/swift-compile.ts +91 -33
  114. package/src/swift-distribution.lock.json +22 -12
  115. package/src/swift-distribution.ts +103 -4
  116. package/src/swift-host.ts +89 -26
  117. package/src/swift-icu.ts +16 -10
  118. package/src/swift-objc-compile.ts +355 -0
  119. package/src/swift-objc-sdk.ts +689 -18
  120. package/src/swift-objc-standin.ts +126 -14
  121. package/src/swift-package-manifest.ts +39 -1
  122. package/src/swift-packages.ts +35 -21
  123. package/src/swift-standin-emit.ts +40 -7
  124. package/src/swift-standins.ts +404 -138
  125. package/src/swift-submit.ts +3 -5
  126. package/src/swift-toolchain.ts +378 -46
  127. package/src/worker-system-chunks.ts +11 -12
  128. package/src/worklet-executable.ts +19 -1
  129. package/src/xcode-project.ts +270 -30
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1640 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
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;
@@ -1578,10 +1578,12 @@ function androidMergedResourceValuesDirectory(manifestFile) {
1578
1578
  return `${intermediates}incremental/${variant}/merge${taskVariant}Resources/merged.dir`;
1579
1579
  }
1580
1580
 
1581
- // src/nativeAppIconContract.ts
1581
+ // src/is-record.ts
1582
1582
  function isRecord(value) {
1583
1583
  return typeof value === "object" && value !== null && !Array.isArray(value);
1584
1584
  }
1585
+
1586
+ // src/nativeAppIconContract.ts
1585
1587
  function resolveNativeAppIconArtwork(resources, readText, resourceUri, icons, primaryName, alternateNames, resolveReference) {
1586
1588
  const members = new Set(resources);
1587
1589
  const dictionary = isRecord(icons) ? icons : {};
@@ -1835,21 +1837,18 @@ function visitXcodeTargetMembers(objects, targetId, resolvePath, filesUnder, joi
1835
1837
  }
1836
1838
 
1837
1839
  // src/native-app-identity.ts
1838
- function isRecord2(value) {
1839
- return typeof value === "object" && value !== null && !Array.isArray(value);
1840
- }
1841
1840
  function nonEmptyString(value) {
1842
1841
  return typeof value === "string" && value.length > 0 ? value : null;
1843
1842
  }
1844
1843
  function readGoogleSignInConfiguration(plist3, resources) {
1845
1844
  const clientIds = {};
1846
1845
  for (const [file, value] of Object.entries(resources)) {
1847
- if (isRecord2(value) && typeof value.CLIENT_ID === "string")
1846
+ if (isRecord(value) && typeof value.CLIENT_ID === "string")
1848
1847
  clientIds[file.split("/").pop()?.replace(/\.plist$/, "") ?? file] = value.CLIENT_ID;
1849
1848
  }
1850
1849
  const urlSchemes = [];
1851
1850
  for (const entry of Array.isArray(plist3.CFBundleURLTypes) ? plist3.CFBundleURLTypes : []) {
1852
- if (!isRecord2(entry) || !Array.isArray(entry.CFBundleURLSchemes)) continue;
1851
+ if (!isRecord(entry) || !Array.isArray(entry.CFBundleURLSchemes)) continue;
1853
1852
  for (const scheme of entry.CFBundleURLSchemes)
1854
1853
  if (typeof scheme === "string") urlSchemes.push(scheme);
1855
1854
  }
@@ -1957,14 +1956,14 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
1957
1956
  let objects = {};
1958
1957
  try {
1959
1958
  const parsed = parseOpenStepPlist(pbxproj);
1960
- if (isRecord2(parsed)) {
1961
- objects = isRecord2(parsed.objects) ? parsed.objects : parsed;
1959
+ if (isRecord(parsed)) {
1960
+ objects = isRecord(parsed.objects) ? parsed.objects : parsed;
1962
1961
  }
1963
1962
  } catch {
1964
1963
  }
1965
1964
  const targets = [];
1966
1965
  for (const [id, obj] of Object.entries(objects)) {
1967
- if (isRecord2(obj) && obj.isa === "PBXNativeTarget" && typeof obj.name === "string") {
1966
+ if (isRecord(obj) && obj.isa === "PBXNativeTarget" && typeof obj.name === "string") {
1968
1967
  targets.push({
1969
1968
  id,
1970
1969
  name: obj.name,
@@ -2010,13 +2009,13 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
2010
2009
  PRODUCT_NAME: targetName
2011
2010
  };
2012
2011
  for (const obj of Object.values(objects)) {
2013
- if (isRecord2(obj) && obj.isa === "PBXProject" && typeof obj.buildConfigurationList === "string") {
2012
+ if (isRecord(obj) && obj.isa === "PBXProject" && typeof obj.buildConfigurationList === "string") {
2014
2013
  const listObj = objects[obj.buildConfigurationList];
2015
- if (isRecord2(listObj) && Array.isArray(listObj.buildConfigurations)) {
2014
+ if (isRecord(listObj) && Array.isArray(listObj.buildConfigurations)) {
2016
2015
  for (const configId of listObj.buildConfigurations) {
2017
2016
  if (typeof configId === "string") {
2018
2017
  const configObj = objects[configId];
2019
- if (isRecord2(configObj) && configObj.name === "Release" && isRecord2(configObj.buildSettings)) {
2018
+ if (isRecord(configObj) && configObj.name === "Release" && isRecord(configObj.buildSettings)) {
2020
2019
  for (const [k, v] of Object.entries(configObj.buildSettings)) {
2021
2020
  if (typeof v === "string") settings[k] = v;
2022
2021
  }
@@ -2028,11 +2027,11 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
2028
2027
  }
2029
2028
  if (selectedTarget?.buildConfigurationList) {
2030
2029
  const listObj = objects[selectedTarget.buildConfigurationList];
2031
- if (isRecord2(listObj) && Array.isArray(listObj.buildConfigurations)) {
2030
+ if (isRecord(listObj) && Array.isArray(listObj.buildConfigurations)) {
2032
2031
  for (const configId of listObj.buildConfigurations) {
2033
2032
  if (typeof configId === "string") {
2034
2033
  const configObj = objects[configId];
2035
- if (isRecord2(configObj) && configObj.name === "Release" && isRecord2(configObj.buildSettings)) {
2034
+ if (isRecord(configObj) && configObj.name === "Release" && isRecord(configObj.buildSettings)) {
2036
2035
  for (const [k, v] of Object.entries(configObj.buildSettings)) {
2037
2036
  if (typeof v === "string") settings[k] = v;
2038
2037
  }
@@ -2083,7 +2082,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
2083
2082
  if (!bundleName) return null;
2084
2083
  const applicationName = identityFieldFrom(settings, plistString(plist3, "CFBundleDisplayName"), void 0) ?? bundleName;
2085
2084
  const dictionary = parseInfoPlist(plist3);
2086
- if (!isRecord2(dictionary)) throw new Error("native app Info.plist is not a dictionary");
2085
+ if (!isRecord(dictionary)) throw new Error("native app Info.plist is not a dictionary");
2087
2086
  const declaredDisplayName = dictionary.CFBundleDisplayName;
2088
2087
  const applicationDisplayName = typeof declaredDisplayName === "string" ? resolveBuildSetting(declaredDisplayName, settings) : void 0;
2089
2088
  if (applicationDisplayName === null)
@@ -2096,9 +2095,9 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
2096
2095
  if (dtPlatformVersion === null)
2097
2096
  throw new Error("native app Info.plist DTPlatformVersion is unresolved");
2098
2097
  const icons = dictionary.CFBundleIcons;
2099
- const alternates = isRecord2(icons) ? icons.CFBundleAlternateIcons : void 0;
2098
+ const alternates = isRecord(icons) ? icons.CFBundleAlternateIcons : void 0;
2100
2099
  const alternateIconNames = /* @__PURE__ */ new Set();
2101
- for (const name of isRecord2(alternates) ? Object.keys(alternates) : []) {
2100
+ for (const name of isRecord(alternates) ? Object.keys(alternates) : []) {
2102
2101
  const resolved = resolveBuildSetting(name, settings);
2103
2102
  if (resolved === null) throw new Error("native alternate icon name is unresolved");
2104
2103
  alternateIconNames.add(resolved);
@@ -2202,11 +2201,11 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
2202
2201
  return `${base.startsWith("/") ? "/" : ""}${segments.join("/")}`;
2203
2202
  };
2204
2203
  const project = Object.values(objects).find(
2205
- (object) => isRecord2(object) && object.isa === "PBXProject"
2204
+ (object) => isRecord(object) && object.isa === "PBXProject"
2206
2205
  );
2207
2206
  const projectDir = join(
2208
2207
  pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
2209
- isRecord2(project) && typeof project.projectDirPath === "string" ? project.projectDirPath : ""
2208
+ isRecord(project) && typeof project.projectDirPath === "string" ? project.projectDirPath : ""
2210
2209
  );
2211
2210
  const paths = Object.keys(files);
2212
2211
  visitXcodeTargetMembers(
@@ -2319,6 +2318,8 @@ function parsePlistSource(source) {
2319
2318
  }
2320
2319
 
2321
2320
  // src/xcode-project.ts
2321
+ var import_node_child_process = require("node:child_process");
2322
+ var import_node_crypto = require("node:crypto");
2322
2323
  var import_node_fs = __toESM(require("node:fs"), 1);
2323
2324
  var import_node_path2 = __toESM(require("node:path"), 1);
2324
2325
  var import_plist2 = __toESM(require_plist(), 1);
@@ -2926,33 +2927,131 @@ function expand(value, lookup) {
2926
2927
  }
2927
2928
  );
2928
2929
  }
2929
- function targetMembers(ref, settings, options = {}) {
2930
+ var preparedSourcePhases = /* @__PURE__ */ new Map();
2931
+ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
2930
2932
  const { project, target, id: targetId } = ref;
2931
2933
  const targetName = str(target.name) ?? targetId;
2932
2934
  const sources = /* @__PURE__ */ new Set();
2933
2935
  const allSources = /* @__PURE__ */ new Set();
2934
2936
  const resources = /* @__PURE__ */ new Set();
2935
2937
  const scriptForOutput = /* @__PURE__ */ new Map();
2936
- const noteScriptOutput = (raw, script) => {
2937
- const expanded = expand(raw, settings);
2938
- if (!expanded.endsWith(".swift")) return;
2939
- const absolute = import_node_path2.default.isAbsolute(expanded) ? import_node_path2.default.normalize(expanded) : import_node_path2.default.resolve(project.projectDir, expanded);
2940
- if (!scriptForOutput.has(absolute)) scriptForOutput.set(absolute, script);
2941
- };
2942
2938
  for (const phaseId of list(target.buildPhases)) {
2943
2939
  const phase = project.object(phaseId);
2944
2940
  if (phase?.isa !== "PBXShellScriptBuildPhase") continue;
2945
2941
  const script = str(phase.name) ?? phaseId;
2946
- for (const raw of list(phase.outputPaths)) noteScriptOutput(raw, script);
2947
- for (const listPath of list(phase.outputFileListPaths)) {
2948
- const expandedList = expand(listPath, settings);
2949
- const absoluteList = import_node_path2.default.isAbsolute(expandedList) ? expandedList : import_node_path2.default.resolve(project.projectDir, expandedList);
2950
- if (!import_node_fs.default.existsSync(absoluteList)) continue;
2951
- for (const line of import_node_fs.default.readFileSync(absoluteList, "utf8").split("\n")) {
2952
- const trimmed = line.trim();
2953
- if (trimmed === "" || trimmed.startsWith("#")) continue;
2954
- noteScriptOutput(trimmed, script);
2942
+ const absolute = (raw) => import_node_path2.default.resolve(project.projectDir, expand(raw, settings));
2943
+ const inputs = list(phase.inputPaths).map(absolute);
2944
+ const outputs = list(phase.outputPaths).map(absolute);
2945
+ const fileLists = /* @__PURE__ */ new Map();
2946
+ for (const kind of ["INPUT", "OUTPUT"]) {
2947
+ const lists = list(
2948
+ kind === "INPUT" ? phase.inputFileListPaths : phase.outputFileListPaths
2949
+ ).map((raw) => {
2950
+ const file = absolute(raw);
2951
+ if (!import_node_fs.default.existsSync(file)) {
2952
+ return { file, entries: [] };
2953
+ }
2954
+ const entries = import_node_fs.default.readFileSync(file, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "" && !line.startsWith("#")).map(absolute);
2955
+ return { file, entries };
2956
+ });
2957
+ fileLists.set(kind, lists);
2958
+ }
2959
+ const allOutputs = [
2960
+ ...outputs,
2961
+ ...fileLists.get("OUTPUT").flatMap((item) => item.entries)
2962
+ ];
2963
+ for (const output of allOutputs)
2964
+ if (output.endsWith(".swift") && !scriptForOutput.has(output))
2965
+ scriptForOutput.set(output, script);
2966
+ const inputFiles = [
2967
+ ...inputs,
2968
+ ...fileLists.get("INPUT").flatMap((item) => [item.file, ...item.entries]),
2969
+ ...fileLists.get("OUTPUT").map((item) => item.file)
2970
+ ];
2971
+ if (allOutputs.some((file) => file.endsWith(".swift"))) {
2972
+ for (const file of inputFiles) if (import_node_fs.default.existsSync(file)) projectInputs.add(file);
2973
+ }
2974
+ if (options.prepareGeneratedSources && options.requireSources !== false && allOutputs.some((file) => file.endsWith(".swift"))) {
2975
+ const phaseDir = import_node_path2.default.join(settings("TARGET_TEMP_DIR"), `Script-${phaseId}`);
2976
+ for (const lists of fileLists.values())
2977
+ for (const { file } of lists)
2978
+ if (!import_node_fs.default.existsSync(file))
2979
+ throw new Error(
2980
+ `${targetName}: Run Script "${script}" missing file list ${file}`
2981
+ );
2982
+ const env = {
2983
+ ...process.env,
2984
+ ...Object.fromEntries(
2985
+ [...settingKeys].filter((key2) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(key2)).map((key2) => [key2, settings(key2)])
2986
+ )
2987
+ };
2988
+ const declared = { INPUT: inputs, OUTPUT: outputs };
2989
+ for (const kind of ["INPUT", "OUTPUT"]) {
2990
+ env[`SCRIPT_${kind}_FILE_COUNT`] = String(declared[kind].length);
2991
+ declared[kind].forEach((file, index) => {
2992
+ env[`SCRIPT_${kind}_FILE_${index}`] = file;
2993
+ });
2994
+ const lists = fileLists.get(kind);
2995
+ env[`SCRIPT_${kind}_FILE_LIST_COUNT`] = String(lists.length);
2996
+ lists.forEach((_item, index) => {
2997
+ env[`SCRIPT_${kind}_FILE_LIST_${index}`] = import_node_path2.default.join(
2998
+ phaseDir,
2999
+ `${kind}-${index}.xcfilelist`
3000
+ );
3001
+ });
3002
+ }
3003
+ const signature = (0, import_node_crypto.createHash)("sha256").update(
3004
+ JSON.stringify([phase, [...settingKeys].map((key2) => [key2, settings(key2)])])
3005
+ );
3006
+ for (const file of inputFiles) {
3007
+ signature.update(file);
3008
+ if (import_node_fs.default.existsSync(file)) {
3009
+ const stat = import_node_fs.default.statSync(file);
3010
+ signature.update(`${stat.mtimeMs}:${stat.ctimeMs}:${stat.size}`);
3011
+ } else signature.update("missing");
3012
+ }
3013
+ const stamp = signature.digest("hex");
3014
+ const key = `${project.projectFile}:${targetId}:${phaseId}:${settings("CONFIGURATION")}`;
3015
+ if (preparedSourcePhases.get(key) === stamp && allOutputs.every((file) => import_node_fs.default.existsSync(file)))
3016
+ continue;
3017
+ import_node_fs.default.mkdirSync(phaseDir, { recursive: true });
3018
+ import_node_fs.default.mkdirSync(settings("BUILT_PRODUCTS_DIR"), { recursive: true });
3019
+ import_node_fs.default.mkdirSync(settings("DERIVED_FILE_DIR"), { recursive: true });
3020
+ for (const [kind, lists] of fileLists)
3021
+ lists.forEach((item, index) => {
3022
+ import_node_fs.default.writeFileSync(
3023
+ env[`SCRIPT_${kind}_FILE_LIST_${index}`],
3024
+ `${item.entries.join("\n")}
3025
+ `
3026
+ );
3027
+ });
3028
+ try {
3029
+ (0, import_node_child_process.execFileSync)(
3030
+ str(phase.shellPath) ?? "/bin/sh",
3031
+ ["-c", str(phase.shellScript) ?? ""],
3032
+ {
3033
+ cwd: project.projectDir,
3034
+ env,
3035
+ stdio: ["ignore", "pipe", "pipe"],
3036
+ timeout: 12e4
3037
+ }
3038
+ );
3039
+ } catch (error) {
3040
+ const output = error instanceof Error ? `${error.message}
3041
+ ${"stdout" in error ? String(error.stdout) : ""}${"stderr" in error ? String(error.stderr) : ""}` : String(error);
3042
+ throw new Error(
3043
+ `${targetName}: Run Script "${script}" failed preparing generated Swift sources:
3044
+ ${output}`
3045
+ );
2955
3046
  }
3047
+ const missing = allOutputs.filter(
3048
+ (file) => file.endsWith(".swift") && !import_node_fs.default.existsSync(file)
3049
+ );
3050
+ if (missing.length > 0)
3051
+ throw new Error(
3052
+ `${targetName}: Run Script "${script}" did not produce ${missing.join(", ")}`
3053
+ );
3054
+ preparedSourcePhases.set(key, stamp);
2956
3055
  }
2957
3056
  }
2958
3057
  visitXcodeTargetMembers(
@@ -3142,22 +3241,95 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
3142
3241
  SRCROOT: ref.project.projectDir,
3143
3242
  SOURCE_ROOT: ref.project.projectDir,
3144
3243
  PROJECT_DIR: ref.project.projectDir,
3244
+ SYMROOT: import_node_path2.default.join(ref.project.projectDir, ".build/peach-xcode/Build/Products"),
3245
+ BUILD_DIR: "$(SYMROOT)",
3246
+ OBJROOT: import_node_path2.default.join(
3247
+ ref.project.projectDir,
3248
+ ".build/peach-xcode/Build/Intermediates.noindex"
3249
+ ),
3250
+ CONFIGURATION_BUILD_DIR: "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
3251
+ BUILT_PRODUCTS_DIR: "$(CONFIGURATION_BUILD_DIR)",
3252
+ TARGET_BUILD_DIR: "$(CONFIGURATION_BUILD_DIR)",
3253
+ PROJECT_TEMP_DIR: "$(OBJROOT)/$(PROJECT_NAME).build",
3254
+ CONFIGURATION_TEMP_DIR: "$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
3255
+ TARGET_TEMP_DIR: "$(CONFIGURATION_TEMP_DIR)/$(TARGET_NAME).build",
3256
+ DERIVED_FILE_DIR: "$(TARGET_TEMP_DIR)/DerivedSources",
3257
+ DERIVED_FILES_DIR: "$(DERIVED_FILE_DIR)",
3258
+ PLATFORM_NAME: "iphonesimulator",
3259
+ EFFECTIVE_PLATFORM_NAME: "-iphonesimulator",
3260
+ CURRENT_ARCH: "arm64",
3261
+ ARCHS: "arm64",
3262
+ ACTION: "build",
3145
3263
  DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
3146
3264
  },
3147
3265
  options
3148
3266
  );
3149
3267
  for (const file of read) xcconfigs.add(file);
3150
3268
  const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
3269
+ const members = targetMembers(ref, settings2, options, keys, xcconfigs);
3270
+ const implementations = members.allSources.filter(
3271
+ (file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
3272
+ );
3273
+ const absolute = (file) => import_node_path2.default.resolve(ref.project.projectDir, file);
3274
+ const fileFlags = {};
3275
+ for (const phaseId of list(ref.target.buildPhases)) {
3276
+ const phase = ref.project.object(phaseId);
3277
+ if (phase?.isa !== "PBXSourcesBuildPhase") continue;
3278
+ for (const id of list(phase.files)) {
3279
+ const file = ref.project.object(id);
3280
+ const resolved = ref.project.resolvePath(str(file?.fileRef) ?? "");
3281
+ if (resolved && implementations.includes(resolved))
3282
+ fileFlags[resolved] = settingList(
3283
+ expand(
3284
+ str(isDict(file?.settings) ? file.settings.COMPILER_FLAGS : void 0) ?? "",
3285
+ settings2
3286
+ )
3287
+ );
3288
+ }
3289
+ }
3151
3290
  return {
3152
3291
  settings: settings2,
3153
3292
  keys,
3154
3293
  module: {
3155
3294
  name,
3156
3295
  moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
3157
- ...targetMembers(ref, settings2, options),
3296
+ ...members,
3158
3297
  languageMode: swiftVersion >= 6 ? 6 : 5,
3159
3298
  mainActorIsolation: settings2("SWIFT_DEFAULT_ACTOR_ISOLATION") === "MainActor",
3160
- defines: compilationConditions(settings2)
3299
+ defines: compilationConditions(settings2),
3300
+ iosDeploymentTarget: settings2("IPHONEOS_DEPLOYMENT_TARGET") || null,
3301
+ ...implementations.some((file) => /\.mm?$/.test(file)) ? {
3302
+ objc: {
3303
+ headers: Object.keys(ref.project.objects).flatMap((id) => {
3304
+ const file = ref.project.resolvePath(id);
3305
+ return file && /\.(h|hh|hpp|hxx|pch)$/.test(file) && import_node_fs.default.existsSync(file) ? [file] : [];
3306
+ }),
3307
+ prefixHeader: settings2("GCC_PREFIX_HEADER") ? absolute(settings2("GCC_PREFIX_HEADER")) : null,
3308
+ bridgingHeader: settings2("SWIFT_OBJC_BRIDGING_HEADER") ? absolute(settings2("SWIFT_OBJC_BRIDGING_HEADER")) : null,
3309
+ headerSearchPaths: [
3310
+ ...settingList(settings2("HEADER_SEARCH_PATHS")),
3311
+ ...settingList(settings2("USER_HEADER_SEARCH_PATHS"))
3312
+ ].map(absolute),
3313
+ frameworkSearchPaths: settingList(settings2("FRAMEWORK_SEARCH_PATHS")).map(
3314
+ absolute
3315
+ ),
3316
+ flags: [
3317
+ ...settings2("CLANG_ENABLE_OBJC_ARC") === "YES" ? ["-fobjc-arc"] : [],
3318
+ ...settings2("CLANG_ENABLE_OBJC_WEAK") === "YES" ? ["-fobjc-weak"] : [],
3319
+ ...settings2("CLANG_ENABLE_MODULES") === "YES" ? ["-fmodules"] : [],
3320
+ ...settings2("GCC_C_LANGUAGE_STANDARD") ? [`-std=${settings2("GCC_C_LANGUAGE_STANDARD")}`] : [],
3321
+ ...settingList(settings2("GCC_PREPROCESSOR_DEFINITIONS")).map(
3322
+ (value) => `-D${value}`
3323
+ ),
3324
+ ...settingList(settings2("OTHER_CFLAGS"))
3325
+ ],
3326
+ cxxFlags: [
3327
+ ...settings2("CLANG_CXX_LANGUAGE_STANDARD") ? [`-std=${settings2("CLANG_CXX_LANGUAGE_STANDARD")}`] : [],
3328
+ ...settingList(settings2("OTHER_CPLUSPLUSFLAGS"))
3329
+ ],
3330
+ fileFlags
3331
+ }
3332
+ } : {}
3161
3333
  }
3162
3334
  };
3163
3335
  };
@@ -3206,6 +3378,23 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
3206
3378
  ...projects.flatMap(
3207
3379
  (project) => Object.entries(project.objects).flatMap(([id, entry]) => {
3208
3380
  if (!isDict(entry)) return [];
3381
+ if (entry.isa === "PBXFileSystemSynchronizedRootGroup") {
3382
+ const folder = project.resolvePath(id);
3383
+ const pending = folder ? [folder] : [];
3384
+ const packages = [];
3385
+ while (pending.length > 0) {
3386
+ const dir = pending.pop();
3387
+ if (import_node_fs.default.existsSync(import_node_path2.default.join(dir, "Package.swift"))) {
3388
+ packages.push(dir);
3389
+ continue;
3390
+ }
3391
+ if (!isDirectory(dir)) continue;
3392
+ for (const child of import_node_fs.default.readdirSync(dir, { withFileTypes: true }))
3393
+ if (child.isDirectory() && !child.name.startsWith("."))
3394
+ pending.push(import_node_path2.default.join(dir, child.name));
3395
+ }
3396
+ return packages;
3397
+ }
3209
3398
  const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path2.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
3210
3399
  return candidate && import_node_fs.default.existsSync(import_node_path2.default.join(candidate, "Package.swift")) ? [candidate] : [];
3211
3400
  })
@@ -3260,6 +3449,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
3260
3449
  "swiftpm",
3261
3450
  "Package.resolved"
3262
3451
  );
3452
+ const packageResolved = import_node_fs.default.existsSync(resolvedFile) ? [import_node_fs.default.realpathSync(resolvedFile)] : [...new Set(localPackageDirs.map((dir) => import_node_path2.default.join(dir, "Package.resolved")))].filter((file) => import_node_fs.default.existsSync(file)).map((file) => import_node_fs.default.realpathSync(file)).sort();
3263
3453
  const used = order.map((ref) => ref.project);
3264
3454
  return {
3265
3455
  ...module2,
@@ -3285,7 +3475,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
3285
3475
  ...new Set(localPackageDirs.map((dir) => import_node_fs.default.realpathSync(dir)))
3286
3476
  ].sort(),
3287
3477
  binaryFrameworks: [...binaryFrameworks].map(([name, file]) => ({ name, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
3288
- packageResolved: import_node_fs.default.existsSync(resolvedFile) ? resolvedFile : null,
3478
+ packageResolved,
3289
3479
  appTargets: appTargetNames,
3290
3480
  configuration,
3291
3481
  settings
@@ -3293,15 +3483,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
3293
3483
  }
3294
3484
 
3295
3485
  // src/native-app-identity-project.ts
3296
- function isRecord3(value) {
3297
- return typeof value === "object" && value !== null && !Array.isArray(value);
3298
- }
3299
3486
  function nonEmptyString2(value) {
3300
3487
  return typeof value === "string" && value.length > 0 ? value : void 0;
3301
3488
  }
3302
3489
  function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSource) {
3303
3490
  const dictionary = parseInfoPlist(app.infoPlist);
3304
- if (!isRecord3(dictionary)) throw new Error("native app Info.plist is not a dictionary");
3491
+ if (!isRecord(dictionary)) throw new Error("native app Info.plist is not a dictionary");
3305
3492
  const settings = app.settings;
3306
3493
  const bundleIdentifier = nonEmptyString2(dictionary.CFBundleIdentifier) ?? nonEmptyString2(settings?.("PRODUCT_BUNDLE_IDENTIFIER"));
3307
3494
  if (!bundleIdentifier) throw new Error("native app has no bundle identifier");
@@ -3318,8 +3505,8 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
3318
3505
  const designRequiresCompatibility = dictionary.UIDesignRequiresCompatibility === true;
3319
3506
  const alternateIconNames = /* @__PURE__ */ new Set();
3320
3507
  const icons = dictionary.CFBundleIcons;
3321
- const alternates = isRecord3(icons) ? icons.CFBundleAlternateIcons : void 0;
3322
- if (isRecord3(alternates)) {
3508
+ const alternates = isRecord(icons) ? icons.CFBundleAlternateIcons : void 0;
3509
+ if (isRecord(alternates)) {
3323
3510
  for (const name of Object.keys(alternates)) {
3324
3511
  if (name) alternateIconNames.add(name);
3325
3512
  }
@@ -3551,7 +3738,7 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget) {
3551
3738
  const installedManifest = JSON.parse(
3552
3739
  import_node_fs2.default.readFileSync(reanimatedManifestPath, "utf8")
3553
3740
  );
3554
- const installedVersion = isRecord3(installedManifest) ? nonEmptyString2(installedManifest.version) : void 0;
3741
+ const installedVersion = isRecord(installedManifest) ? nonEmptyString2(installedManifest.version) : void 0;
3555
3742
  if (!installedVersion) throw new Error("Reanimated package version is malformed");
3556
3743
  if (Number.parseInt(installedVersion, 10) < 4) return identity;
3557
3744
  const defaults = JSON.parse(
@@ -3563,11 +3750,11 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget) {
3563
3750
  "utf8"
3564
3751
  )
3565
3752
  );
3566
- if (!isRecord3(defaults)) throw new Error("Reanimated static flags are malformed");
3753
+ if (!isRecord(defaults)) throw new Error("Reanimated static flags are malformed");
3567
3754
  const manifest = JSON.parse(import_node_fs2.default.readFileSync(projectManifestPath, "utf8"));
3568
- const reanimated = isRecord3(manifest) ? manifest.reanimated : void 0;
3569
- const overrides = isRecord3(reanimated) ? reanimated.staticFeatureFlags : void 0;
3570
- if (overrides !== void 0 && !isRecord3(overrides)) {
3755
+ const reanimated = isRecord(manifest) ? manifest.reanimated : void 0;
3756
+ const overrides = isRecord(reanimated) ? reanimated.staticFeatureFlags : void 0;
3757
+ if (overrides !== void 0 && !isRecord(overrides)) {
3571
3758
  throw new Error("Reanimated static flag overrides are malformed");
3572
3759
  }
3573
3760
  const flags = {};