peachsim 0.1.2421 → 0.1.2423

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 (117) hide show
  1. package/cli/command-agent.ts +14 -15
  2. package/cli/commands/box.ts +33 -28
  3. package/cli/commands/canvas.ts +54 -0
  4. package/cli/commands/platform.ts +28 -27
  5. package/cli/commands/preview.ts +2 -1
  6. package/cli/outbound-endpoints.ts +3 -0
  7. package/dist-lib/agent-daemon-client.cjs +1 -1
  8. package/dist-lib/agent-events.cjs +1 -1
  9. package/dist-lib/attached-projects.cjs +1 -1
  10. package/dist-lib/auth/shared-session.cjs +1 -1
  11. package/dist-lib/backend-origin.cjs +1 -1
  12. package/dist-lib/beta.cjs +1 -1
  13. package/dist-lib/beta.mjs +1 -1
  14. package/dist-lib/bridge-constants.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.mjs +1 -1
  17. package/dist-lib/bridge-contract.cjs +1 -1
  18. package/dist-lib/bridge-contract.mjs +1 -1
  19. package/dist-lib/bundle-channel.cjs +4318 -3937
  20. package/dist-lib/capture-contract.cjs +1 -1
  21. package/dist-lib/capture-contract.mjs +1 -1
  22. package/dist-lib/cloud-contract.cjs +22 -1
  23. package/dist-lib/cloud-contract.mjs +20 -1
  24. package/dist-lib/cloud-test-args.cjs +1 -1
  25. package/dist-lib/cloud-test-args.mjs +1 -1
  26. package/dist-lib/cloud.cjs +1 -1
  27. package/dist-lib/cloud.mjs +1 -1
  28. package/dist-lib/config.cjs +1 -1
  29. package/dist-lib/config.mjs +1 -1
  30. package/dist-lib/detox/index.cjs +27 -13
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/expo-swift-bundle.cjs +3343 -2962
  33. package/dist-lib/expo-swift-metadata.cjs +1 -1
  34. package/dist-lib/expo-swift-metadata.mjs +1 -1
  35. package/dist-lib/home-paths.cjs +1 -1
  36. package/dist-lib/host/bridge-host.cjs +4200 -3819
  37. package/dist-lib/host/fetch-proxy-handler.cjs +25 -4
  38. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  39. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  40. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  41. package/dist-lib/host/websocket-proxy.cjs +1 -1
  42. package/dist-lib/index.cjs +88 -53
  43. package/dist-lib/jump-to-source-babel.cjs +1 -1
  44. package/dist-lib/jump-to-source-native.cjs +1 -1
  45. package/dist-lib/kotlin-host.cjs +1 -1
  46. package/dist-lib/menu.cjs +1 -1
  47. package/dist-lib/menu.mjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  49. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  50. package/dist-lib/metro-production-bundle.cjs +1 -1
  51. package/dist-lib/metro-production-bundle.mjs +1 -1
  52. package/dist-lib/metro.cjs +25 -4
  53. package/dist-lib/native-app-identity-project.cjs +2 -2
  54. package/dist-lib/native-app-identity-project.mjs +231 -212
  55. package/dist-lib/native-app-identity.cjs +1 -1
  56. package/dist-lib/native-app-identity.mjs +1 -1
  57. package/dist-lib/native-firebase-metadata.cjs +1 -1
  58. package/dist-lib/native-firebase-metadata.mjs +1 -1
  59. package/dist-lib/pdfium-raster.cjs +1 -1
  60. package/dist-lib/pdfium-raster.mjs +1 -1
  61. package/dist-lib/plist.cjs +1 -1
  62. package/dist-lib/plist.mjs +1 -1
  63. package/dist-lib/profiles.cjs +1 -1
  64. package/dist-lib/public-brand.cjs +1 -1
  65. package/dist-lib/public-origins-lib-esm.json +30 -25
  66. package/dist-lib/public-origins-lib.json +78 -56
  67. package/dist-lib/react-native-host-modules.cjs +1 -1
  68. package/dist-lib/react-native-host-modules.mjs +1 -1
  69. package/dist-lib/reap-browser.cjs +1 -1
  70. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  71. package/dist-lib/sdk.cjs +1 -1
  72. package/dist-lib/sdk.mjs +1 -1
  73. package/dist-lib/skills.cjs +4990 -4586
  74. package/dist-lib/swift-compile.cjs +1261 -889
  75. package/dist-lib/swift-compile.mjs +1231 -849
  76. package/dist-lib/swift-package.cjs +1 -1
  77. package/dist-lib/swift-package.mjs +1 -1
  78. package/dist-lib/swift-submit.cjs +1 -1
  79. package/dist-lib/swift-submit.mjs +1 -1
  80. package/dist-lib/swift-toolchain.cjs +1 -1
  81. package/dist-lib/swift.cjs +1 -1
  82. package/dist-lib/vite-swift.cjs +2712 -2348
  83. package/dist-lib/vite.cjs +25 -4
  84. package/dist-lib/worklet-executable.cjs +1 -1
  85. package/dist-lib/worklet-executable.mjs +1 -1
  86. package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +1 -1
  87. package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +83 -2
  88. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  89. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +0 -10
  90. package/dist-types/packages/peach-engine/src/render-worker/compositor-runtime/layer-claims.d.ts +2 -1
  91. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +9 -0
  92. package/dist-types/packages/peach-globals/src/canvasAgentContract.d.ts +8 -0
  93. package/dist-types/packages/peach-globals/src/index.d.ts +4 -2
  94. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +12 -0
  95. package/dist-types/packages/peach-globals/src/sceneStreamBridgeContract.d.ts +5 -1
  96. package/kotlin/sdk.tar.gz +0 -0
  97. package/package.json +1 -1
  98. package/runtime-companion.json +1 -1
  99. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes +2 -0
  100. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStore.h +2 -0
  101. package/sdk/ios/wasm/include/errno.h +10 -0
  102. package/src/agent-daemon-client.ts +1 -1
  103. package/src/agent-prompt.ts +1 -8
  104. package/src/canvas-agent-note-delivery.ts +2 -5
  105. package/src/canvas-groups.ts +11 -3
  106. package/src/cloud-contract.ts +31 -1
  107. package/src/expo-kotlin-bundle.ts +1 -1
  108. package/src/native-static-libraries.ts +51 -4
  109. package/src/swift-compile.ts +184 -108
  110. package/src/swift-compiler-digest.ts +2 -0
  111. package/src/swift-guest-compile.ts +2 -0
  112. package/src/swift-guest-source-inputs.ts +2 -2
  113. package/src/swift-header-compiler.ts +185 -0
  114. package/src/swift-header-dependencies.ts +174 -0
  115. package/src/swift-objc-compile.ts +18 -24
  116. package/src/vite-plugin.ts +4 -1
  117. package/dist-types/packages/peach-engine/src/render-worker/accessibilityHostContract.d.ts +0 -65
