peachsim 0.1.2278 → 0.1.2298

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 (157) hide show
  1. package/cli/commands/platform.ts +28 -8
  2. package/cli/commands/shell-url.ts +13 -4
  3. package/cli/outbound-endpoints.ts +2 -0
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +3691 -3537
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +2 -2
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +1995 -1900
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +2875 -2721
  34. package/dist-lib/host/fetch-proxy-handler.cjs +19 -7
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +55 -21
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +14 -2
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +55 -21
  50. package/dist-lib/native-app-identity-project.cjs +13 -5
  51. package/dist-lib/native-app-identity-project.mjs +13 -5
  52. package/dist-lib/native-app-identity.cjs +11 -3
  53. package/dist-lib/native-app-identity.mjs +11 -3
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +26 -25
  63. package/dist-lib/public-origins-lib.json +68 -58
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +1 -1
  69. package/dist-lib/sdk.mjs +1 -1
  70. package/dist-lib/skills.cjs +3579 -3392
  71. package/dist-lib/swift-compile.cjs +2 -2
  72. package/dist-lib/swift-compile.mjs +2 -2
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +467 -447
  80. package/dist-lib/vite.cjs +19 -7
  81. package/dist-lib/worklet-executable.cjs +421 -118
  82. package/dist-lib/worklet-executable.mjs +427 -113
  83. package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +3 -1
  84. package/dist-types/packages/peach-engine/src/engine/node.d.ts +4 -3
  85. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +13 -9
  86. package/dist-types/packages/peach-engine/src/engine/scroll-momentum-math.d.ts +14 -15
  87. package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +17 -22
  88. package/dist-types/packages/peach-engine/src/engine/scroll-velocity.d.ts +0 -1
  89. package/dist-types/packages/peach-engine/src/kernel/kernel.d.ts +69 -0
  90. package/dist-types/packages/peach-engine/src/kernel/worklet-kernel.d.ts +28 -0
  91. package/dist-types/packages/peach-engine/src/platform/personality.d.ts +1 -1
  92. package/dist-types/packages/peach-engine/src/render-worker/app-load.d.ts +4 -0
  93. package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +3 -3
  94. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +3 -3
  95. package/dist-types/packages/peach-engine/src/render-worker/worklet-serialize.d.ts +5 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/worklet-wire.d.ts +2 -0
  97. package/dist-types/packages/peach-engine/src/settings/device-spec-bus.d.ts +5 -0
  98. package/kotlin/README.md +1 -1
  99. package/kotlin/sdk.tar.gz +0 -0
  100. package/kotlin/toolchain.json +5 -1
  101. package/package.json +1 -1
  102. package/runtime-companion.json +1 -1
  103. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXAction.h +34 -0
  104. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXAnswerCallAction.h +20 -0
  105. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXBase.h +20 -0
  106. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCall.h +28 -0
  107. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallAction.h +23 -0
  108. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallController.h +53 -0
  109. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectory.h +16 -0
  110. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectoryExtensionContext.h +86 -0
  111. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectoryManager.h +29 -0
  112. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallDirectoryProvider.h +21 -0
  113. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallObserver.h +34 -0
  114. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXCallUpdate.h +43 -0
  115. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXEndCallAction.h +20 -0
  116. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXError.h +66 -0
  117. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXHandle.h +31 -0
  118. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXPlayDTMFCallAction.h +33 -0
  119. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXProvider.h +127 -0
  120. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXProviderConfiguration.h +42 -0
  121. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetGroupCallAction.h +27 -0
  122. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetHeldCallAction.h +23 -0
  123. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetMutedCallAction.h +23 -0
  124. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXSetTranslatingCallAction.h +40 -0
  125. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXStartCallAction.h +33 -0
  126. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CXTransaction.h +34 -0
  127. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CallKit.apinotes +36 -0
  128. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Headers/CallKit.h +35 -0
  129. package/sdk/ios/System/Library/Frameworks/CallKit.framework/Modules/module.modulemap +6 -0
  130. package/sdk/ios/System/Library/Frameworks/React.framework/Headers/React.h +14 -0
  131. package/src/expo-autolinking.ts +1 -1
  132. package/src/expo-native-prebuilt.ts +24 -0
  133. package/src/expo-native-workspace.ts +51 -5
  134. package/src/expo-swift-host.ts +5 -5
  135. package/src/kotlin-toolchain.ts +16 -1
  136. package/src/kotlinSdkContract.ts +2 -1
  137. package/src/nitro-adapter.lock.json +284 -284
  138. package/src/nitro-compile.ts +69 -4
  139. package/src/nitro-superset.lock.json +4 -4
  140. package/src/one-sdk/source.ts +2 -1
  141. package/src/prepared-native-inventory.ts +8 -2
  142. package/src/react-native-autolinking.ts +28 -9
  143. package/src/swift-compiler-digest.ts +8 -1
  144. package/src/swift-coverage/xcode-packages.ts +2 -1
  145. package/src/swift-distribution.lock.json +11 -11
  146. package/src/swift-helper.ts +38 -0
  147. package/src/swift-host.ts +3 -1
  148. package/src/swift-pdf-raster.ts +7 -33
  149. package/src/turbo-bundle.ts +14 -6
  150. package/src/turbo-codegen-intake.ts +3 -2
  151. package/src/turbo-compile.ts +12 -1
  152. package/src/turbo-runtime.lock.json +22 -22
  153. package/src/turbo-source.ts +2 -4
  154. package/src/worklet-executable.ts +4 -1
  155. package/src/worklet-kernel.ts +370 -0
  156. package/src/worklets-babel.ts +10 -0
  157. package/src/xcode-target-members.ts +17 -7
