peachsim 0.1.2255 → 0.1.2257

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 (116) hide show
  1. package/cli/bridge-flow-runner.ts +41 -0
  2. package/cli/commands/control.ts +8 -2
  3. package/cli/commands/flow.ts +9 -0
  4. package/cli/commands/swift.ts +5 -0
  5. package/cli/current-sim.ts +23 -15
  6. package/cli/outbound-endpoints.ts +0 -2
  7. package/cli/secure-file.ts +8 -2
  8. package/dist-lib/agent-daemon-client.cjs +1 -1
  9. package/dist-lib/agent-events.cjs +1 -1
  10. package/dist-lib/attached-projects.cjs +1 -1
  11. package/dist-lib/auth/shared-session.cjs +1 -1
  12. package/dist-lib/backend-origin.cjs +1 -1
  13. package/dist-lib/beta.cjs +1 -1
  14. package/dist-lib/beta.mjs +1 -1
  15. package/dist-lib/bridge-constants.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.cjs +1 -1
  17. package/dist-lib/bridge-contract-input.mjs +1 -1
  18. package/dist-lib/bridge-contract.cjs +1 -1
  19. package/dist-lib/bridge-contract.mjs +1 -1
  20. package/dist-lib/bundle-channel.cjs +390 -130
  21. package/dist-lib/capture-contract.cjs +1 -1
  22. package/dist-lib/capture-contract.mjs +1 -1
  23. package/dist-lib/cloud-contract.cjs +1 -1
  24. package/dist-lib/cloud-contract.mjs +1 -1
  25. package/dist-lib/cloud-test-args.cjs +1 -1
  26. package/dist-lib/cloud-test-args.mjs +1 -1
  27. package/dist-lib/cloud.cjs +1 -1
  28. package/dist-lib/cloud.mjs +1 -1
  29. package/dist-lib/config.cjs +1 -1
  30. package/dist-lib/config.mjs +1 -1
  31. package/dist-lib/detox/index.cjs +16 -12
  32. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  33. package/dist-lib/expo-swift-bundle.cjs +352 -113
  34. package/dist-lib/expo-swift-metadata.cjs +1 -1
  35. package/dist-lib/expo-swift-metadata.mjs +1 -1
  36. package/dist-lib/home-paths.cjs +1 -1
  37. package/dist-lib/host/bridge-host.cjs +911 -582
  38. package/dist-lib/host/fetch-proxy-handler.cjs +3607 -1627
  39. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  40. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  41. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  42. package/dist-lib/host/websocket-proxy.cjs +1 -1
  43. package/dist-lib/index.cjs +12611 -11232
  44. package/dist-lib/jump-to-source-babel.cjs +1 -1
  45. package/dist-lib/jump-to-source-native.cjs +1 -1
  46. package/dist-lib/kotlin-host.cjs +5 -4
  47. package/dist-lib/menu.cjs +1 -1
  48. package/dist-lib/menu.mjs +1 -1
  49. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  50. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  51. package/dist-lib/metro-production-bundle.cjs +1 -1
  52. package/dist-lib/metro-production-bundle.mjs +1 -1
  53. package/dist-lib/metro.cjs +9700 -8326
  54. package/dist-lib/native-app-identity-project.cjs +2 -2
  55. package/dist-lib/native-app-identity-project.mjs +2 -2
  56. package/dist-lib/native-app-identity.cjs +1 -1
  57. package/dist-lib/native-app-identity.mjs +1 -1
  58. package/dist-lib/native-firebase-metadata.cjs +1 -1
  59. package/dist-lib/native-firebase-metadata.mjs +1 -1
  60. package/dist-lib/pdfium-raster.cjs +1 -1
  61. package/dist-lib/pdfium-raster.mjs +1 -1
  62. package/dist-lib/plist.cjs +1 -1
  63. package/dist-lib/plist.mjs +1 -1
  64. package/dist-lib/profiles.cjs +1 -1
  65. package/dist-lib/public-brand.cjs +1 -1
  66. package/dist-lib/public-origins-lib-esm.json +24 -24
  67. package/dist-lib/public-origins-lib.json +606 -228
  68. package/dist-lib/react-native-host-modules.cjs +1 -1
  69. package/dist-lib/react-native-host-modules.mjs +1 -1
  70. package/dist-lib/reap-browser.cjs +1 -1
  71. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  72. package/dist-lib/sdk.cjs +1 -1
  73. package/dist-lib/sdk.mjs +1 -1
  74. package/dist-lib/skills.cjs +1164 -784
  75. package/dist-lib/swift-compile.cjs +334 -99
  76. package/dist-lib/swift-compile.mjs +334 -99
  77. package/dist-lib/swift-package.cjs +1 -1
  78. package/dist-lib/swift-package.mjs +1 -1
  79. package/dist-lib/swift-submit.cjs +1 -1
  80. package/dist-lib/swift-submit.mjs +1 -1
  81. package/dist-lib/swift-toolchain.cjs +1 -1
  82. package/dist-lib/swift.cjs +1 -1
  83. package/dist-lib/vite-swift.cjs +335 -100
  84. package/dist-lib/vite.cjs +4729 -2900
  85. package/dist-lib/worklet-executable.cjs +1 -1
  86. package/dist-lib/worklet-executable.mjs +1 -1
  87. package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +1 -0
  88. package/dist-types/packages/peach-globals/src/appLifecycleBridgeContract.d.ts +1 -0
  89. package/dist-types/packages/peach-globals/src/index.d.ts +1 -0
  90. package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +1 -0
  91. package/dist-types/packages/peach-kit/src/transitions/screen-transition-math.d.ts +6 -0
  92. package/java-platform/licenses/android.txt +183 -0
  93. package/java-platform/licenses/arm-optimized-routines.txt +256 -0
  94. package/java-platform/licenses/fdlibm.txt +72 -0
  95. package/java-platform/licenses/icu.txt +50 -0
  96. package/java-platform/licenses/openjdk.txt +395 -0
  97. package/java-platform/licenses/teavm.txt +182 -0
  98. package/java-platform/licenses/threeten-backport.txt +29 -0
  99. package/kotlin/README.md +1 -1
  100. package/kotlin/sdk.tar.gz +0 -0
  101. package/package.json +2 -1
  102. package/runtime-companion.json +1 -1
  103. package/src/expo-autolinking.ts +47 -4
  104. package/src/expo-pod-prebuilt.ts +96 -9
  105. package/src/expo-swift-host.ts +29 -9
  106. package/src/kotlin-host.ts +3 -2
  107. package/src/kotlinSdkContract.ts +1 -0
  108. package/src/native-package-slice.ts +810 -0
  109. package/src/native-prebuilt.ts +4 -0
  110. package/src/native-seam-manifest.ts +0 -8
  111. package/src/nitro-adapter.lock.json +255 -255
  112. package/src/nitro-superset.lock.json +4 -4
  113. package/src/swift-distribution.lock.json +11 -11
  114. package/src/swift-link-roots.ts +23 -22
  115. package/src/swift-wasm-prune.ts +436 -105
  116. package/src/turbo-runtime.lock.json +23 -23
