peachsim 0.1.774 → 0.1.775
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.
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1768 -799
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +2136 -1154
- package/dist-lib/swift-compile.cjs +45 -15
- package/dist-lib/swift-compile.mjs +43 -15
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +1382 -413
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/swift-compile.ts +56 -18
- package/src/swift-host.ts +60 -11
- package/src/swift-packages.ts +18 -3
- package/src/swift-standins.ts +546 -0
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.775 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/package.json
CHANGED
package/src/swift-compile.ts
CHANGED
|
@@ -142,13 +142,18 @@ export function swiftModuleInputFiles(root: string): string[] {
|
|
|
142
142
|
// flag reaches the driver but the plugin never loads), so every build loads
|
|
143
143
|
// both with -Xswiftc, as scripts/build.sh does for the fixtures. their
|
|
144
144
|
// sources are under Sources/, which the artifact hash already covers.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
/** the host macro plugin libraries a module root compiles with, and whether a
|
|
146
|
+
* checkout's must be rebuilt (scripts/build-preview-plugin.sh) first. */
|
|
147
|
+
export function swiftMacroPlugins(moduleRoot: string): {
|
|
148
|
+
libraries: string[]
|
|
149
|
+
stale: boolean
|
|
150
|
+
} {
|
|
149
151
|
const distribution = swiftDistributionAt(moduleRoot)
|
|
150
152
|
if (distribution)
|
|
151
|
-
return
|
|
153
|
+
return {
|
|
154
|
+
libraries: distribution.plugins.map((plugin) => path.join(moduleRoot, plugin)),
|
|
155
|
+
stale: false,
|
|
156
|
+
}
|
|
152
157
|
const dir = path.join(moduleRoot, '.build/host/RnxPreviewMacros')
|
|
153
158
|
// linux names a plugin's module from lib<Module>.so
|
|
154
159
|
const ext = process.platform === 'darwin' ? 'dylib' : 'so'
|
|
@@ -162,18 +167,28 @@ async function ensureMacroPlugins(
|
|
|
162
167
|
source: path.join(moduleRoot, 'Sources/FoundationMacros/PredicateMacro.swift'),
|
|
163
168
|
},
|
|
164
169
|
]
|
|
165
|
-
|
|
166
|
-
({ library
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
return {
|
|
171
|
+
libraries: plugins.map(({ library }) => library),
|
|
172
|
+
stale: plugins.some(
|
|
173
|
+
({ library, source }) =>
|
|
174
|
+
!existsSync(library) || statSync(source).mtimeMs > statSync(library).mtimeMs,
|
|
175
|
+
),
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function ensureMacroPlugins(
|
|
180
|
+
moduleRoot: string,
|
|
181
|
+
toolchainBin: string,
|
|
182
|
+
): Promise<string[]> {
|
|
183
|
+
const { libraries, stale } = swiftMacroPlugins(moduleRoot)
|
|
169
184
|
if (stale) {
|
|
170
185
|
await run('sh', [
|
|
171
186
|
path.join(moduleRoot, 'scripts/build-preview-plugin.sh'),
|
|
172
187
|
toolchainBin,
|
|
173
|
-
|
|
188
|
+
libraries[0],
|
|
174
189
|
])
|
|
175
190
|
}
|
|
176
|
-
return
|
|
191
|
+
return libraries
|
|
177
192
|
}
|
|
178
193
|
|
|
179
194
|
const linkedModuleDigests = new Map<string, { stamp: string; digest: Buffer }>()
|
|
@@ -403,6 +418,35 @@ export function swiftPeachModules(moduleRoot: string): string[] {
|
|
|
403
418
|
].map((match) => match[1]!)
|
|
404
419
|
}
|
|
405
420
|
|
|
421
|
+
const sdkPaths = new Map<string, { sysroot: string; resources: string }>()
|
|
422
|
+
|
|
423
|
+
/** the wasm SDK's sysroot and swift resource directory, as swiftpm reads them. */
|
|
424
|
+
export function swiftSdkPaths(
|
|
425
|
+
moduleRoot: string,
|
|
426
|
+
toolchainBin: string,
|
|
427
|
+
): { sysroot: string; resources: string } {
|
|
428
|
+
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId
|
|
429
|
+
const key = `${toolchainBin}\0${sdk}`
|
|
430
|
+
const cached = sdkPaths.get(key)
|
|
431
|
+
if (cached) return cached
|
|
432
|
+
const configuration = execFileSync(
|
|
433
|
+
path.join(toolchainBin, 'swift'),
|
|
434
|
+
['sdk', 'configure', '--show-configuration', sdk, 'wasm32-unknown-wasip1'],
|
|
435
|
+
{ encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] },
|
|
436
|
+
)
|
|
437
|
+
const field = (name: string) => {
|
|
438
|
+
const value = new RegExp(`^${name}:\\s*(.+)$`, 'm').exec(configuration)?.[1]?.trim()
|
|
439
|
+
if (!value) throw new Error(`swift sdk ${sdk} reports no ${name}`)
|
|
440
|
+
return value
|
|
441
|
+
}
|
|
442
|
+
const paths = {
|
|
443
|
+
sysroot: field('sdkRootPath'),
|
|
444
|
+
resources: field('swiftResourcesPath'),
|
|
445
|
+
}
|
|
446
|
+
sdkPaths.set(key, paths)
|
|
447
|
+
return paths
|
|
448
|
+
}
|
|
449
|
+
|
|
406
450
|
const availableModules = new Map<string, Set<string>>()
|
|
407
451
|
|
|
408
452
|
/**
|
|
@@ -418,13 +462,7 @@ export function swiftAvailableModules(
|
|
|
418
462
|
const cached = availableModules.get(key)
|
|
419
463
|
if (cached) return cached
|
|
420
464
|
const modules = new Set(swiftPeachModules(moduleRoot))
|
|
421
|
-
const
|
|
422
|
-
path.join(toolchainBin, 'swift'),
|
|
423
|
-
['sdk', 'configure', '--show-configuration', sdk, 'wasm32-unknown-wasip1'],
|
|
424
|
-
{ encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] },
|
|
425
|
-
)
|
|
426
|
-
const resources = /^swiftResourcesPath:\s*(.+)$/m.exec(configuration)?.[1]?.trim()
|
|
427
|
-
if (!resources) throw new Error(`swift sdk ${sdk} reports no swiftResourcesPath`)
|
|
465
|
+
const { resources } = swiftSdkPaths(moduleRoot, toolchainBin)
|
|
428
466
|
for (const entry of readdirSync(path.join(resources, 'wasi'))) {
|
|
429
467
|
if (entry.endsWith('.swiftmodule'))
|
|
430
468
|
modules.add(entry.slice(0, -'.swiftmodule'.length))
|
package/src/swift-host.ts
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
type SwiftPackageGap,
|
|
34
34
|
type SwiftPackages,
|
|
35
35
|
} from './swift-packages'
|
|
36
|
+
import { swiftStandins, type SwiftStandin } from './swift-standins'
|
|
36
37
|
import {
|
|
37
38
|
MAX_SWIFT_COMPILE_FILES,
|
|
38
39
|
MAX_SWIFT_COMPILE_SOURCE_BYTES,
|
|
@@ -184,7 +185,9 @@ interface XcodeProjectEntry {
|
|
|
184
185
|
target?: string
|
|
185
186
|
/** peach's own modules: a remote product named one links it, never its source. */
|
|
186
187
|
provided: ReadonlySet<string> | null
|
|
187
|
-
|
|
188
|
+
/** the module root a local compile links, which builds binary stand-ins. */
|
|
189
|
+
moduleRoot: string | null
|
|
190
|
+
packages?: { key: string; packages: SwiftPackages; standins: SwiftStandin[] }
|
|
188
191
|
}
|
|
189
192
|
|
|
190
193
|
const xcodeProjects = new Map<string, XcodeProjectEntry>()
|
|
@@ -206,12 +209,16 @@ export function openXcodeProject(
|
|
|
206
209
|
xcodeproj,
|
|
207
210
|
target: app.name,
|
|
208
211
|
provided: moduleRoot ? new Set(swiftPeachModules(moduleRoot)) : null,
|
|
212
|
+
moduleRoot: moduleRoot ?? null,
|
|
209
213
|
})
|
|
210
214
|
return root
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
// packages resolve once per set of linked products, pins and local manifests.
|
|
214
|
-
function swiftPackages(
|
|
218
|
+
function swiftPackages(
|
|
219
|
+
entry: XcodeProjectEntry,
|
|
220
|
+
app: XcodeAppTarget,
|
|
221
|
+
): { packages: SwiftPackages; standins: SwiftStandin[] } {
|
|
215
222
|
const stamp = (file: string | null) =>
|
|
216
223
|
file && fs.existsSync(file) ? fs.statSync(file).mtimeMs : 0
|
|
217
224
|
const key = JSON.stringify([
|
|
@@ -224,18 +231,38 @@ function swiftPackages(entry: XcodeProjectEntry, app: XcodeAppTarget): SwiftPack
|
|
|
224
231
|
),
|
|
225
232
|
])
|
|
226
233
|
if (entry.packages?.key !== key) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
234
|
+
const resolve = (
|
|
235
|
+
provided: ReadonlySet<string> | null,
|
|
236
|
+
binaryGaps?: Map<string, string>,
|
|
237
|
+
) =>
|
|
238
|
+
resolveSwiftPackages({
|
|
230
239
|
rootDir: app.rootDir,
|
|
231
240
|
resolved: app.packageResolved,
|
|
232
241
|
products: app.linkedProducts,
|
|
233
242
|
localDirs: app.localPackageDirs,
|
|
234
|
-
provided
|
|
235
|
-
|
|
243
|
+
provided,
|
|
244
|
+
binaryGaps,
|
|
245
|
+
})
|
|
246
|
+
let packages = resolve(entry.provided)
|
|
247
|
+
let standins: SwiftStandin[] = []
|
|
248
|
+
// a reached binary target with stand-ins for every module it ships
|
|
249
|
+
// resolves as provided, so what depends on it compiles; the rest keep
|
|
250
|
+
// their reason with why no stand-in was built
|
|
251
|
+
const reached = packages.binaries.filter((binary) => binary.reached)
|
|
252
|
+
if (entry.moduleRoot && entry.provided && reached.length > 0) {
|
|
253
|
+
const built = swiftStandins(reached, {
|
|
254
|
+
moduleRoot: entry.moduleRoot,
|
|
255
|
+
toolchainBin: swiftModuleToolchain(entry.moduleRoot).toolchainBin,
|
|
256
|
+
})
|
|
257
|
+
standins = built.standins
|
|
258
|
+
packages = resolve(
|
|
259
|
+
new Set([...entry.provided, ...standins.map((standin) => standin.target)]),
|
|
260
|
+
built.gaps,
|
|
261
|
+
)
|
|
236
262
|
}
|
|
263
|
+
entry.packages = { key, packages, standins }
|
|
237
264
|
}
|
|
238
|
-
return entry.packages
|
|
265
|
+
return entry.packages
|
|
239
266
|
}
|
|
240
267
|
|
|
241
268
|
// the app target's sources compile as one executable target under this
|
|
@@ -248,6 +275,9 @@ const XCODE_FRAMEWORKS_DIR = '__frameworks__'
|
|
|
248
275
|
// remote package checkouts compile here: swiftpm owns `.build` in the
|
|
249
276
|
// compile's package root as its scratch directory.
|
|
250
277
|
const XCODE_PACKAGES_DIR = '__packages__'
|
|
278
|
+
// each binary target's stand-in compiles as a target under its module's
|
|
279
|
+
// directory here, from sources generated on this host.
|
|
280
|
+
const XCODE_STANDINS_DIR = '__standins__'
|
|
251
281
|
const CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(path.sep).join(path.posix.sep)}/`
|
|
252
282
|
|
|
253
283
|
// the compile input key of a root-relative path in an xcode layout.
|
|
@@ -264,6 +294,7 @@ interface XcodeLayout {
|
|
|
264
294
|
/** framework and package targets, with root-relative paths and the nested target directories they exclude. */
|
|
265
295
|
targets: (SwiftPackageTarget & { exclude: string[] })[]
|
|
266
296
|
packages: SwiftPackages
|
|
297
|
+
standins: SwiftStandin[]
|
|
267
298
|
/** the input directory each app and framework source compiles under. */
|
|
268
299
|
targetDirs: Map<string, string>
|
|
269
300
|
files: string[]
|
|
@@ -294,7 +325,17 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
294
325
|
mainActorIsolation: framework.mainActorIsolation,
|
|
295
326
|
})
|
|
296
327
|
}
|
|
297
|
-
const packages = swiftPackages(registered, app)
|
|
328
|
+
const { packages, standins } = swiftPackages(registered, app)
|
|
329
|
+
for (const standin of standins)
|
|
330
|
+
targets.push({
|
|
331
|
+
name: standin.module,
|
|
332
|
+
path: path.posix.join(XCODE_STANDINS_DIR, standin.module),
|
|
333
|
+
executable: false,
|
|
334
|
+
resources: false,
|
|
335
|
+
exclude: [],
|
|
336
|
+
languageMode: 5,
|
|
337
|
+
mainActorIsolation: false,
|
|
338
|
+
})
|
|
298
339
|
for (const target of packages.targets) {
|
|
299
340
|
const relative = path.relative(
|
|
300
341
|
target.remote ? path.join(root, REMOTE_CHECKOUTS) : root,
|
|
@@ -326,6 +367,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
326
367
|
app,
|
|
327
368
|
targets,
|
|
328
369
|
packages,
|
|
370
|
+
standins,
|
|
329
371
|
targetDirs,
|
|
330
372
|
files: [...files].sort(),
|
|
331
373
|
}
|
|
@@ -730,7 +772,12 @@ function packageSources(packagePath: string): Record<string, string> {
|
|
|
730
772
|
MAX_SWIFT_COMPILE_SOURCE_BYTES,
|
|
731
773
|
).toString('utf8')
|
|
732
774
|
}
|
|
733
|
-
if (xcode)
|
|
775
|
+
if (xcode) {
|
|
776
|
+
files['Package.swift'] = xcodeManifest(xcode)
|
|
777
|
+
for (const standin of xcode.standins)
|
|
778
|
+
for (const [file, text] of Object.entries(standin.files))
|
|
779
|
+
files[path.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text
|
|
780
|
+
}
|
|
734
781
|
return files
|
|
735
782
|
}
|
|
736
783
|
|
|
@@ -1000,7 +1047,9 @@ async function missingModulesMessage(
|
|
|
1000
1047
|
if (packaged.has(name))
|
|
1001
1048
|
gaps.set(name, {
|
|
1002
1049
|
source: binary.source,
|
|
1003
|
-
reason:
|
|
1050
|
+
reason:
|
|
1051
|
+
layout?.packages.modules.get(binary.target)?.reason ??
|
|
1052
|
+
`${binary.target} is a binary framework`,
|
|
1004
1053
|
})
|
|
1005
1054
|
}),
|
|
1006
1055
|
)
|
package/src/swift-packages.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
// (swift-package-manifest.ts) to the source targets that build it; remote
|
|
4
4
|
// packages are fetched at the revision the app's Package.resolved pins, into
|
|
5
5
|
// .build/peach/checkouts under the app's root. peach compiles swift source
|
|
6
|
-
// only, so a target reaching a
|
|
7
|
-
//
|
|
6
|
+
// only, so a target reaching a c-family target, or a binary target the host
|
|
7
|
+
// built no stand-in for (swift-standins.ts), stays missing, with the reason;
|
|
8
|
+
// the targets beside it still compile.
|
|
8
9
|
|
|
9
10
|
import { execFileSync } from 'node:child_process'
|
|
10
11
|
import fs from 'node:fs'
|
|
@@ -65,6 +66,8 @@ export interface SwiftPackageBinary {
|
|
|
65
66
|
/** the archive url, or null for a local artifact at `dir`. */
|
|
66
67
|
url: string | null
|
|
67
68
|
dir: string
|
|
69
|
+
/** a linked product's closure reaches it, so the app links it. */
|
|
70
|
+
reached: boolean
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
/** where checkouts live, relative to the app's root. */
|
|
@@ -164,6 +167,8 @@ export function resolveSwiftPackages(options: {
|
|
|
164
167
|
/** local package directories the workspace or a project references. */
|
|
165
168
|
localDirs: readonly string[]
|
|
166
169
|
provided: ReadonlySet<string> | null
|
|
170
|
+
/** why a binary target has no stand-in, added to its reason. */
|
|
171
|
+
binaryGaps?: ReadonlyMap<string, string>
|
|
167
172
|
}): SwiftPackages {
|
|
168
173
|
const { rootDir, resolved, products, localDirs } = options
|
|
169
174
|
const provided = options.provided ?? new Set<string>()
|
|
@@ -219,7 +224,10 @@ export function resolveSwiftPackages(options: {
|
|
|
219
224
|
if (provided.has(name)) return null
|
|
220
225
|
const target = pkg.manifest.targets.get(name)
|
|
221
226
|
if (!target) return `${path.basename(pkg.manifest.dir)} declares no target ${name}`
|
|
222
|
-
if (target.type === 'binary')
|
|
227
|
+
if (target.type === 'binary') {
|
|
228
|
+
const gap = options.binaryGaps?.get(name)
|
|
229
|
+
return `${name} ${BINARY}${gap ? `; ${gap}` : ''}`
|
|
230
|
+
}
|
|
223
231
|
if (target.type === 'system') return `${name} is a system C library`
|
|
224
232
|
if (target.type !== 'regular') return `${name} is a ${target.type} target`
|
|
225
233
|
const files = swiftTargetFiles(pkg.manifest, target)
|
|
@@ -329,6 +337,7 @@ export function resolveSwiftPackages(options: {
|
|
|
329
337
|
source: pkg.source,
|
|
330
338
|
url: target.url,
|
|
331
339
|
dir: target.dir,
|
|
340
|
+
reached: false,
|
|
332
341
|
})
|
|
333
342
|
const reason = resolveTarget(pkg, name)
|
|
334
343
|
if (reason && !result.modules.has(name))
|
|
@@ -373,6 +382,12 @@ export function resolveSwiftPackages(options: {
|
|
|
373
382
|
if (!pkg || typeof pkg === 'string') continue
|
|
374
383
|
for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root)
|
|
375
384
|
}
|
|
385
|
+
// a package's source is its key among the loaded packages
|
|
386
|
+
for (const binary of result.binaries) {
|
|
387
|
+
const pkg = packages.get(binary.source)
|
|
388
|
+
if (pkg && typeof pkg !== 'string')
|
|
389
|
+
binary.reached = reached.has(`${pkg.manifest.dir}\0${binary.target}`)
|
|
390
|
+
}
|
|
376
391
|
result.targets = [...targets.entries()]
|
|
377
392
|
.filter(([key]) => reached.has(key))
|
|
378
393
|
.map(([, target]) => target)
|