@@ -29,12 +29,10 @@ async function cliAdvertises(
29
29
  args: string[],
30
30
  token: string,
31
31
  appRoot: string,
32
- signal?: AbortSignal,
33
32
  ): Promise<boolean> {
34
33
  const started = Date.now()
35
- const { stdout, stderr } = await run('node', [cli, ...args], {
34
+ const { stdout, stderr } = await run(process.execPath, [cli, ...args], {
36
35
  cwd: appRoot,
37
- signal,
38
36
  timeout: CLI_TIMEOUT_MS,
39
37
  maxBuffer: 1 * 1024 * 1024,
40
38
  env: { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: '1' },
@@ -59,12 +57,35 @@ function declaresDependency(appRoot: string, name: string): boolean {
59
57
  )
60
58
  }
61
59
 
60
+ // concurrent native preparations of one app share a single autolinker run.
61
+ const inFlight = new Map<string, Promise<unknown>>()
62
+
62
63
  export async function reactNativeAutolinkingConfig(
63
64
  appRoot: string,
64
65
  platform: 'ios' | 'android',
65
66
  signal?: AbortSignal,
66
67
  ): Promise<unknown> {
67
- appRoot = fs.realpathSync(appRoot)
68
+ signal?.throwIfAborted()
69
+ const root = fs.realpathSync(appRoot)
70
+ const key = `${platform}:${root}`
71
+ let shared = inFlight.get(key)
72
+ if (!shared) {
73
+ shared = readAutolinkingConfig(root, platform).finally(() => inFlight.delete(key))
74
+ inFlight.set(key, shared)
75
+ }
76
+ if (!signal) return shared
77
+ return Promise.race([
78
+ shared,
79
+ new Promise<never>((_, reject) =>
80
+ signal.addEventListener('abort', () => reject(signal.reason), { once: true }),
81
+ ),
82
+ ])
83
+ }
84
+
85
+ async function readAutolinkingConfig(
86
+ appRoot: string,
87
+ platform: 'ios' | 'android',
88
+ ): Promise<unknown> {
68
89
  const appRequire = createRequire(path.join(appRoot, 'package.json'))
69
90
  const expoManifest = appRequire.resolve
70
91
  .paths('expo')
@@ -96,7 +117,7 @@ export async function reactNativeAutolinkingConfig(
96
117
  : undefined
97
118
  if (expoAutolinker) {
98
119
  const cli = path.join(path.dirname(expoAutolinker), 'bin/expo-modules-autolinking.js')
99
- if (await cliAdvertises(cli, ['--help'], 'react-native-config', appRoot, signal)) {
120
+ if (await cliAdvertises(cli, ['--help'], 'react-native-config', appRoot)) {
100
121
  const args = [
101
122
  cli,
102
123
  'react-native-config',
@@ -108,13 +129,12 @@ export async function reactNativeAutolinkingConfig(
108
129
  ]
109
130
  return autolinkerJson(
110
131
  'expo-modules-autolinking react-native-config',
111
- await run('node', args, {
132
+ await run(process.execPath, args, {
112
133
  timeout: CLI_TIMEOUT_MS,
113
134
  maxBuffer: 8 * 1024 * 1024,
114
135
  env: { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: '1' },
115
136
  // expo configuration resolves its project from cwd.
116
137
  cwd: appRoot,
117
- signal,
118
138
  }),
119
139
  )
120
140
  }
@@ -158,9 +178,8 @@ export async function reactNativeAutolinkingConfig(
158
178
  : ['config']
159
179
  return autolinkerJson(
160
180
  `react-native ${configArgs.join(' ')}`,
161
- await run('node', [cliPath, ...configArgs], {
181
+ await run(process.execPath, [cliPath, ...configArgs], {
162
182
  cwd: appRoot,
163
- signal,
164
183
  timeout: CLI_TIMEOUT_MS,
165
184
  maxBuffer: 16 * 1024 * 1024,
166
185
  env: { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: '1', NO_COLOR: '1' },
@@ -45,11 +45,18 @@ export const SWIFT_DIGEST_SOURCES = [
45
45
  'swift-objc-sdk.ts',
46
46
  ]
47
47
 
48
+ // three compiler digests fold this one in, and each read the whole sdk tree again.
49
+ const digests = new Map<string, string>()
50
+
48
51
  export function swiftCompilerSourceDigest(srcDir: string): string {
52
+ const known = digests.get(srcDir)
53
+ if (known !== undefined) return known
49
54
  const hash = createHash('sha256')
50
55
  for (const file of SWIFT_DIGEST_SOURCES) {
51
56
  hash.update(readFileSync(path.join(srcDir, file)))
52
57
  }
53
58
  hash.update(JSON.stringify(readIosSdkTree(path.join(srcDir, '..', 'sdk', 'ios'))))
54
- return hash.digest('hex')
59
+ const digest = hash.digest('hex')
60
+ digests.set(srcDir, digest)
61
+ return digest
55
62
  }
@@ -221,7 +221,8 @@ export function createSwiftModuleWalker(
221
221
  resources: implicitResources.length > 0,
222
222
  catalogs,
223
223
  iosDeployment: manifest.iosDeployment,
224
- defines: swiftPackageConditions(target, configuration),
224
+ // xcode adds -DXcode to the conditions swiftpm defines
225
+ defines: ['Xcode', ...swiftPackageConditions(target, configuration)],
225
226
  dependsOn: [...new Set(dependsOn)],
226
227
  })
227
228
  done.set(key, moduleName)
@@ -1,10 +1,10 @@
1
1
  {
2
- "id": "f4c3215552215bd8",
2
+ "id": "e8eb8181d001de00",
3
3
  "release": "swift-6.4.0-RELEASE-custom-fb42d2535739dfd2",
4
- "wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-ad35b0d9",
5
- "wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-ad35b0d9.artifactbundle.tar.gz",
6
- "wasmSdkChecksum": "477c394dd425b54e77260bbc2bab9621642e800e982ada3b99d60158cc3b8eaa",
7
- "source": "73753f939841397841e05c3dadd52eca72552791",
4
+ "wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-3881e5a7",
5
+ "wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-3881e5a7.artifactbundle.tar.gz",
6
+ "wasmSdkChecksum": "b8981ed65e4292d922ece858d386ba4280fc90570302a57a4a789ca257daed29",
7
+ "source": "2c5df43f2bd1d349c712e86d8ea33b331f399b45",
8
8
  "targets": [
9
9
  "ImagePlayground",
10
10
  "QuickLookThumbnailing",
@@ -246,16 +246,16 @@
246
246
  },
247
247
  "hosts": {
248
248
  "darwin-arm64": {
249
- "sha256": "0d2370fd148d12b60a6699333e84a4670ff4908fb7d036a1bd94432fb83402da",
250
- "size": 107119143
249
+ "sha256": "0fbc9bb9354d34f48f12417cda034ee1a5e57e93a751b98de585f3fa8a955b11",
250
+ "size": 107830848
251
251
  },
252
252
  "linux-x64": {
253
- "sha256": "46cd2d107df13daa4ecc11919e4f396eedc1c95c226efb6613db3faa2a4e3d79",
254
- "size": 109835622
253
+ "sha256": "5d3e78c422d7f4fef1a94b835885d1c11371e37a3cbe78aa154313b6c96e6a82",
254
+ "size": 110550051
255
255
  },
256
256
  "linux-arm64": {
257
- "sha256": "9901411187f084be016e49b84994be24a8482002d3c2367443c9a770acf852bb",
258
- "size": 109326005
257
+ "sha256": "19154c89277ebdaa6478c47d5626d2b1333d4921d0782fd3d3ce589644cc93eb",
258
+ "size": 110043572
259
259
  }
260
260
  }
261
261
  }
@@ -0,0 +1,38 @@
1
+ import { execFileSync } from 'node:child_process'
2
+ import { createHash } from 'node:crypto'
3
+ import fs from 'node:fs'
4
+ import os from 'node:os'
5
+ import path from 'node:path'
6
+ import { cacheDir } from './home-paths'
7
+
8
+ // a small macOS helper compiled once per machine and source hash
9
+ export function compiledSwiftHelper(swift: string, name: string): string {
10
+ const tag = createHash('sha256').update(swift).digest('hex').slice(0, 16)
11
+ const binary = path.join(cacheDir(), `${name}-${tag}`)
12
+ try {
13
+ fs.accessSync(binary, fs.constants.X_OK)
14
+ return binary
15
+ } catch {
16
+ // fall through to compile
17
+ }
18
+ try {
19
+ fs.mkdirSync(cacheDir(), { recursive: true })
20
+ const source = path.join(
21
+ fs.mkdtempSync(path.join(os.tmpdir(), `${name}-`)),
22
+ 'main.swift',
23
+ )
24
+ fs.writeFileSync(source, swift)
25
+ try {
26
+ // runner-toolchain-platform: darwin
27
+ execFileSync('xcrun', ['swiftc', '-o', binary, source], { stdio: 'pipe' })
28
+ } finally {
29
+ fs.rmSync(path.dirname(source), { recursive: true, force: true })
30
+ }
31
+ fs.accessSync(binary, fs.constants.X_OK)
32
+ return binary
33
+ } catch (error) {
34
+ throw new Error(
35
+ `${name} did not compile (xcrun swiftc): ${error instanceof Error ? error.message : String(error)}`,
36
+ )
37
+ }
38
+ }
package/src/swift-host.ts CHANGED
@@ -1117,7 +1117,8 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
1117
1117
  : {}),
1118
1118
  })
1119
1119
  // xcode builds packages in swiftpm's debug configuration for Debug, which
1120
- // defines DEBUG, and in release for any other, as its package compiles show
1120
+ // defines DEBUG, and in release for any other, as its package compiles show;
1121
+ // every package swift unit xcode compiles also gets -DXcode
1121
1122
  const packageConfiguration = app.configuration === 'Debug' ? 'debug' : 'release'
1122
1123
  for (const target of packages.targets) {
1123
1124
  const relative = path.relative(
@@ -1151,6 +1152,7 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
1151
1152
  path: target.remote ? path.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
1152
1153
  exclude: target.exclude ?? [],
1153
1154
  defines: [
1155
+ 'Xcode',
1154
1156
  ...(packageConfiguration === 'debug' ? ['DEBUG'] : []),
1155
1157
  ...target.packageDefines
1156
1158
  .filter(
@@ -17,6 +17,7 @@ import {
17
17
  } from '../cli/internal-child-contract'
18
18
  import { rnxSelfInvocation } from '../cli/self-invocation'
19
19
  import { cacheDir } from './home-paths'
20
+ import { compiledSwiftHelper } from './swift-helper'
20
21
 
21
22
  // draws the pdf's first page at 3x into a transparent png. a bitmap context is
22
23
  // already y-up like the pdf page, so only scale. the media box
@@ -46,37 +47,6 @@ CGImageDestinationAddImage(dest, image, nil)
46
47
  guard CGImageDestinationFinalize(dest) else { exit(7) }
47
48
  `
48
49
 
49
- function rasterBinary(swift = RASTER_SWIFT, name = 'swift-pdf-raster'): string {
50
- const tag = createHash('sha256').update(swift).digest('hex').slice(0, 16)
51
- const binary = path.join(cacheDir(), `${name}-${tag}`)
52
- try {
53
- fs.accessSync(binary, fs.constants.X_OK)
54
- return binary
55
- } catch {
56
- // fall through to compile
57
- }
58
- try {
59
- fs.mkdirSync(cacheDir(), { recursive: true })
60
- const source = path.join(
61
- fs.mkdtempSync(path.join(os.tmpdir(), 'swift-pdf-raster-')),
62
- 'raster.swift',
63
- )
64
- fs.writeFileSync(source, swift)
65
- try {
66
- // runner-toolchain-platform: darwin
67
- execFileSync('xcrun', ['swiftc', '-o', binary, source], { stdio: 'pipe' })
68
- } finally {
69
- fs.rmSync(path.dirname(source), { recursive: true, force: true })
70
- }
71
- fs.accessSync(binary, fs.constants.X_OK)
72
- return binary
73
- } catch (error) {
74
- throw new Error(
75
- `swift pdf asset rasterizer did not compile (xcrun swiftc): ${error instanceof Error ? error.message : String(error)}`,
76
- )
77
- }
78
- }
79
-
80
50
  /**
81
51
  * the pdf file's page as 3x png bytes, cached by the pdf's sha256. throws
82
52
  * when the pdf cannot rasterize (corrupt, oversize), like actool failing
@@ -103,7 +73,11 @@ export function rasterizePdfFile(diskPath: string, pdfSha256: string): { bytes:
103
73
  )
104
74
  try {
105
75
  if (process.platform === 'darwin') {
106
- execFileSync(rasterBinary(), [diskPath, '3', out], { stdio: 'pipe' })
76
+ execFileSync(
77
+ compiledSwiftHelper(RASTER_SWIFT, 'swift-pdf-raster'),
78
+ [diskPath, '3', out],
79
+ { stdio: 'pipe' },
80
+ )
107
81
  } else {
108
82
  const { executable, prefixArgs } = rnxSelfInvocation()
109
83
  execFileSync(
@@ -169,7 +143,7 @@ export function rasterizeSvgFile(
169
143
  svgSha256: string,
170
144
  ): { bytes: Buffer } | null {
171
145
  if (process.platform !== 'darwin') return null
172
- const binary = rasterBinary(RASTER_SVG_SWIFT, 'swift-svg-raster')
146
+ const binary = compiledSwiftHelper(RASTER_SVG_SWIFT, 'swift-svg-raster')
173
147
  const tag = createHash('sha256').update(RASTER_SVG_SWIFT).digest('hex').slice(0, 16)
174
148
  const cached = path.join(cacheDir(), `swift-svg-png-${tag}-${svgSha256}.png`)
175
149
  if (fs.existsSync(cached)) return { bytes: fs.readFileSync(cached) }
@@ -8,6 +8,7 @@ import { installedNativeLibraries } from './installed-native-libraries'
8
8
  import {
9
9
  compiledModuleAssets,
10
10
  compiledModuleRequestHandler,
11
+ selectCompiledNitroProviders,
11
12
  type CompiledModuleAsset,
12
13
  } from './nitro-bundle'
13
14
  import { swiftDistributionRoot } from './swift-distribution'
@@ -20,7 +21,9 @@ import type { TurboCompiledModule } from './nitroContract'
20
21
  export const TURBO_ROUTE = '/__peach/turbo'
21
22
 
22
23
  /** the installed C++ TurboModule providers an app compiles: every one Peach
23
- * does not answer itself (a seam resolves before the original module). */
24
+ * does not answer itself (a seam resolves before the original module) and
25
+ * the Nitro compile does not own, since it links a Nitro provider's React
26
+ * support itself. */
24
27
  export async function compiledTurboProviders(
25
28
  appRoot: string,
26
29
  projectRoot?: string,
@@ -32,12 +35,17 @@ export async function compiledTurboProviders(
32
35
  ...Object.keys(config?.nativeViews ?? {}),
33
36
  ])
34
37
  if (!projectRoot && (await turboProviderCandidates(appRoot)).length === 0) return []
35
- return discoverTurboProviders(
36
- appRoot,
37
- projectRoot ?? (await prepareNativeAppRoot(appRoot)),
38
- iosTarget,
39
- answered,
38
+ const nitro = new Set(
39
+ (await selectCompiledNitroProviders(appRoot))?.providers.map(({ name }) => name),
40
40
  )
41
+ return (
42
+ await discoverTurboProviders(
43
+ appRoot,
44
+ projectRoot ?? (await prepareNativeAppRoot(appRoot)),
45
+ iosTarget,
46
+ answered,
47
+ )
48
+ ).filter(({ name }) => !nitro.has(name))
41
49
  }
42
50
 
43
51
  // every installed iOS pod that registers a C++ TurboModule compiles from its
@@ -10,6 +10,7 @@ import fs from 'node:fs'
10
10
  import { createRequire } from 'node:module'
11
11
  import path from 'node:path'
12
12
  import { promisify } from 'node:util'
13
+ import { PEACH_FORKED_SCRIPT_ENV } from './forked-script-contract'
13
14
  import { isRecord } from './is-record'
14
15
  import { iosAutolinkingConfig } from './nitro-source'
15
16
  import {
@@ -250,7 +251,7 @@ export async function runInstalledTurboCodegen(
250
251
  if (!isRecord(manifest) || typeof manifest.version !== 'string')
251
252
  throw new Error(`${manifestPath}: no version`)
252
253
  // RCT_SCRIPT_OUTPUT_DIR would move the output out from under outDir
253
- const env = { ...process.env }
254
+ const env: NodeJS.ProcessEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: '1' }
254
255
  delete env.RCT_SCRIPT_OUTPUT_DIR
255
256
  const app = fs.realpathSync(appRoot)
256
257
  const out = realTarget(outDir)
@@ -268,7 +269,7 @@ export async function runInstalledTurboCodegen(
268
269
  JSON.stringify(await iosAutolinkingConfig(appRoot, signal)),
269
270
  )
270
271
  await run(
271
- 'node',
272
+ process.execPath,
272
273
  [
273
274
  path.join(path.dirname(manifestPath), 'scripts/generate-codegen-artifacts.js'),
274
275
  '-p',
@@ -106,9 +106,20 @@ export function collectTurboCompileInput(
106
106
  const swift = Object.keys(files).some((file) => file.endsWith('.swift'))
107
107
  const entry = `Sources/PeachTurboApp/main.${swift ? 'swift' : 'cpp'}`
108
108
  const targetNames = targets.map(({ name }) => name)
109
+ const loadTargetNames = new Set(collection.loads.map(({ target }) => target))
110
+ const swiftImportedTargetNames = targets
111
+ .filter(
112
+ (target) =>
113
+ target.name === TURBO_CORE_TARGET ||
114
+ loadTargetNames.has(target.name) ||
115
+ Object.keys(files).some(
116
+ (file) => file.startsWith(`${target.path}/`) && file.endsWith('.swift'),
117
+ ),
118
+ )
119
+ .map(({ name }) => name)
109
120
  files[entry] = swift
110
121
  ? '@_spi(Peach) import PeachFoundation\n' +
111
- targetNames.map((target) => `import ${target}\n`).join('') +
122
+ swiftImportedTargetNames.map((target) => `import ${target}\n`).join('') +
112
123
  `PeachHostDriver.installExecutor()\n${collection.loads.map(({ symbol }) => `${symbol}()\n`).join('')}${runtime ? 'peachTurboInitialize()\n' : ''}`
113
124
  : [
114
125
  'extern "C" void peachTurboInitialize();',
@@ -8,11 +8,11 @@
8
8
  },
9
9
  "compiler": "swift-6.4.0-RELEASE-custom-fb42d2535739dfd2",
10
10
  "sdk": {
11
- "id": "swift-6.4.0-RELEASE_wasm-peach-ad35b0d9",
12
- "checksum": "477c394dd425b54e77260bbc2bab9621642e800e982ada3b99d60158cc3b8eaa"
11
+ "id": "swift-6.4.0-RELEASE_wasm-peach-3881e5a7",
12
+ "checksum": "b8981ed65e4292d922ece858d386ba4280fc90570302a57a4a789ca257daed29"
13
13
  },
14
14
  "framework": {
15
- "distribution": "f4c3215552215bd8",
15
+ "distribution": "e8eb8181d001de00",
16
16
  "wireAbi": "38eed69f6b7391584112981b7892914e7033d7e0c17c2e8d4a4448030618bd2b"
17
17
  },
18
18
  "archives": [
@@ -20,71 +20,71 @@
20
20
  "headers": {
21
21
  "reactNativeJsi": "0f8c2defbca69a27a848a81ae72363073bf9602fd316e57a75811be1a0528358"
22
22
  },
23
- "sha256": "ac578c19841f163e1d6b5ee28d42fbb4463ae11cd8d0d74daeac5b3faabf6389",
24
- "size": 26175
23
+ "sha256": "0e2fef6b40bd6ed971237b2e104464d247218b07384366df3fe10ecee570a610",
24
+ "size": 26171
25
25
  },
26
26
  {
27
27
  "headers": {
28
28
  "reactNativeJsi": "21a624ea24fd17d56bf26832d496fc1177067f89640414c20e6486c7984dfb0a"
29
29
  },
30
- "sha256": "45a85c596fd3c51c7ab51247a812d8598543282d73ffaa6dc71942941d96ffc3",
30
+ "sha256": "3522c8f62dbe28ea63e4bac81b4360aeded16f83ee9e46a25d82eb29af81863f",
31
31
  "size": 26912
32
32
  },
33
33
  {
34
34
  "headers": {
35
35
  "reactNativeJsi": "324aefd8591d9ce688bce7589c4c2b516cd33ecb95d35c47239a87a8fcf6a8da"
36
36
  },
37
- "sha256": "3e3bb4fe17120d78b2da6d31971fbaa1971a80f6f6301879931946b0750d4241",
38
- "size": 26169
37
+ "sha256": "31ab1ef8cfe5f8444bcd5b2b3434f636fddce2c01b70a271e8084c33019fb974",
38
+ "size": 26168
39
39
  },
40
40
  {
41
41
  "headers": {
42
42
  "reactNativeJsi": "33596664ee7d7a6623f0796a6feb429543316c3a41b211150acda6e1d835286c"
43
43
  },
44
- "sha256": "eae48886086ce77bfc2b52fe9f2eb8d9d9a542cc2d6a9ede4e5e2db112bf8c6e",
45
- "size": 25955
44
+ "sha256": "3be8f65b40607aa8cbf9b8fe512c4c3b9e930b422fa748079014e7aa4363b43a",
45
+ "size": 25952
46
46
  },
47
47
  {
48
48
  "headers": {
49
49
  "reactNativeJsi": "66b2cd5a38511195207f6c8a76aba735f9b9cc66a52a0d00780ffe5d331623f7"
50
50
  },
51
- "sha256": "be46c06399c7fe83f31bd64bcc9fb403380506a3e2c6eee499babdb3fc0c9c10",
52
- "size": 26172
51
+ "sha256": "4db6cf76d11fd5c02c8e6e723afb80075fc333c83b2f56cd6b6d61b50d80e37b",
52
+ "size": 26168
53
53
  },
54
54
  {
55
55
  "headers": {
56
56
  "reactNativeJsi": "96db4e758dd53e9320cef7cad485e00aa06e7a982cefd920f17007de8a5bd9f9"
57
57
  },
58
- "sha256": "5a2b794edeb5e44cd00a5a7367a1d7f0470edbd59a16ae7155eec19de67c7731",
59
- "size": 26910
58
+ "sha256": "1dd0095cce736de30c7333a7fef6065c2110215d98dcea6df5ddb23751aa753b",
59
+ "size": 26906
60
60
  },
61
61
  {
62
62
  "headers": {
63
63
  "reactNativeJsi": "aeab590ddd1218df963462242d3954ce467b0fa88f70e91429e4ffc74d230893"
64
64
  },
65
- "sha256": "ad9d67c8713780c3c0cdae3e043e972d648dbdbaddc40581d3a980690ff3e537",
66
- "size": 26913
65
+ "sha256": "f1650250478f99794359ff80931f2cda30234c4a89022166b660c08c17d21915",
66
+ "size": 26912
67
67
  },
68
68
  {
69
69
  "headers": {
70
70
  "reactNativeJsi": "b5fb260522384dd7ab07d740cdc534b529922446fcec798341c7817d9eaa49f4"
71
71
  },
72
- "sha256": "7783caf01f47fc836cdb8c7fd4ffdc0a0455225790bc4527829d231df11623e2",
73
- "size": 26042
72
+ "sha256": "999a455c207fbf35eacaa21ccf87a70eb773c80225c6e2afcefac4f130d2547f",
73
+ "size": 26041
74
74
  },
75
75
  {
76
76
  "headers": {
77
77
  "reactNativeJsi": "c6b391a1e870ccf7cdd534be63582862840f8245b99ebd253317deece1e6ffd5"
78
78
  },
79
- "sha256": "b65ceac9fa4e0a5ecc82bdc74984b7524ca94c013280998f173a6b58fe179849",
80
- "size": 26910
79
+ "sha256": "4a76e57d4c5965310aa6db4bc3457ab363502b7f24132d1129e44d1eca706186",
80
+ "size": 26906
81
81
  },
82
82
  {
83
83
  "headers": {
84
84
  "reactNativeJsi": "c8270f1315745ecc204c4209a4f50f58ff6f14b4a385ad6820a69800270b53c6"
85
85
  },
86
- "sha256": "508044d5bbd00c45069f6256bdee4b630a5219d9c307d8273f4a17c31cb9bd27",
87
- "size": 25918
86
+ "sha256": "c118b9cab18c4a980ccc96a1f1dacae9b9322e94f1441c4fa52c171d4741fbbd",
87
+ "size": 25916
88
88
  }
89
89
  ]
90
90
  }
@@ -1089,6 +1089,7 @@ export async function collectTurboSources(options: {
1089
1089
  reactNativeRoot: string
1090
1090
  providers: TurboProvider[]
1091
1091
  codegenDir: string
1092
+ configuration?: 'Debug' | 'Release'
1092
1093
  installedPods?: ReadonlyMap<string, TurboInstalledPod>
1093
1094
  /** the prepared workspace whose ios/Pods holds installed binary pods' headers */
1094
1095
  projectRoot: string
@@ -1136,11 +1137,8 @@ export async function collectTurboSources(options: {
1136
1137
  const targetPath = (name: string) => `Sources/${name}`
1137
1138
  const providerTarget = (name: string) => `TurboPackage_${sha256(name).slice(0, 16)}`
1138
1139
  const folly = readFollyConfig(reactNative.root)
1139
- // the compile builds for production, as an app's Release configuration does.
1140
- // Debug also compiles React Native's asserts, which need the glog headers
1141
- // its pod generates at install.
1142
1140
  const defines = [
1143
- 'NDEBUG',
1141
+ options.configuration === 'Debug' ? 'DEBUG=1' : 'NDEBUG',
1144
1142
  'RCT_NEW_ARCH_ENABLED=1',
1145
1143
  'RCT_REMOVE_LEGACY_ARCH=1',
1146
1144
  ...folly.defines,
@@ -1,4 +1,5 @@
1
1
  import { parse } from 'acorn'
2
+ import { compileWorkletKernel } from './worklet-kernel.ts'
2
3
 
3
4
  interface SyntaxNode {
4
5
  type: string
@@ -524,7 +525,9 @@ export function compileWorkletExecutables(
524
525
  }
525
526
  const offset = Reflect.get(codeProperty, 'end')
526
527
  if (typeof offset !== 'number') throw new Error('peach: worklet code has no offset')
527
- return { offset, text: `, __peachExecutable: (${body})` }
528
+ const kernel = compileWorkletKernel(code)
529
+ const recipe = kernel ? `, __peachKernel: ${JSON.stringify(kernel)}` : ''
530
+ return { offset, text: `, __peachExecutable: (${body})${recipe}` }
528
531
  })
529
532
  const parts: string[] = []
530
533
  let cursor = source.length