@@ -0,0 +1,185 @@
1
+ import { createHash } from 'node:crypto'
2
+ import {
3
+ chmodSync,
4
+ existsSync,
5
+ mkdirSync,
6
+ mkdtempSync,
7
+ readFileSync,
8
+ renameSync,
9
+ rmSync,
10
+ statSync,
11
+ writeFileSync,
12
+ } from 'node:fs'
13
+ import { createServer } from 'node:http'
14
+ import path from 'node:path'
15
+ import { PEACH_FORKED_SCRIPT_ENV } from './forked-script-contract'
16
+ import { isRecord } from './is-record'
17
+ import { writeBuildFile } from './write-build-file'
18
+
19
+ export const SWIFT_HEADER_COMPILER_WRAPPER = '.build/peach-swiftc'
20
+
21
+ const argument = (value: string) => `'${value.replaceAll("'", `'"'"'`)}'`
22
+
23
+ const client = `const { request } = require('node:http')
24
+ const { spawnSync } = require('node:child_process')
25
+ const { existsSync } = require('node:fs')
26
+ const [socketPath, moduleName, swiftc, receipt, ...args] = process.argv.slice(2)
27
+ const body = JSON.stringify(args)
28
+ const notify = (method) => new Promise((resolve, reject) => {
29
+ const req = request({ socketPath, path: '/' + moduleName, method }, response => {
30
+ let message = ''
31
+ response.setEncoding('utf8').on('data', data => { message += data })
32
+ response.on('end', () => {
33
+ if (response.statusCode === 200 || response.statusCode === 204) resolve(response.statusCode === 200)
34
+ else reject(new Error(message))
35
+ })
36
+ response.on('error', reject)
37
+ })
38
+ req.on('error', reject)
39
+ req.end(body)
40
+ })
41
+ async function compile() {
42
+ if (existsSync(receipt) && await notify('PUT')) return
43
+ const result = spawnSync(swiftc, args, { stdio: 'inherit' })
44
+ if (result.error) throw result.error
45
+ if (result.status !== 0) { process.exitCode = result.status ?? 1; return }
46
+ await notify('POST')
47
+ }
48
+ compile().catch(error => {
49
+ process.stderr.write(String(error) + '\\n')
50
+ process.exitCode = 1
51
+ })
52
+ `
53
+
54
+ function compilerCheckpoint(
55
+ root: string,
56
+ recipe: string,
57
+ args: string[],
58
+ header: string,
59
+ ): string | undefined {
60
+ const value = (flag: string) => {
61
+ const index = args.lastIndexOf(flag)
62
+ return index < 0 ? undefined : args[index + 1]
63
+ }
64
+ const outputMap = value('-output-file-map')
65
+ const module = value('-emit-module-path')
66
+ if (!outputMap || !module || !args.includes('-whole-module-optimization')) return
67
+ const mapText = readFileSync(outputMap, 'utf8')
68
+ const map: unknown = JSON.parse(mapText)
69
+ if (!isRecord(map) || !isRecord(map['']) || typeof map[''].dependencies !== 'string')
70
+ return
71
+ const objects: string[] = []
72
+ for (const [source, outputs] of Object.entries(map)) {
73
+ if (!source) continue
74
+ if (!isRecord(outputs) || typeof outputs.object !== 'string') return
75
+ objects.push(outputs.object)
76
+ }
77
+ if (!objects.length) return
78
+ const outputs = [module, header, map[''].dependencies, ...objects]
79
+ const digest = createHash('sha256')
80
+ .update(recipe)
81
+ .update(JSON.stringify(args))
82
+ .update(mapText)
83
+ for (const flag of args) {
84
+ if (!flag.startsWith('@')) continue
85
+ const response = flag.slice(1)
86
+ if (!path.isAbsolute(response) || !existsSync(response)) return
87
+ digest.update(readFileSync(response))
88
+ }
89
+ for (const file of outputs) {
90
+ if (!file.startsWith(path.join(root, '.build') + path.sep)) return
91
+ const stat = statSync(file, { bigint: true, throwIfNoEntry: false })
92
+ if (!stat?.isFile() || stat.size === 0n) return
93
+ digest.update(JSON.stringify([file, String(stat.size), String(stat.mtimeNs)]))
94
+ }
95
+ return digest.digest('hex')
96
+ }
97
+
98
+ export async function withSwiftHeaderCompiler<T>(
99
+ root: string,
100
+ toolchainBin: string,
101
+ recipe: string,
102
+ producers: ReadonlyMap<string, { header: string; publish: () => void }>,
103
+ build: (compiler: Record<string, string>) => Promise<T>,
104
+ ): Promise<T> {
105
+ const wrapper = path.join(root, SWIFT_HEADER_COMPILER_WRAPPER)
106
+ const script = path.join(root, '.build', 'peach-swift-header.cjs')
107
+ const checkpoints = path.join(root, '.build', 'peach-swift-header-checkpoints')
108
+ mkdirSync(checkpoints, { recursive: true })
109
+ const swiftc = argument(path.join(toolchainBin, 'swiftc'))
110
+ writeBuildFile(script, client)
111
+ writeBuildFile(
112
+ wrapper,
113
+ [
114
+ '#!/bin/sh',
115
+ 'module=; compile=; previous=',
116
+ 'for flag in "$@"; do',
117
+ ' if [ "$previous" = -module-name ]; then module=$flag; fi',
118
+ ' if [ "$flag" = -c ]; then compile=1; fi',
119
+ ' previous=$flag',
120
+ 'done',
121
+ 'case "$compile:$module" in',
122
+ ` ${[...producers.keys()].map((name) => argument(`1:${name}`)).join('|')})`,
123
+ ` ${PEACH_FORKED_SCRIPT_ENV}=1 exec ${argument(process.execPath)} ${argument(script)} "$PEACH_SWIFT_HEADER_SOCKET" "$module" ${swiftc} ${argument(checkpoints)}/"$module" "$@" ;;`,
124
+ 'esac',
125
+ `exec ${swiftc} "$@"`,
126
+ '',
127
+ ].join('\n'),
128
+ )
129
+ chmodSync(wrapper, 0o755)
130
+
131
+ // unix socket paths are shorter than a typical build root on macos.
132
+ const directory = mkdtempSync('/tmp/peach-headers-')
133
+ const socket = path.join(directory, 'compile')
134
+ const server = createServer(async (request, response) => {
135
+ const module = request.url?.slice(1) ?? ''
136
+ const producer = producers.get(module)
137
+ if (!producer) {
138
+ response.writeHead(404).end('unknown Swift header producer')
139
+ return
140
+ }
141
+ try {
142
+ const chunks: Buffer[] = []
143
+ for await (const chunk of request) chunks.push(chunk)
144
+ const args: unknown = JSON.parse(Buffer.concat(chunks).toString())
145
+ if (!Array.isArray(args) || !args.every((arg: unknown) => typeof arg === 'string'))
146
+ throw new Error('invalid Swift compiler arguments')
147
+ const receipt = path.join(checkpoints, module)
148
+ const fingerprint = compilerCheckpoint(root, recipe, args, producer.header)
149
+ if (request.method === 'PUT') {
150
+ if (
151
+ !fingerprint ||
152
+ !existsSync(receipt) ||
153
+ readFileSync(receipt, 'utf8') !== fingerprint
154
+ ) {
155
+ response.writeHead(204).end()
156
+ return
157
+ }
158
+ producer.publish()
159
+ response.end()
160
+ return
161
+ }
162
+ if (request.method !== 'POST')
163
+ throw new Error('invalid Swift compiler checkpoint method')
164
+ producer.publish()
165
+ if (fingerprint) {
166
+ writeFileSync(`${receipt}.partial`, fingerprint)
167
+ renameSync(`${receipt}.partial`, receipt)
168
+ }
169
+ response.end()
170
+ } catch (error) {
171
+ response.writeHead(500).end(String(error))
172
+ }
173
+ })
174
+ try {
175
+ await new Promise<void>((resolve, reject) => {
176
+ server.once('error', reject)
177
+ server.listen(socket, resolve)
178
+ })
179
+ return await build({ SWIFT_EXEC: wrapper, PEACH_SWIFT_HEADER_SOCKET: socket })
180
+ } finally {
181
+ server.close()
182
+ server.closeAllConnections()
183
+ rmSync(directory, { recursive: true, force: true })
184
+ }
185
+ }
@@ -0,0 +1,174 @@
1
+ import path from 'node:path'
2
+ import { moduleMapTokens, type SwiftPackageTarget } from './swift-package'
3
+ import {
4
+ SWIFT_NATIVE_INPUT_ROOT,
5
+ type SwiftHeaderAliases,
6
+ type SwiftNativeTarget,
7
+ } from './swiftContract'
8
+
9
+ export function* nativeHeaderIncludes(source: string): Iterable<string> {
10
+ for (const match of source
11
+ .replace(/\/\*[\s\S]*?\*\//g, '')
12
+ .matchAll(/^\s*#\s*(?:include|import)\s*[<"]([^>"]+)[>"]/gm))
13
+ yield match[1]!
14
+ }
15
+
16
+ export function swiftHeaderDependencies(
17
+ root: string,
18
+ files: ReadonlyMap<string, string | Buffer>,
19
+ targets: readonly SwiftPackageTarget[],
20
+ nativeTargets: readonly SwiftNativeTarget[],
21
+ producers: ReadonlySet<string>,
22
+ aliases: SwiftHeaderAliases,
23
+ ): Map<string, Set<string>> {
24
+ const headers = new Map<string, Set<string>>()
25
+ for (const file of files.keys())
26
+ if (/\.(?:h|hh|hpp|hxx|inc|inl|ipp|def|modulemap)$/.test(file))
27
+ headers.set(file, new Set())
28
+ const byDirectory = new Map<string, Set<string>>()
29
+ for (const target of targets) {
30
+ const directory = path.resolve(root, target.path)
31
+ const owners = byDirectory.get(directory) ?? new Set()
32
+ owners.add(target.name)
33
+ byDirectory.set(directory, owners)
34
+ }
35
+ const settings = new Map(nativeTargets.map((native) => [native.name, native]))
36
+ const physicalHeaders = new Map(
37
+ Object.entries(aliases).map(([alias, file]) => [
38
+ path.resolve(root, alias),
39
+ path.resolve(root, file),
40
+ ]),
41
+ )
42
+ const lookup = new Map(
43
+ targets.map((target) => {
44
+ const native = settings.get(target.name)
45
+ const directory = path.resolve(root, target.path)
46
+ const inputPrefix = `${SWIFT_NATIVE_INPUT_ROOT}/`
47
+ const flags = native?.importerFlags ?? []
48
+ const search = [
49
+ path.resolve(directory, target.publicHeadersPath ?? 'include'),
50
+ ...(native?.userHeaderSearchPaths ?? []).map((file) => path.resolve(root, file)),
51
+ ...(native?.headerSearchPaths ?? []).map((file) => path.resolve(root, file)),
52
+ ...(target.clangSettings ?? []).flatMap((setting) =>
53
+ 'headerSearchPath' in setting
54
+ ? [path.resolve(directory, setting.headerSearchPath)]
55
+ : [],
56
+ ),
57
+ ...flags.flatMap((flag, index) =>
58
+ (flags[index - 1] === '-I' || flags[index - 1] === '-iquote') &&
59
+ flag.startsWith(inputPrefix)
60
+ ? [path.resolve(root, flag.slice(inputPrefix.length))]
61
+ : [],
62
+ ),
63
+ ]
64
+ const mapped = new Map<string, string[]>()
65
+ const map = (include: string, file: string) => {
66
+ const key = include.toLowerCase()
67
+ const files = mapped.get(key) ?? []
68
+ files.push(path.resolve(root, file))
69
+ mapped.set(key, files)
70
+ }
71
+ for (const headerMap of native?.headerMaps ?? []) {
72
+ for (const [alias, file] of headerMap.entries) {
73
+ if (file.startsWith(inputPrefix)) map(alias, file.slice(inputPrefix.length))
74
+ else {
75
+ const product = native?.productHeaders[file]
76
+ if (product) map(alias, product)
77
+ }
78
+ }
79
+ }
80
+ for (const [alias, file] of Object.entries(native?.productHeaders ?? {}))
81
+ map(alias, file)
82
+ if (native?.flattensPublicHeaders)
83
+ for (const file of native.publicHeaders)
84
+ map(`${target.name}/${path.basename(file)}`, file)
85
+ return [target.name, { search, mapped }] as const
86
+ }),
87
+ )
88
+ const headersByTarget = new Map<string, Set<string>>()
89
+ const ownersOf = (file: string): ReadonlySet<string> => {
90
+ for (let directory = path.dirname(file); ; directory = path.dirname(directory)) {
91
+ const owners = byDirectory.get(directory)
92
+ if (owners) return owners
93
+ if (directory === root || !directory.startsWith(root + path.sep)) break
94
+ }
95
+ return new Set()
96
+ }
97
+ const includers = new Map<string, Set<string>>()
98
+ const enqueue: string[] = []
99
+ for (const [file, edges] of headers) {
100
+ const source = files.get(file)!.toString()
101
+ const owners = ownersOf(file)
102
+ for (const owner of owners) {
103
+ const files = headersByTarget.get(owner) ?? new Set()
104
+ files.add(file)
105
+ headersByTarget.set(owner, files)
106
+ }
107
+ const moduleMap = file.endsWith('.modulemap')
108
+ const tokens = moduleMap ? moduleMapTokens(source) : []
109
+ const includes = moduleMap
110
+ ? tokens.flatMap((token, index) =>
111
+ tokens[index - 1] === 'header' &&
112
+ tokens[index - 2] !== 'exclude' &&
113
+ token.startsWith('"')
114
+ ? [token.slice(1, -1)]
115
+ : [],
116
+ )
117
+ : nativeHeaderIncludes(source)
118
+ for (const include of includes) {
119
+ const producer = /(?:^|\/)([^/]+)-Swift\.h$/.exec(include)?.[1]
120
+ if (producer && producers.has(producer)) edges.add(producer)
121
+ const local = path.resolve(path.dirname(file), include)
122
+ const frameworkHeader =
123
+ moduleMap && /\.framework\/Modules\//.test(file)
124
+ ? ['../Headers', '../PrivateHeaders'].map((directory) =>
125
+ path.resolve(path.dirname(file), directory, include),
126
+ )
127
+ : []
128
+ const searchPaths = [...owners].flatMap((owner) => {
129
+ const { search, mapped } = lookup.get(owner)!
130
+ return [
131
+ ...search.map((directory) => path.resolve(directory, include)),
132
+ ...(mapped.get(include.toLowerCase()) ?? []),
133
+ ]
134
+ })
135
+ for (const qualified of [local, ...frameworkHeader, ...searchPaths]) {
136
+ const candidate = physicalHeaders.get(qualified) ?? qualified
137
+ if (!headers.has(candidate)) continue
138
+ const parents = includers.get(candidate) ?? new Set()
139
+ parents.add(file)
140
+ includers.set(candidate, parents)
141
+ }
142
+ }
143
+ if (edges.size) enqueue.push(file)
144
+ }
145
+ for (let index = 0; index < enqueue.length; index++) {
146
+ const file = enqueue[index]!
147
+ for (const parent of includers.get(file) ?? []) {
148
+ const edges = headers.get(parent)!
149
+ const before = edges.size
150
+ for (const producer of headers.get(file)!) edges.add(producer)
151
+ if (edges.size > before) enqueue.push(parent)
152
+ }
153
+ }
154
+ return new Map(
155
+ targets.map((target) => {
156
+ const native = settings.get(target.name)
157
+ const publicHeaders = [
158
+ ...(native?.headers ?? []),
159
+ ...(native?.publicHeaders ?? []),
160
+ ...Object.values(native?.productHeaders ?? {}),
161
+ ...(native?.bridgingHeader ? [native.bridgingHeader] : []),
162
+ ...(native?.prefixHeader ? [native.prefixHeader] : []),
163
+ ].map((file) => path.resolve(root, file))
164
+ return [
165
+ target.name,
166
+ new Set(
167
+ [...(headersByTarget.get(target.name) ?? []), ...publicHeaders]
168
+ .flatMap((file) => [...(headers.get(file) ?? [])])
169
+ .filter((producer) => producer !== target.name),
170
+ ),
171
+ ]
172
+ }),
173
+ )
174
+ }
@@ -1334,19 +1334,22 @@ async function prepareXcodeNativeInputs(
1334
1334
  [...sources].map(([file, bytes]) => [file, digest(bytes)]),
1335
1335
  )
1336
1336
  // hoisted: the identity keys the resolved intake flags as data, so a flag
1337
- // change rebuilds even when no input file changed. an unparseable minimum
1338
- // records as a marker here; minimumFor still owns the failure below.
1337
+ // change rebuilds even when no input file changed.
1339
1338
  const headers = path.join(sdk.sysroot, 'darwin')
1339
+ const intake = targets.map(({ deploymentTarget }) => {
1340
+ const minimum = iosDeploymentMinimum(deploymentTarget)
1341
+ return minimum === undefined
1342
+ ? undefined
1343
+ : objcSdkIntakeFlags(headers, toolchain.toolchainBin, minimum)
1344
+ })
1340
1345
  const identity = {
1341
1346
  version: 25,
1342
1347
  ...(purpose === 'dependencies' ? { purpose } : {}),
1343
1348
  importer: STANDIN_SOURCE_DIGEST,
1344
- intake: targets.map((target) => {
1345
- const minimum = iosDeploymentMinimum(target.deploymentTarget)
1346
- return minimum === undefined
1347
- ? [`invalid-minimum:${target.deploymentTarget}`]
1348
- : objcSdkIntakeFlags(headers, toolchain.toolchainBin, minimum)
1349
- }),
1349
+ intake: targets.map(
1350
+ ({ deploymentTarget }, index) =>
1351
+ intake[index] ?? [`invalid-minimum:${deploymentTarget}`],
1352
+ ),
1350
1353
  release: toolchain.release,
1351
1354
  compiler: digest(fs.readFileSync(path.join(toolchain.toolchainBin, 'clang'))),
1352
1355
  sdk: swiftModuleSdk(moduleRoot),
@@ -1552,25 +1555,17 @@ async function prepareXcodeNativeInputs(
1552
1555
  throw new SwiftObjCCompilationError(message, receipt)
1553
1556
  }
1554
1557
  save('compiling')
1555
- const minimumFor = (target: {
1556
- name: string
1557
- deploymentTarget: string | null
1558
- }): number => {
1559
- const minimum = iosDeploymentMinimum(target.deploymentTarget)
1560
- if (minimum === undefined) {
1561
- return finish(
1562
- 'unsupported-deployment-target',
1563
- `${target.name}: Objective-C compilation requires an explicit numeric IPHONEOS_DEPLOYMENT_TARGET; received ${JSON.stringify(target.deploymentTarget)}. Inputs: ${receipt}`,
1564
- )
1565
- }
1566
- return minimum
1567
- }
1568
1558
  if (targets.length === 0)
1569
1559
  return finish(
1570
1560
  'missing-target',
1571
1561
  'Objective-C preparation requires an original implementation target',
1572
1562
  )
1573
- const minimums = targets.map(minimumFor)
1563
+ for (const [index, target] of targets.entries())
1564
+ if (!intake[index])
1565
+ finish(
1566
+ 'unsupported-deployment-target',
1567
+ `${target.name}: Objective-C compilation requires an explicit numeric IPHONEOS_DEPLOYMENT_TARGET; received ${JSON.stringify(target.deploymentTarget)}. Inputs: ${receipt}`,
1568
+ )
1574
1569
  // units compile concurrently under the swift build job cap; the receipt
1575
1570
  // and failure report keep source order.
1576
1571
  const units = targets.flatMap((target, index) =>
@@ -1588,7 +1583,6 @@ async function prepareXcodeNativeInputs(
1588
1583
  swiftBuildJobs(),
1589
1584
  async ({ target, index, unit, file }, position) => {
1590
1585
  if (interrupted) return
1591
- const minimum = minimums[index]!
1592
1586
  const output = path.join(work, `${index}-${unit}.o`)
1593
1587
  const log = path.join(work, `${index}-${unit}.log`)
1594
1588
  const cxx = /\.(mm|cc|cpp|cxx)$/.test(file)
@@ -1637,7 +1631,7 @@ async function prepareXcodeNativeInputs(
1637
1631
  '-mllvm',
1638
1632
  '-wasm-enable-sjlj',
1639
1633
  ...(objc ? [...swiftObjCRuntimeFlags, '-fobjc-exceptions'] : []),
1640
- ...objcSdkIntakeFlags(headers, toolchain.toolchainBin, minimum),
1634
+ ...intake[index]!,
1641
1635
  ...headerSearch.flags[index]!,
1642
1636
  ...target.includes.flatMap((include) => ['-I', staged(include)]),
1643
1637
  ...target.frameworks.flatMap((framework) => ['-F', staged(framework)]),
@@ -1615,7 +1615,10 @@ export function wsBridgePlugin(options: { ownedBridgePort?: number } = {}): Plug
1615
1615
  // the native host graph stays outside the config's dependency set.
1616
1616
  // keep jiti's default import interop for commonjs native dependencies.
1617
1617
  const shellPort = { read: readShellPort }
1618
- const host = createJiti(import.meta.url)
1618
+ const jitiCache = fs.existsSync(workspaceNodeModules)
1619
+ ? path.join(workspaceNodeModules, '.cache/jiti')
1620
+ : true
1621
+ const host = createJiti(import.meta.url, { fsCache: jitiCache })
1619
1622
  .import<{ SootSimBridgeHost: typeof SootSimBridgeHost }>(
1620
1623
  fileURLToPath(new URL('./host/bridge-host.ts', import.meta.url)),
1621
1624
  )
@@ -1,65 +0,0 @@
1
- import type { A11yAnnouncementOptions, A11yNodeData } from './protocol.d.ts';
2
- export type AccessibilityHostCommand = {
3
- type: 'create';
4
- } | {
5
- type: 'sync';
6
- version: number;
7
- rows: A11yNodeData[];
8
- active: number | null;
9
- editor: boolean;
10
- } | {
11
- type: 'focus';
12
- nodeId: number;
13
- editor: boolean;
14
- } | {
15
- type: 'announce';
16
- text: string;
17
- options?: A11yAnnouncementOptions;
18
- } | {
19
- type: 'timer';
20
- token: number;
21
- } | {
22
- type: 'clear';
23
- } | {
24
- type: 'retire';
25
- };
26
- export type AccessibilityHostEffect = {
27
- type: 'remove';
28
- nodeId: number;
29
- } | {
30
- type: 'element';
31
- nodeId: number;
32
- tag?: string;
33
- attributes: Record<string, string | null>;
34
- styles: Record<string, string>;
35
- content?: {
36
- type: 'image' | 'input' | 'text';
37
- text: string;
38
- placeholder?: string;
39
- };
40
- input?: A11yNodeData['input'];
41
- isAccessibilityElement?: boolean;
42
- bindInput: boolean;
43
- } | {
44
- type: 'focus';
45
- nodeId: number;
46
- keyboard: boolean;
47
- } | {
48
- type: 'cursor';
49
- nodeId: number | null;
50
- } | {
51
- type: 'live';
52
- text: string;
53
- politeness: 'polite' | 'assertive' | 'unchanged' | null;
54
- } | {
55
- type: 'timer';
56
- token: number;
57
- delay: number;
58
- } | {
59
- type: 'cancel';
60
- };
61
- export interface AccessibilityHostResponse {
62
- handle: number;
63
- effects: AccessibilityHostEffect[];
64
- }
65
- export type AccessibilityHostService = (handle: number, command: AccessibilityHostCommand) => Promise<AccessibilityHostResponse>;