@@ -4,6 +4,7 @@ import { createRequire } from 'node:module'
4
4
  import path from 'node:path'
5
5
  import { promisify } from 'node:util'
6
6
  import { PEACH_FORKED_SCRIPT_ENV } from './forked-script-contract'
7
+ import { isRecord } from './is-record'
7
8
 
8
9
  // the autolinker's command line changed across Expo releases: before 1.8.0 it
9
10
  // takes the project from its working directory, before 1.10.3 the Apple
@@ -32,9 +33,17 @@ const run = promisify(execFile)
32
33
 
33
34
  async function autolinkerResults(appRoot: string) {
34
35
  const appRequire = createRequire(path.join(appRoot, 'package.json'))
36
+ let expoRoot: string | undefined
37
+ try {
38
+ expoRoot = path.dirname(appRequire.resolve('expo/package.json'))
39
+ } catch (error) {
40
+ if (Reflect.get(Object(error), 'code') !== 'MODULE_NOT_FOUND') throw error
41
+ }
35
42
  let manifest: string
36
43
  try {
37
- manifest = appRequire.resolve('expo-modules-autolinking/package.json')
44
+ manifest = appRequire.resolve('expo-modules-autolinking/package.json', {
45
+ paths: expoRoot ? [appRoot, expoRoot] : [appRoot],
46
+ })
38
47
  } catch (error) {
39
48
  if (Reflect.get(Object(error), 'code') === 'MODULE_NOT_FOUND') return null
40
49
  throw error
@@ -56,6 +65,26 @@ async function autolinkerResults(appRoot: string) {
56
65
  ),
57
66
  )
58
67
  const modules: AutolinkedModule[] = resolve.modules
68
+ try {
69
+ const scan: unknown = Reflect.get(
70
+ appRequire(path.join(path.dirname(manifest), 'build/platforms/apple')),
71
+ 'scanNativeModulesAsync',
72
+ )
73
+ const scanned: unknown =
74
+ typeof scan === 'function' && isRecord(search) ? await scan(search, 'apple') : null
75
+ if (isRecord(scanned) && isRecord(search)) {
76
+ for (const module of modules) {
77
+ const entry = search[module.packageName]
78
+ const config = isRecord(entry) ? entry.config : null
79
+ const apple = isRecord(config) ? (config.apple ?? config.ios) : null
80
+ if (isRecord(apple) && apple.modules != null) continue
81
+ const found = scanned[module.packageName]
82
+ if (Array.isArray(found)) module.modules = found
83
+ }
84
+ }
85
+ } catch (error) {
86
+ if (Reflect.get(Object(error), 'code') !== 'MODULE_NOT_FOUND') throw error
87
+ }
59
88
  return { search, modules }
60
89
  }
