peachsim 0.1.2302 → 0.1.2304

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 (97) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +1 -1
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +1 -1
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +1 -1
  13. package/dist-lib/bundle-channel.cjs +165 -38
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +1 -1
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +1 -1
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +1 -1
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +1 -1
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +1 -1
  24. package/dist-lib/detox/index.cjs +3 -3
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/expo-swift-bundle.cjs +163 -36
  27. package/dist-lib/expo-swift-metadata.cjs +1 -1
  28. package/dist-lib/expo-swift-metadata.mjs +1 -1
  29. package/dist-lib/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +165 -38
  31. package/dist-lib/host/fetch-proxy-handler.cjs +6 -6
  32. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  34. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  35. package/dist-lib/host/websocket-proxy.cjs +1 -1
  36. package/dist-lib/index.cjs +22 -12
  37. package/dist-lib/jump-to-source-babel.cjs +1 -1
  38. package/dist-lib/jump-to-source-native.cjs +1 -1
  39. package/dist-lib/kotlin-host.cjs +1 -1
  40. package/dist-lib/menu.cjs +1 -1
  41. package/dist-lib/menu.mjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  44. package/dist-lib/metro-production-bundle.cjs +1 -1
  45. package/dist-lib/metro-production-bundle.mjs +1 -1
  46. package/dist-lib/metro.cjs +22 -12
  47. package/dist-lib/native-app-identity-project.cjs +19 -9
  48. package/dist-lib/native-app-identity-project.mjs +19 -9
  49. package/dist-lib/native-app-identity.cjs +1 -1
  50. package/dist-lib/native-app-identity.mjs +1 -1
  51. package/dist-lib/native-firebase-metadata.cjs +1 -1
  52. package/dist-lib/native-firebase-metadata.mjs +1 -1
  53. package/dist-lib/pdfium-raster.cjs +1 -1
  54. package/dist-lib/pdfium-raster.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/public-origins-lib-esm.json +24 -24
  60. package/dist-lib/public-origins-lib.json +53 -53
  61. package/dist-lib/react-native-host-modules.cjs +1 -1
  62. package/dist-lib/react-native-host-modules.mjs +1 -1
  63. package/dist-lib/reap-browser.cjs +2 -2
  64. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  65. package/dist-lib/sdk.cjs +1 -1
  66. package/dist-lib/sdk.mjs +1 -1
  67. package/dist-lib/skills.cjs +167 -40
  68. package/dist-lib/swift-compile.cjs +3 -17
  69. package/dist-lib/swift-compile.mjs +3 -16
  70. package/dist-lib/swift-package.cjs +1 -1
  71. package/dist-lib/swift-package.mjs +1 -1
  72. package/dist-lib/swift-submit.cjs +1 -1
  73. package/dist-lib/swift-submit.mjs +1 -1
  74. package/dist-lib/swift-toolchain.cjs +1 -1
  75. package/dist-lib/swift.cjs +1 -1
  76. package/dist-lib/vite-swift.cjs +96 -29
  77. package/dist-lib/vite.cjs +6 -6
  78. package/dist-lib/worklet-executable.cjs +1 -1
  79. package/dist-lib/worklet-executable.mjs +1 -1
  80. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +5 -20
  81. package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +22 -5
  82. package/dist-types/packages/peach-engine/src/render-worker/gesture-arbitration-native.d.ts +15 -2
  83. package/dist-types/packages/peach-globals/src/webViewBridgeContract.d.ts +3 -0
  84. package/package.json +1 -1
  85. package/runtime-companion.json +1 -1
  86. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Modules/module.modulemap +52 -0
  87. package/sdk/ios/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewController.h +1 -1
  88. package/src/core-data-model.ts +92 -3
  89. package/src/expo-discovery-cache.ts +2 -3
  90. package/src/expo-native-workspace.ts +30 -2
  91. package/src/expo-swift-host.ts +11 -0
  92. package/src/native-static-libraries.ts +4 -4
  93. package/src/podspec-sources.ts +12 -0
  94. package/src/reap-browser.ts +3 -1
  95. package/src/swift-compile.ts +1 -25
  96. package/src/swift-packages.ts +22 -1
  97. package/src/xcode-project.ts +23 -7
