peachsim 0.1.678 → 0.1.680
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/cli/commands/daemon-mac-app.ts +11 -2
- package/cli/commands/daemon.ts +2 -3
- package/cli/commands/swift.ts +40 -19
- package/cli/outbound-endpoints.ts +8 -0
- 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 +2542 -2313
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- 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 +2293 -2042
- package/dist-lib/swift-compile.cjs +78 -12
- package/dist-lib/swift-compile.mjs +76 -12
- 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 +115 -0
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +470 -149
- package/dist-lib/vite.cjs +1 -1
- package/package.json +7 -1
- package/skills/contrast/SKILL.md +1 -1
- package/src/assetCatalogContract.ts +18 -0
- package/src/expo-swift-host.ts +9 -13
- package/src/host/fetch-proxy-handler.ts +10 -3
- package/src/swift-compile.ts +76 -10
- package/src/swift-distribution-contract.ts +138 -0
- package/src/swift-distribution.lock.json +20 -0
- package/src/swift-distribution.ts +108 -0
- package/src/swift-host.ts +8 -30
- package/src/swift-toolchain.ts +102 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// the one place that finds the swift.org toolchain app Swift compiles with.
|
|
2
|
+
// a binary .swiftmodule loads only in the compiler release that wrote it, so
|
|
3
|
+
// every caller names the release from packages/sootsim-swift/toolchain.json
|
|
4
|
+
// or the Swift distribution's lock (docs/swift-distribution.md).
|
|
5
|
+
//
|
|
6
|
+
// node builtins only: packages/sootsim-swift/scripts/build.sh imports this
|
|
7
|
+
// file straight from a checkout, with no install.
|
|
8
|
+
import { execFileSync } from 'node:child_process'
|
|
9
|
+
import fs from 'node:fs'
|
|
10
|
+
import os from 'node:os'
|
|
11
|
+
import path from 'node:path'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* the bin directory of the toolchain for `release`, unverified. macOS: the
|
|
15
|
+
* Xcode Toolchains directory, the user's before the system's. Linux: a
|
|
16
|
+
* builder's `$CONTRAST_SWIFT_TOOLCHAINS/<release>`
|
|
17
|
+
* (packages/sootsim-swift/scripts/install-linux-toolchain.sh fills it), else
|
|
18
|
+
* the cf-build image's `/opt/swift/<release>`, else the `swift` first on PATH.
|
|
19
|
+
*/
|
|
20
|
+
export function swiftToolchainBin(release: string): string {
|
|
21
|
+
if (process.platform === 'darwin') {
|
|
22
|
+
const dirs = [os.homedir(), '/'].map((base) =>
|
|
23
|
+
path.join(base, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`),
|
|
24
|
+
)
|
|
25
|
+
return dirs.find((dir) => fs.existsSync(path.join(dir, 'swift'))) ?? dirs[0]!
|
|
26
|
+
}
|
|
27
|
+
if (process.env.CONTRAST_SWIFT_TOOLCHAINS) {
|
|
28
|
+
return path.join(process.env.CONTRAST_SWIFT_TOOLCHAINS, release, 'usr/bin')
|
|
29
|
+
}
|
|
30
|
+
const image = path.join('/opt/swift', release, 'usr/bin')
|
|
31
|
+
if (fs.existsSync(path.join(image, 'swift'))) return image
|
|
32
|
+
return (
|
|
33
|
+
(process.env.PATH ?? '')
|
|
34
|
+
.split(path.delimiter)
|
|
35
|
+
.find((dir) => dir && fs.existsSync(path.join(dir, 'swift'))) ?? image
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const verified = new Map<string, string>()
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* swiftToolchainBin, checked: its swift is exactly `release` and has the
|
|
43
|
+
* `<release>_wasm` SDK. anything else fails with one message naming the
|
|
44
|
+
* release and the commands that install it.
|
|
45
|
+
*/
|
|
46
|
+
export function swiftToolchain(release: string, wasmSdkChecksum: string): string {
|
|
47
|
+
const cached = verified.get(release)
|
|
48
|
+
if (cached) return cached
|
|
49
|
+
const bin = swiftToolchainBin(release)
|
|
50
|
+
const swift = path.join(bin, 'swift')
|
|
51
|
+
const version = fs.existsSync(swift)
|
|
52
|
+
? execFileSync(swift, ['--version'], {
|
|
53
|
+
encoding: 'utf8',
|
|
54
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
55
|
+
})
|
|
56
|
+
: ''
|
|
57
|
+
if (!version.includes(`(${release})`)) {
|
|
58
|
+
const found = version
|
|
59
|
+
? `found ${version.split('\n')[0]?.trim()} at ${swift}`
|
|
60
|
+
: process.platform === 'darwin'
|
|
61
|
+
? `found no ${release}.xctoolchain in ~/Library/Developer/Toolchains or /Library/Developer/Toolchains`
|
|
62
|
+
: 'found no swift on PATH'
|
|
63
|
+
throw new Error(
|
|
64
|
+
`peach compiles Swift with the swift.org toolchain ${release} and its wasm SDK; ${found}.\n${swiftInstallSteps(release, wasmSdkChecksum)}`,
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
const sdks = execFileSync(swift, ['sdk', 'list'], {
|
|
68
|
+
encoding: 'utf8',
|
|
69
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
70
|
+
})
|
|
71
|
+
if (!sdks.split('\n').some((line) => line.trim() === `${release}_wasm`)) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`peach compiles Swift with the ${release}_wasm SDK, which ${swift} does not have.\n${swiftInstallSteps(release, wasmSdkChecksum)}`,
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
verified.set(release, bin)
|
|
77
|
+
return bin
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** the commands that install `release` and its wasm SDK on this host. */
|
|
81
|
+
export function swiftInstallSteps(release: string, wasmSdkChecksum: string): string {
|
|
82
|
+
const version = release.replace(/^swift-/, '').toLowerCase()
|
|
83
|
+
const downloads = `https://download.swift.org/swift-${version}`
|
|
84
|
+
const sdk = `swift sdk install ${downloads}/wasm-sdk/${release}/${release}_wasm.artifactbundle.tar.gz --checksum ${wasmSdkChecksum}`
|
|
85
|
+
if (process.platform === 'darwin') {
|
|
86
|
+
const swift = `~/Library/Developer/Toolchains/${release}.xctoolchain/usr/bin/swift`
|
|
87
|
+
return [
|
|
88
|
+
'install it:',
|
|
89
|
+
` curl -fsSLO ${downloads}/xcode/${release}/${release}-osx.pkg`,
|
|
90
|
+
` installer -pkg ${release}-osx.pkg -target CurrentUserHomeDirectory`,
|
|
91
|
+
` ${swift} ${sdk.replace(/^swift /, '')}`,
|
|
92
|
+
].join('\n')
|
|
93
|
+
}
|
|
94
|
+
const platform = `debian12${process.arch === 'arm64' ? '-aarch64' : ''}`
|
|
95
|
+
const name = `${release}-${platform}`
|
|
96
|
+
return [
|
|
97
|
+
'install it (Debian 12 shown; other distributions: https://www.swift.org/install/linux/):',
|
|
98
|
+
` curl -fsSL ${downloads}/${platform}/${release}/${name}.tar.gz | tar -xz -C /opt`,
|
|
99
|
+
` export PATH=/opt/${name}/usr/bin:$PATH`,
|
|
100
|
+
` ${sdk}`,
|
|
101
|
+
].join('\n')
|
|
102
|
+
}
|