61
90
 
@@ -63,6 +92,9 @@ interface AutolinkedModule {
63
92
  packageName: string
64
93
  swiftModuleNames?: string[]
65
94
  pods: { podName: string; podspecDir: string }[]
95
+ modules?: unknown[]
96
+ appDelegateSubscribers?: unknown[]
97
+ reactDelegateHandlers?: unknown[]
66
98
  }
67
99
 
68
100
  /** the Apple pods of every Expo module the app's autolinker selects, which the
@@ -81,13 +113,24 @@ export async function expoAutolinkedPods(
81
113
  }
82
114
 
83
115
  /** each installed Expo module package the app's autolinker selects, with the Swift modules it builds. */
84
- export async function expoAutolinkedPackages(
85
- appRoot: string,
86
- ): Promise<{ name: string; root: string; swiftModuleNames: string[] }[]> {
116
+ export async function expoAutolinkedPackages(appRoot: string): Promise<
117
+ {
118
+ name: string
119
+ root: string
120
+ swiftModuleNames: string[]
121
+ hasRegistrations: boolean
122
+ }[]
123
+ > {
87
124
  const linked = await autolinkerResults(appRoot)
88
125
  return (linked?.modules ?? []).map((module) => ({
89
126
  name: module.packageName,
90
127
  root: fs.realpathSync(linked!.search[module.packageName].path),
91
128
  swiftModuleNames: module.swiftModuleNames ?? [],
129
+ hasRegistrations:
130
+ (Array.isArray(module.modules) && module.modules.length > 0) ||
131
+ (Array.isArray(module.appDelegateSubscribers) &&
132
+ module.appDelegateSubscribers.length > 0) ||
133
+ (Array.isArray(module.reactDelegateHandlers) &&
134
+ module.reactDelegateHandlers.length > 0),
92
135
  }))
93
136
  }
@@ -9,15 +9,26 @@ import path from 'node:path'
9
9
  import { peachAnsweredNativePackages } from './answeredNativePackages'
10
10
  import { expoAutolinkedPackages } from './expo-autolinking'
11
11
  import { expoNativeCompilerDigestValue } from './expo-native-prebuilt'
12
+ import { collectExpoSwiftSources } from './expo-swift-host'
12
13
  import {
13
14
  isExpoSwiftCompilationResult,
14
15
  type ExpoSwiftCompilationResult,
15
16
  } from './expoSwiftContract'
16
17
  import { isRecord } from './is-record'
18
+ import {
19
+ buildExpoSwiftPackageSlice,
20
+ type ComposedExpoBundle,
21
+ composeExpoPackageSlices,
22
+ expoAppBundleEntryUrl,
23
+ expoPackageSliceInputs,
24
+ expoPodsBundleInputs,
25
+ type LoadedNativePackageSlice,
26
+ } from './native-package-slice'
17
27
  import {
18
28
  NATIVE_PREBUILT_ORIGIN,
19
29
  nativeEntryKey,
20
30
  nativeEntryPrefix,
31
+ nativePackageEntryName,
21
32
  } from './native-prebuilt'
22
33
  import { packageTreeDigest } from './package-tree-digest'
23
34
  import { swiftNativePin } from './swift-native-pin'
@@ -37,6 +48,7 @@ export async function expoPodPackages(appRoot: string): Promise<ExpoPodPackage[]
37
48
  if (
38
49
  swiftModule === undefined ||
39
50
  pod.swiftModuleNames.length !== 1 ||
51
+ !pod.hasRegistrations ||
40
52
  answered.has(pod.name) ||
41
53
  !pod.root.split(path.sep).includes('node_modules')
42
54
  )
@@ -65,7 +77,7 @@ export async function expoPodInputs(
65
77
  }
66
78
 
67
79
  // a scoped package name holds a slash the entry path cannot
68
- export const expoPodEntryName = (name: string) => name.replace('/', '+')
80
+ export const expoPodEntryName = nativePackageEntryName
69
81
 
70
82
  export const expoPodEntryUrl = (name: string, key: string, file: string) =>
71
83
  `${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix('expo-pod', expoPodEntryName(name), key)}/${file}`
@@ -118,15 +130,32 @@ export async function prebuiltExpoPods(
118
130
  console.error(`expo pod miss: no packages at ${appRoot}`)
119
131
  return null
120
132
  }
121
- const entries = await Promise.all(
122
- pods.map(async (pod) =>
123
- lookup(
124
- expoPodEntryUrl(
125
- pod.name,
126
- nativeEntryKey(await expoPodInputs(pod)),
127
- 'metadata.json',
128
- ),
133
+ const podEntries = await Promise.all(
134
+ pods.map(async (pod) => {
135
+ const podInputs = await expoPodInputs(pod)
136
+ return {
137
+ pod,
138
+ podKey: nativeEntryKey(podInputs),
139
+ sliceKey: nativeEntryKey(expoPackageSliceInputs(pod, podInputs)),
140
+ }
141
+ }),
142
+ )
143
+ if (podEntries.length >= 2) {
144
+ const bundleKey = nativeEntryKey(
145
+ expoPodsBundleInputs(
146
+ podEntries.map(({ pod, sliceKey }) => ({
147
+ name: pod.name,
148
+ version: pod.version,
149
+ key: sliceKey,
150
+ })),
129
151
  ),
152
+ )
153
+ const bundled = await lookup(expoAppBundleEntryUrl(bundleKey, 'metadata.json'))
154
+ if (bundled) return bundled
155
+ }
156
+ const entries = await Promise.all(
157
+ podEntries.map(async ({ pod, podKey }) =>
158
+ lookup(expoPodEntryUrl(pod.name, podKey, 'metadata.json')),
130
159
  ),
131
160
  )
132
161
  const hits = entries.filter((entry) => entry !== null)
@@ -137,3 +166,61 @@ export async function prebuiltExpoPods(
137
166
  failures: [],
138
167
  }
139
168
  }
169
+
170
+ /**
171
+ * compiles installed Expo Swift pods into reusable `native/pkg` slices and
172
+ * composes them into one shared-core `native/app-bundle/expo` executable when
173
+ * the app links two or more pods.
174
+ */
175
+ export async function composePrebuiltExpoPodsForApp(
176
+ appRoot: string,
177
+ moduleRoot: string,
178
+ ): Promise<ComposedExpoBundle | null> {
179
+ const realRoot = fs.realpathSync(appRoot)
180
+ const pods = await expoPodPackages(realRoot)
181
+ if (pods.length < 2) return null
182
+ const podEntries = await Promise.all(
183
+ pods.map(async (pod) => {
184
+ const podInputs = await expoPodInputs(pod)
185
+ return {
186
+ pod,
187
+ podInputs,
188
+ sliceKey: nativeEntryKey(expoPackageSliceInputs(pod, podInputs)),
189
+ }
190
+ }),
191
+ )
192
+ const units = await collectExpoSwiftSources(
193
+ realRoot,
194
+ undefined,
195
+ undefined,
196
+ false,
197
+ undefined,
198
+ { moduleRoot },
199
+ )
200
+ const slices: LoadedNativePackageSlice[] = []
201
+ for (const { pod, podInputs } of podEntries) {
202
+ try {
203
+ const slice = await buildExpoSwiftPackageSlice({
204
+ appRoot: realRoot,
205
+ pod,
206
+ podInputs,
207
+ moduleRoot,
208
+ units,
209
+ })
210
+ if (slice) slices.push(slice)
211
+ } catch (error) {
212
+ console.error(
213
+ `expo slice ${pod.name}@${pod.version}: ${error instanceof Error ? error.message : String(error)}`,
214
+ )
215
+ }
216
+ }
217
+ if (slices.length < 2) return null
218
+ const bundleInputs = expoPodsBundleInputs(
219
+ podEntries.map(({ pod, sliceKey }) => ({
220
+ name: pod.name,
221
+ version: pod.version,
222
+ key: sliceKey,
223
+ })),
224
+ )
225
+ return composeExpoPackageSlices(slices, { moduleRoot, bundleInputs })
226
+ }
@@ -1611,10 +1611,7 @@ async function collectExpoSwiftSourcesUncached(
1611
1611
  throw new Error('Expo Swift sources exceed compile service caps')
1612
1612
  files[
1613
1613
  `Sources/${namespace}/${path.relative(ios, file).split(path.sep).join('/')}`
1614
- ] =
1615
- // CocoaPods' iOS umbrella header imports UIKit into every Swift file
1616
- // through the underlying module; these source units have no clang pod.
1617
- `import UIKit\n#sourceLocation(file: ${JSON.stringify(file)}, line: 1)\n${fs.readFileSync(source, 'utf8')}`
1614
+ ] = expoSwiftSourceWithPrelude(file, fs.readFileSync(source, 'utf8'))
1618
1615
  }
1619
1616
  }
1620
1617
  const walkFrameworks = (dir: string) => {
@@ -1889,7 +1886,7 @@ async function collectExpoSwiftSourcesUncached(
1889
1886
  )
1890
1887
  throw new Error('Expo Swift sources exceed compile service caps')
1891
1888
  appFiles[`Sources/PeachExpoApp/Inline/${relative.split(path.sep).join('/')}`] =
1892
- `import UIKit\n#sourceLocation(file: ${JSON.stringify(file)}, line: 1)\n${fs.readFileSync(file, 'utf8')}`
1889
+ expoSwiftSourceWithPrelude(file, fs.readFileSync(file, 'utf8'))
1893
1890
  }
1894
1891
  if (Object.keys(appFiles).length > 0) {
1895
1892
  const inlineUnit: ExpoSwiftSourceUnit = {
@@ -2014,7 +2011,7 @@ async function collectExpoSwiftSourcesUncached(
2014
2011
  }
2015
2012
 
2016
2013
  // target settings follow their installed CocoaPods build configuration.
2017
- function expoManifest(
2014
+ export function expoManifest(
2018
2015
  files: Record<string, string>,
2019
2016
  generation = '',
2020
2017
  settings: ReturnType<typeof targetSettings> = new Map(),
@@ -2054,7 +2051,7 @@ function expoManifest(
2054
2051
  return `// swift-tools-version: 6.0\nimport PackageDescription\nlet package = Package(name: "PeachExpo", targets: [${declarations.join(', ')}, .executableTarget(name: "PeachExpoApp", dependencies: [${appProducts.join(', ')}], path: "Sources/PeachExpoApp")])\n// stand-in inputs: ${generation}\n`
2055
2052
  }
2056
2053
 
2057
- function targetSettings(units: ExpoSwiftSourceUnit[]) {
2054
+ export function targetSettings(units: ExpoSwiftSourceUnit[]) {
2058
2055
  const settings = new Map<
2059
2056
  string,
2060
2057
  Parameters<typeof swiftManifestSettings>[0] &
@@ -2097,7 +2094,18 @@ function oneSDKStamp(oneSDK: ExpoSwiftPreparationOptions['oneSDK']): string {
2097
2094
  return hash.digest('hex')
2098
2095
  }
2099
2096
 
2100
- function expoEntry(units: ExpoSwiftSourceUnit[], oneSDK = false): string {
2097
+ // CocoaPods' iOS umbrella header imports UIKit into every Swift file through
2098
+ // the underlying module; these source units have no clang pod, and sources
2099
+ // calling UIImageWriteToSavedPhotosAlbum also need the SwiftUI re-export until
2100
+ // UIKit re-exports it in the published distribution.
2101
+ export function expoSwiftSourceWithPrelude(file: string, rawSource: string): string {
2102
+ const extraImport = /\bUIImageWriteToSavedPhotosAlbum\b/.test(rawSource)
2103
+ ? 'import func SwiftUI.UIImageWriteToSavedPhotosAlbum\n'
2104
+ : ''
2105
+ return `import UIKit\n${extraImport}#sourceLocation(file: ${JSON.stringify(file)}, line: 1)\n${rawSource}`
2106
+ }
2107
+
2108
+ export function expoEntry(units: ExpoSwiftSourceUnit[], oneSDK = false): string {
2101
2109
  // an Objective-C bridge module registers with no Swift of its own
2102
2110
  const namespaces = [...new Set(units.map((unit) => unit.namespace))]
2103
2111
  .filter((namespace) => namespace !== 'PeachExpoApp')
@@ -2113,10 +2121,22 @@ function expoEntry(units: ExpoSwiftSourceUnit[], oneSDK = false): string {
2113
2121
  subscribers.length + handlers.length > 0
2114
2122
  ? `; PeachExpoRuntime.registerDelegates(subscribers: [${subscribers.join(', ')}], handlers: [${handlers.join(', ')}])`
2115
2123
  : ''
2124
+ // omit PeachExpoNativeView when no unit declares a view so UIKit/SwiftUI view machinery stays unlinked
2125
+ const hasViews =
2126
+ oneSDK ||
2127
+ units.some((unit) =>
2128
+ Object.entries(unit.files).some(
2129
+ ([file, source]) =>
2130
+ file.endsWith('.swift') &&
2131
+ /\bView\s*\(|\bExpoView\b|\bUIViewRepresentable\b|\bExpoSwiftUI\b/.test(source),
2132
+ ),
2133
+ )
2116
2134
  // a One SDK host component marks its view; every other view is an Expo view
2117
2135
  const view = oneSDK
2118
2136
  ? '@ViewBuilder func view(props: JSON) -> some View {\n if props["oneSDKHost"] != nil { OneSDKUIKitHost(props: props) } else { PeachExpoNativeView(props: props) }\n }'
2119
- : 'func view(props: JSON) -> PeachExpoNativeView { PeachExpoNativeView(props: props) }'
2137
+ : hasViews
2138
+ ? 'func view(props: JSON) -> PeachExpoNativeView { PeachExpoNativeView(props: props) }'
2139
+ : 'func view(props: JSON) -> EmptyView { EmptyView() }'
2120
2140
  return `import SwiftUI\ninternal import ExpoModulesCore\n${bridgeModules.length ? 'import React\n' : ''}${oneSDK ? 'import One\nimport OneSDKBindings\n' : ''}${namespaces.map((namespace) => `import ${namespace}`).join('\n')}\n\n@main struct PeachExpoApp: PeachPackage {\n init() { MainActor.assumeIsolated { PeachExpoRuntime.register([${units.flatMap((unit) => unit.classes).join(', ')}])${delegates}${bridgeModules.length ? `; RCTModuleHost.register([${bridgeModules.join(', ')}])` : ''} } }\n ${view}\n}\n\n@_expose(wasm, "peach_expo_call")\n@_cdecl("peach_expo_call")\n@MainActor public func peachExpoCall(_ payload: UnsafePointer<UInt8>?, _ length: Int32) -> UnsafeMutablePointer<UInt8>? {\n PeachExpoRuntime.dispatch(payload, length)\n}\n`
2121
2141
  }
2122
2142
 
@@ -173,7 +173,7 @@ function entrySource(ids: string[]): string {
173
173
  ].join('\n')
174
174
  }
175
175
 
176
- const BUILD_FORMAT = 21
176
+ const BUILD_FORMAT = 22
177
177
  const builds = new Map<string, Promise<KotlinArtifact>>()
178
178
 
179
179
  function buildsDir(): string {
@@ -1321,7 +1321,8 @@ async function compileKotlin(
1321
1321
  const build = (async () => {
1322
1322
  const ready = await ensureToolchain(toolchain)
1323
1323
  const { kotlinc } = ready
1324
- const libraries = [...ready.libraries, sdkLibrary]
1324
+ // the Java platform: link DCE keeps only what the app reaches
1325
+ const libraries = [...ready.libraries, sdkLibrary, path.join(sdk.root, 'java.klib')]
1325
1326
  const composeRuntime = path.join(
1326
1327
  kotlinHome(),
1327
1328
  toolchain.compiler.version,
@@ -58,6 +58,7 @@ export const KOTLIN_SDK_FILES = [
58
58
  'plugin.jar',
59
59
  'tools.jar',
60
60
  ...Object.keys(KOTLIN_SDK_PROFILES).map((name) => `${name}.klib`),
61
+ 'java.klib',
61
62
  ]
62
63
 
63
64
  export interface KotlinSdkManifest {