@@ -24,12 +24,27 @@ type Common = {
24
24
  renaming: string
25
25
  userInfo: UserInfo
26
26
  }
27
+ // an NSDecimal: up to eight little-endian 16-bit mantissa words, length of them used
28
+ type Decimal = {
29
+ kind: 'decimal'
30
+ exponent: number
31
+ length: number
32
+ negative: boolean
33
+ compact: boolean
34
+ mantissa: Buffer
35
+ }
27
36
  type Attribute = Common & {
28
37
  kind: 'attribute'
29
38
  transient: boolean
30
39
  type: number
31
40
  className: string | null
32
- defaultValue: string | number | boolean | null
41
+ defaultValue:
42
+ | string
43
+ | number
44
+ | boolean
45
+ | Decimal
46
+ | { kind: 'date'; time: number }
47
+ | null
33
48
  transformer: string | null
34
49
  flags: number
35
50
  cloudEncryption: boolean
@@ -124,7 +139,56 @@ function userInfo(source: Source, owner: Tag): UserInfo {
124
139
  : entries
125
140
  }
126
141
 
142
+ // momc archives a decimal default as the NSDecimal its string scans to: a
143
+ // nonzero value compacts (1.50 is 15e-1, 100 is 1e2), a zero keeps its fraction
144
+ // digits uncompacted (0.00 is 0e-2) and a negative zero is plain zero.
145
+ function decimal(text: string): Decimal | null {
146
+ const match = /^([+-]?)(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/.exec(text)
147
+ if (!match) return null
148
+ const [, sign, whole = '', fraction = '', power] = match
149
+ if (whole + fraction === '') return null
150
+ let mantissa = BigInt(whole + fraction)
151
+ let exponent = Number(power ?? 0) - fraction.length
152
+ if (mantissa === 0n) {
153
+ if (power !== undefined) return null
154
+ const zero = {
155
+ kind: 'decimal' as const,
156
+ length: 0,
157
+ negative: false,
158
+ compact: false,
159
+ mantissa: Buffer.alloc(16),
160
+ }
161
+ return { ...zero, exponent: sign === '-' ? 0 : exponent }
162
+ }
163
+ while (mantissa % 10n === 0n) {
164
+ mantissa /= 10n
165
+ exponent++
166
+ }
167
+ if (mantissa >> 128n !== 0n || exponent < -128 || exponent > 127) return null
168
+ const words = Buffer.alloc(16)
169
+ let length = 0
170
+ for (let word = 0; word < 8; word++) {
171
+ const value = Number((mantissa >> BigInt(16 * word)) & 0xffffn)
172
+ words.writeUInt16LE(value, 2 * word)
173
+ if (value !== 0) length = word + 1
174
+ }
175
+ return {
176
+ kind: 'decimal',
177
+ exponent,
178
+ length,
179
+ negative: sign === '-',
180
+ compact: true,
181
+ mantissa: words,
182
+ }
183
+ }
184
+
127
185
  function defaultValue(model: string, member: Tag, type: string) {
186
+ const interval = member.attrs.defaultDateTimeInterval
187
+ // momc keeps a date default to the whole minute at or before it
188
+ if (type === 'Date' && interval !== undefined && Number.isFinite(Number(interval)))
189
+ return { kind: 'date' as const, time: Math.floor(Number(interval) / 60) * 60 }
190
+ if (interval !== undefined)
191
+ refuse(model, `${member.attrs.name} has the ${type} date interval ${interval}`)
128
192
  const text = member.attrs.defaultValueString
129
193
  if (text === undefined) return null
130
194
  if (type.startsWith('Integer ') && /^-?\d+$/.test(text)) return Number(text)
@@ -132,6 +196,8 @@ function defaultValue(model: string, member: Tag, type: string) {
132
196
  return Number(text)
133
197
  if (type === 'Boolean' && (text === 'YES' || text === 'NO')) return text === 'YES'
134
198
  if (type === 'String') return text
199
+ const scanned = type === 'Decimal' ? decimal(text) : null
200
+ if (scanned) return scanned
135
201
  refuse(model, `${member.attrs.name} has the ${type} default ${JSON.stringify(text)}`)
136
202
  }
137
203
 
@@ -150,6 +216,7 @@ function attribute(source: Source, member: Tag): Attribute {
150
216
  'transient',
151
217
  'attributeType',
152
218
  'defaultValueString',
219
+ 'defaultDateTimeInterval',
153
220
  'usesScalarValueType',
154
221
  'customClassName',
155
222
  'valueTransformerName',
@@ -357,6 +424,14 @@ const classChains: Record<string, string[]> = {
357
424
  NSArray: ['NSArray', 'NSObject'],
358
425
  NSMutableArray: ['NSMutableArray', 'NSArray', 'NSObject'],
359
426
  NSSet: ['NSSet', 'NSObject'],
427
+ NSDate: ['NSDate', 'NSObject'],
428
+ NSDecimalNumberPlaceholder: [
429
+ 'NSDecimalNumberPlaceholder',
430
+ 'NSDecimalNumber',
431
+ 'NSNumber',
432
+ 'NSValue',
433
+ 'NSObject',
434
+ ],
360
435
  }
361
436
 
362
437
  // the NSKeyedArchiver object table: objects reserve their slot first so the
@@ -409,6 +484,21 @@ class KeyedArchive {
409
484
  }
410
485
  }
411
486
 
487
+ function archiveDefault(archive: KeyedArchive, value: Attribute['defaultValue']) {
488
+ if (value === null) return NULL
489
+ if (typeof value !== 'object') return archive.add(value)
490
+ if (value.kind === 'date')
491
+ return archive.fill(archive.reserve(), 'NSDate', { 'NS.time': value.time })
492
+ return archive.fill(archive.reserve(), 'NSDecimalNumberPlaceholder', {
493
+ 'NS.compact': value.compact,
494
+ 'NS.exponent': value.exponent,
495
+ 'NS.length': value.length,
496
+ 'NS.mantissa': value.mantissa,
497
+ 'NS.mantissa.bo': 1,
498
+ 'NS.negative': value.negative,
499
+ })
500
+ }
501
+
412
502
  function archiveModel(model: Model) {
413
503
  const archive = new KeyedArchive()
414
504
  const modelIndex = archive.reserve()
@@ -443,8 +533,7 @@ function archiveModel(model: Model) {
443
533
  ...shared,
444
534
  NSAttributeType: property.type,
445
535
  NSAttributeValueClassName: archive.string(property.className),
446
- NSDefaultValue:
447
- property.defaultValue === null ? NULL : archive.add(property.defaultValue),
536
+ NSDefaultValue: archiveDefault(archive, property.defaultValue),
448
537
  NSFlagsKey: property.flags,
449
538
  NSValueTransformerName: archive.string(property.transformer),
450
539
  ...(property.transient ? { NSIsTransient: true } : {}),
@@ -227,8 +227,7 @@ export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | u
227
227
  if (!digestRecord(parsed.frameworks)) return undefined
228
228
  try {
229
229
  for (const [file, expected] of Object.entries(parsed.dependencies)) {
230
- if (createHash('sha256').update(fs.readFileSync(file)).digest('hex') !== expected)
231
- return undefined
230
+ if (stampedFileHash(file) !== expected) return undefined
232
231
  }
233
232
  for (const [directory, expected] of Object.entries(parsed.frameworks)) {
234
233
  if (frameworkDigest(directory) !== expected) return undefined
@@ -292,7 +291,7 @@ export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | u
292
291
 
293
292
  const sourceLocationLine = /^#sourceLocation\(file: "(.*)", line: 1\)$/
294
293
 
295
- // a warm read re-verifies every framework file; a file whose stat is unchanged
294
+ // a warm read re-verifies every dependency and framework file; a file whose stat is unchanged
296
295
  // reuses its saved hash, as the swift sdk check does.
297
296
  const fileHashes = new Map<string, { stamp: string; checksum: string }>()
298
297
  let fileHashesLoaded = false
@@ -33,6 +33,30 @@ const isolatedGitEnv = {
33
33
  GIT_CONFIG_SYSTEM: '/dev/null',
34
34
  }
35
35
 
36
+ function cleanWorkspaceGitEnv(): NodeJS.ProcessEnv {
37
+ const env: NodeJS.ProcessEnv = { ...process.env }
38
+ for (const key of [
39
+ 'GIT_DIR',
40
+ 'GIT_COMMON_DIR',
41
+ 'GIT_WORK_TREE',
42
+ 'GIT_INDEX_FILE',
43
+ 'GIT_OBJECT_DIRECTORY',
44
+ 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
45
+ 'GIT_PREFIX',
46
+ 'GIT_SHALLOW_FILE',
47
+ 'GIT_GRAFT_FILE',
48
+ 'GIT_NAMESPACE',
49
+ 'GIT_IMPLICIT_WORK_TREE',
50
+ 'GIT_CONFIG',
51
+ 'GIT_CEILING_DIRECTORIES',
52
+ 'GIT_DISCOVERY_ACROSS_FILESYSTEM',
53
+ 'GIT_SUPER_PREFIX',
54
+ ]) {
55
+ delete env[key]
56
+ }
57
+ return { ...env, ...isolatedGitEnv }
58
+ }
59
+
36
60
  // CocoaPods refuses a non UTF-8 locale, so even its version probe names one.
37
61
  const utf8Env = { ...process.env, LANG: 'en_US.UTF-8', LC_ALL: 'en_US.UTF-8' }
38
62
 
@@ -775,6 +799,10 @@ function nativeWorkspacesDir(root: string): string {
775
799
  return path.join(mount, '.peach-cache', 'expo-native-workspaces')
776
800
  }
777
801
 
802
+ export function preparedExpoWorkspacesDir(app: string): string {
803
+ return nativeWorkspacesDir(findWorkspaceRoot(app))
804
+ }
805
+
778
806
  // release producers prepare the already installed app. this preserves the
779
807
  // exact dependency tree selected by a replay, including a staged package.
780
808
  export async function prepareInstalledExpoWorkspace(app: string, work: string) {
@@ -824,7 +852,7 @@ export async function prepareInstalledExpoWorkspace(app: string, work: string) {
824
852
  function trackedSourceEntries(root: string, work: string): string[] {
825
853
  const listed = spawnSync('git', ['ls-files', '--stage', '-z'], {
826
854
  cwd: root,
827
- env: { ...process.env, ...isolatedGitEnv },
855
+ env: cleanWorkspaceGitEnv(),
828
856
  maxBuffer: 256 * 1024 * 1024,
829
857
  })
830
858
  if (listed.status !== 0) return []
@@ -839,7 +867,7 @@ function trackedSourceEntries(root: string, work: string): string[] {
839
867
 
840
868
  function initializeWorkspaceGit(root: string, work: string) {
841
869
  requireNativeGit()
842
- const env = { ...process.env, ...isolatedGitEnv }
870
+ const env = cleanWorkspaceGitEnv()
843
871
  execFileSync('git', ['init', '--quiet'], { cwd: work, env })
844
872
  execFileSync(
845
873
  'git',
@@ -26,6 +26,7 @@ import {
26
26
  hashExpoWorkspace,
27
27
  nativeWorkspaceAvailable,
28
28
  prepareExpoNativeWorkspace,
29
+ preparedExpoWorkspacesDir,
29
30
  } from './expo-native-workspace'
30
31
  import { PEACH_FORKED_SCRIPT_ENV } from './forked-script-contract'
31
32
  import { cacheDir } from './home-paths'
@@ -458,6 +459,16 @@ async function discoveryKey(
458
459
  readExpoConfigAsync(root),
459
460
  preparesWorkspace ? traceStore.exit(() => hashExpoWorkspace(root)) : null,
460
461
  ])
462
+ // the prepared copy is a pure function of that hash: reading it witnesses nothing.
463
+ if (preparesWorkspace)
464
+ traceStore.exit(() => {
465
+ const prepared = preparedExpoWorkspacesDir(root)
466
+ for (const dir of [
467
+ prepared,
468
+ fs.existsSync(prepared) ? fs.realpathSync(prepared) : prepared,
469
+ ])
470
+ if (!ignoredRoots.includes(dir)) ignoredRoots.push(dir)
471
+ })
461
472
  return `${fs.realpathSync(root)}\0${installedWorkspace ?? ''}\0${iosTarget ?? ''}\0${moduleRoot ?? ''}\0${prepareNative ? '1' : '0'}\0${JSON.stringify(config)}\0${JSON.stringify(expoConfig)}\0${workspace?.hash ?? ''}`
462
473
  }
463
474
 
@@ -34,12 +34,12 @@ export function nonmodularFrameworkLibraries(
34
34
  }
35
35
 
36
36
  export const NATIVE_STATIC_LIBRARY_RECIPES = [
37
- // react-native-libsodium's minimal apple build of the 1.0.20 release
37
+ // react-native-libsodium 1.5.1 through 1.7.0 vendor this minimal apple build of 1.0.21
38
38
  {
39
39
  name: 'libsodium',
40
- nativeSha256: '4e5112bdb787a4305ddb8e464a129d4f002c2f0be5a62eb541b5122b769fc17a',
41
- upstream: 'ebb65ef6ca439333c2bb41a0c1990587288da07f6c7fd07cb3a18cc18d30ce19',
42
- recipe: '0e5d450f381952394e6c2c4ec1126536150b18fd24576fc5303f0cb9e9bfc6bc',
40
+ nativeSha256: 'a7e8af90a9d712ce8a2474f310e21682b690cb57c7ef74ce4b02dbfeeca62aa8',
41
+ upstream: '9e4285c7a419e82dedb0be63a72eea357d6943bc3e28e6735bf600dd4883feaf',
42
+ recipe: '8c913c4ffeeb6443ae8300d3dc1ebd3d784ffa62c64f431986f80523cd90ef58',
43
43
  archive: 'libsodium.a',
44
44
  },
45
45
  {
@@ -1741,6 +1741,18 @@ class Evaluator {
1741
1741
  }
1742
1742
  if (toks[3]?.t === 'op' && toks[3].v === '=') {
1743
1743
  const rhs = toks.slice(4)
1744
+ // ruby setters chain: `s.a = s.b = value` assigns value to both
1745
+ if (
1746
+ rhs[0]?.v === toks[0]?.v &&
1747
+ rhs[1]?.v === toks[1]?.v &&
1748
+ rhs[2]?.t === 'id' &&
1749
+ rhs[3]?.t === 'op' &&
1750
+ rhs[3].v === '='
1751
+ ) {
1752
+ this.runSpecStatement(scope, spec, rhs, line)
1753
+ this.runSpecStatement(scope, spec, [...toks.slice(0, 4), ...rhs.slice(4)], line)
1754
+ return
1755
+ }
1744
1756
  if (name === 'pod_target_xcconfig') {
1745
1757
  const versions = rhs.flatMap((tok, index) =>
1746
1758
  tok.t === 'str' &&
@@ -153,7 +153,8 @@ function processIdentity(pid: number): string | null {
153
153
  }
154
154
 
155
155
  // only GPU-less Linux hosts that identify themselves may use Playwright's
156
- // software-only chromium_headless_shell: the remote Linux builder, GitHub Actions Linux runners, the
156
+ // software-only chromium_headless_shell: the remote Linux builder, a provisioned
157
+ // beast host's shells (CONTRAST_GPU_LESS_HOST), GitHub Actions Linux runners, the
157
158
  // cf-factory container, whose image sets CONTRAST_CF_FACTORY_CONTAINER, and a
158
159
  // run whose compositor draws in the native linux host
159
160
  // (PEACH_NATIVE_COMPOSITOR=1, packages/peach-desktop/node), where chrome draws
@@ -166,6 +167,7 @@ export function softwareChromeAllowed(
166
167
  if (runtime.platform !== 'linux') return false
167
168
  return (
168
169
  runtime.env.CONTRAST_REMOTE_BUILD === 'linux' ||
170
+ runtime.env.CONTRAST_GPU_LESS_HOST === '1' ||
169
171
  (runtime.env.GITHUB_ACTIONS === 'true' && runtime.env.RUNNER_OS === 'Linux') ||
170
172
  runtime.env.CONTRAST_CF_FACTORY_CONTAINER === '1' ||
171
173
  runtime.env.PEACH_NATIVE_COMPOSITOR === '1'
@@ -2685,30 +2685,6 @@ export function lowerAVAssetURLCluster(source: string): string {
2685
2685
  return out
2686
2686
  }
2687
2687
 
2688
- // NSValue(time:) boxes a CMTime struct, which the sdk's NSValue cluster
2689
- // cannot encode (its concrete value traps on struct objCType strings), and
2690
- // a convenience initializer cannot substitute the box subclass, so compiled
2691
- // sources construct the landed NSStructBox through NSValue.boxedTime
2692
- // instead; only the token changes, spacing and the argument list stay as
2693
- // written. NSValue.boxedTime keeps the time: label for exactly this reason.
2694
- // every other NSValue construction keeps its spelling: timeRange:,
2695
- // timeMapping: and the struct-taking siblings stay on their trapping stubs,
2696
- // the explicit .init(time:) spelling stays on the shim, and the sdk's own
2697
- // NSValue(bytes:objCType:) still traps on struct encodings (the probe's
2698
- // sdk-trap negative pins that wall as the one the box avoids).
2699
- export function lowerNSValueTimeBox(source: string): string {
2700
- const masked = swiftCodeMask(source)
2701
- const pattern = /\bNSValue\s*\(\s*time\s*:/g
2702
- const edits: [number, number, string][] = []
2703
- let hit: RegExpExecArray | null
2704
- while ((hit = pattern.exec(masked)) !== null)
2705
- edits.push([hit.index, 'NSValue'.length, 'NSValue.boxedTime'])
2706
- let out = source
2707
- for (const [at, remove, insert] of edits.sort((a, b) => b[0] - a[0]))
2708
- out = out.slice(0, at) + insert + out.slice(at + remove)
2709
- return out
2710
- }
2711
-
2712
2688
  export function swiftCodeMask(source: string): string {
2713
2689
  const chars = source.split('')
2714
2690
  const blank = (from: number, to: number): void => {
@@ -3525,7 +3501,7 @@ export function swiftSourceAsIOS(
3525
3501
  continue
3526
3502
  }
3527
3503
  }
3528
- return lowerNSValueTimeBox(lowerAVAssetURLCluster(out + conditioned.slice(copied)))
3504
+ return lowerAVAssetURLCluster(out + conditioned.slice(copied))
3529
3505
  }
3530
3506
 
3531
3507
  // a native module's file closure includes referenced top-level declarations
@@ -343,11 +343,32 @@ async function fetchCheckout(
343
343
  if (preparedSwiftPin(checkouts, identity, pin.location, pin.revision)) return
344
344
  requireNativeGit()
345
345
  const key = checkoutKey(dir, pin)
346
+ const gitEnv: NodeJS.ProcessEnv = { ...process.env }
347
+ for (const name of [
348
+ 'GIT_DIR',
349
+ 'GIT_COMMON_DIR',
350
+ 'GIT_WORK_TREE',
351
+ 'GIT_INDEX_FILE',
352
+ 'GIT_OBJECT_DIRECTORY',
353
+ 'GIT_ALTERNATE_OBJECT_DIRECTORIES',
354
+ 'GIT_PREFIX',
355
+ 'GIT_SHALLOW_FILE',
356
+ 'GIT_GRAFT_FILE',
357
+ 'GIT_NAMESPACE',
358
+ 'GIT_IMPLICIT_WORK_TREE',
359
+ 'GIT_CONFIG',
360
+ 'GIT_CEILING_DIRECTORIES',
361
+ 'GIT_DISCOVERY_ACROSS_FILESYSTEM',
362
+ 'GIT_SUPER_PREFIX',
363
+ ]) {
364
+ delete gitEnv[name]
365
+ }
366
+ gitEnv.GIT_TERMINAL_PROMPT = '0'
346
367
  const git: Git = async (cwd, ...args) =>
347
368
  (
348
369
  await execFileAsync('git', ['-C', cwd, ...args], {
349
370
  encoding: 'utf8',
350
- env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
371
+ env: gitEnv,
351
372
  signal,
352
373
  })
353
374
  ).stdout.trim()
@@ -1311,8 +1311,6 @@ function targetMembers(
1311
1311
  if (interfaceOutputs.has(output))
1312
1312
  throw new Error(`${targetName}: duplicate Interface Builder output ${output}`)
1313
1313
  interfaceOutputs.add(output)
1314
- fs.rmSync(output, { recursive: true, force: true })
1315
- fs.mkdirSync(path.dirname(output), { recursive: true })
1316
1314
  const args = [
1317
1315
  'ibtool',
1318
1316
  '--compile',
@@ -1328,12 +1326,30 @@ function targetMembers(
1328
1326
  .map((value) => value.trim())
1329
1327
  if (families.includes('1')) args.push('--target-device', 'iphone')
1330
1328
  if (families.includes('2')) args.push('--target-device', 'ipad')
1331
- // runner-toolchain-platform: darwin
1332
- execFileSync('xcrun', args, {
1333
- cwd: project.projectDir,
1334
- stdio: ['ignore', 'pipe', 'pipe'],
1335
- timeout: runScriptTimeoutMs,
1329
+ // ibtool takes seconds per file and every read of the project needs the
1330
+ // output, so a compile whose inputs are unchanged is kept.
1331
+ const stamp = `${output}.peach-inputs`
1332
+ const inputs = JSON.stringify({
1333
+ args,
1334
+ developer: settings('DEVELOPER_DIR'),
1335
+ source: createHash('sha256').update(fs.readFileSync(file)).digest('hex'),
1336
1336
  })
1337
+ if (
1338
+ !fs.existsSync(output) ||
1339
+ !fs.existsSync(stamp) ||
1340
+ fs.readFileSync(stamp, 'utf8') !== inputs
1341
+ ) {
1342
+ fs.rmSync(output, { recursive: true, force: true })
1343
+ fs.rmSync(stamp, { force: true })
1344
+ fs.mkdirSync(path.dirname(output), { recursive: true })
1345
+ // runner-toolchain-platform: darwin
1346
+ execFileSync('xcrun', args, {
1347
+ cwd: project.projectDir,
1348
+ stdio: ['ignore', 'pipe', 'pipe'],
1349
+ timeout: runScriptTimeoutMs,
1350
+ })
1351
+ fs.writeFileSync(stamp, inputs)
1352
+ }
1337
1353
  projectInputs.add(file)
1338
1354
  resources.delete(file)
1339
1355
  for (const compiled of isDirectory(output) ? walkFiles(output) : [output])