peachsim 0.1.2247 → 0.1.2249
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/bin.ts +5 -0
- package/cli/bridge-flow-runner.ts +28 -2
- package/cli/cloud-dispatch.ts +2 -0
- package/cli/commands/control.ts +2 -2
- package/cli/commands/coverage-swift.ts +3 -3
- package/cli/commands/inspect/settling.ts +35 -4
- package/cli/commands/shell-url.ts +6 -0
- package/cli/commands/skills.ts +6 -3
- package/cli/drivers/playwright.ts +2 -0
- package/dist-lib/agent-daemon-client.cjs +1 -29
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -10
- 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/bundle-channel.cjs +4300 -4531
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +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/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +32 -315
- package/dist-lib/dev-bundle-resolution.cjs +1 -12
- package/dist-lib/expo-swift-bundle.cjs +3579 -3864
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +4376 -4682
- package/dist-lib/host/fetch-proxy-handler.cjs +97 -713
- 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 +669 -1116
- 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 +3 -24
- 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 -10
- package/dist-lib/metro-production-bundle.mjs +1 -12
- package/dist-lib/metro.cjs +546 -975
- package/dist-lib/native-app-identity-project.cjs +299 -592
- package/dist-lib/native-app-identity-project.mjs +11 -232
- 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/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.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/public-origins-lib-esm.json +28 -96
- package/dist-lib/public-origins-lib.json +172 -1058
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -34
- package/dist-lib/sdk.cjs +31 -7
- package/dist-lib/sdk.mjs +31 -7
- package/dist-lib/skills.cjs +4960 -5345
- package/dist-lib/swift-compile.cjs +1185 -1107
- package/dist-lib/swift-compile.mjs +137 -54
- 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 +1568 -1672
- package/dist-lib/vite.cjs +173 -763
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/render-worker/webview-capture-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/settings/duo-fold-bus.d.ts +10 -2
- package/dist-types/packages/peach-globals/src/globalsContract.d.ts +5 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/wasm/include/math.h +1 -1
- package/sdk/ios/wasm/include/pthread.h +1 -1
- package/src/assetCatalogContract.ts +6 -0
- package/src/kotlin-module.ts +3 -3
- package/src/sfSymbolMetricsContract.ts +73 -37
- package/src/swift-compile.ts +99 -7
- package/src/swift-coverage/provenance.ts +4 -4
- package/src/swift-guest-image-ledger.ts +10 -5
- package/src/swift-guest-link.ts +20 -14
- package/src/swift-objc-sdk.ts +34 -21
- package/src/swift-objc-standin.ts +7 -7
- package/src/swift-standins.ts +11 -8
- package/src/swift-wasm-prune.ts +30 -0
package/src/swift-objc-sdk.ts
CHANGED
|
@@ -11,34 +11,47 @@ import path from 'node:path'
|
|
|
11
11
|
import { readIosSdkTree } from './swift-objc-sdk-tree'
|
|
12
12
|
import { peachsimPackageRoot } from './swift-toolchain'
|
|
13
13
|
|
|
14
|
-
declare const __PEACH_BUNDLED_IOS_SDK__:
|
|
14
|
+
declare const __PEACH_BUNDLED_IOS_SDK__: string
|
|
15
15
|
|
|
16
16
|
export const IOS_SDK_TARGET = 'arm64-apple-ios16.0-simulator'
|
|
17
17
|
|
|
18
18
|
const OVERLAY_PATH =
|
|
19
19
|
/^usr\/lib\/swift\/([^/]+)\.swiftmodule\/arm64-apple-ios-simulator\.swiftinterface$/
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** the clang headers and module maps, by path under the sdk root. */
|
|
29
|
-
export const IOS_SDK_HEADERS: Record<string, string> = {}
|
|
21
|
+
export interface IosSdk {
|
|
22
|
+
/** the clang headers and module maps, by path under the sdk root. */
|
|
23
|
+
headers: Record<string, string>
|
|
24
|
+
/** the swift overlays of the clang modules above, by module name. */
|
|
25
|
+
overlays: Record<string, string>
|
|
26
|
+
}
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
export const IOS_SDK_OVERLAYS: Record<string, string> = {}
|
|
28
|
+
let sdk: IosSdk | undefined
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
// the tree is read from the package's sdk directory, which sits beside src and
|
|
31
|
+
// every dist directory; the standalone executable embeds it at build time. it is
|
|
32
|
+
// 34 MB, so only a command that compiles against it reads it.
|
|
33
|
+
export function iosSdk(): IosSdk {
|
|
34
|
+
if (sdk) return sdk
|
|
35
|
+
const bundled: Record<string, string> | null =
|
|
36
|
+
typeof __PEACH_BUNDLED_IOS_SDK__ === 'undefined'
|
|
37
|
+
? null
|
|
38
|
+
: JSON.parse(__PEACH_BUNDLED_IOS_SDK__)
|
|
39
|
+
const tree = bundled
|
|
40
|
+
? Object.entries(bundled).sort(([a], [b]) => (a < b ? -1 : 1))
|
|
41
|
+
: readIosSdkTree(path.join(peachsimPackageRoot(), 'sdk', 'ios'))
|
|
42
|
+
const headers: Record<string, string> = {}
|
|
43
|
+
const overlays: Record<string, string> = {}
|
|
44
|
+
for (const [file, text] of tree) {
|
|
45
|
+
const module = OVERLAY_PATH.exec(file)?.[1]
|
|
46
|
+
if (module === undefined) {
|
|
47
|
+
headers[file] = text
|
|
48
|
+
continue
|
|
49
|
+
}
|
|
50
|
+
const header = `// swift-interface-format-version: 1.0\n// swift-module-flags: -target ${IOS_SDK_TARGET} -enable-objc-interop -enable-library-evolution -module-name ${module}\n`
|
|
51
|
+
if (!text.startsWith(header))
|
|
52
|
+
throw new Error(`sdk overlay ${file} has the wrong interface header`)
|
|
53
|
+
overlays[module] = text.slice(header.length)
|
|
39
54
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
throw new Error(`sdk overlay ${file} has the wrong interface header`)
|
|
43
|
-
IOS_SDK_OVERLAYS[module] = text.slice(header.length)
|
|
55
|
+
sdk = { headers, overlays }
|
|
56
|
+
return sdk
|
|
44
57
|
}
|
|
@@ -21,7 +21,7 @@ import path from 'node:path'
|
|
|
21
21
|
import { isRecord } from './is-record'
|
|
22
22
|
import { swiftInterfaceWithoutBodies } from './swift-interface-bodies'
|
|
23
23
|
import { swiftObjCPlatformFlags } from './swift-objc-platform'
|
|
24
|
-
import {
|
|
24
|
+
import { IOS_SDK_TARGET, iosSdk } from './swift-objc-sdk'
|
|
25
25
|
import { clangImportNames, moduleMapTokens } from './swift-package'
|
|
26
26
|
import {
|
|
27
27
|
objcProtocolsInSwiftSignatures,
|
|
@@ -246,14 +246,14 @@ export function stripExternalSourceMarks(text: string): string {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
function iosSdkEntries(): (readonly [string, string])[] {
|
|
249
|
-
const overlays = Object.entries(
|
|
249
|
+
const overlays = Object.entries(iosSdk().overlays).map(
|
|
250
250
|
([module, text]) =>
|
|
251
251
|
[
|
|
252
252
|
`usr/lib/swift/${module}.swiftmodule/arm64-apple-ios-simulator.swiftinterface`,
|
|
253
253
|
`// swift-interface-format-version: 1.0\n// swift-module-flags: -target ${IOS_SDK_TARGET} -enable-objc-interop -enable-library-evolution -module-name ${module}\n${text}`,
|
|
254
254
|
] as const,
|
|
255
255
|
)
|
|
256
|
-
const headers = Object.entries(
|
|
256
|
+
const headers = Object.entries(iosSdk().headers).map(
|
|
257
257
|
([file, text]) => [file, stripExternalSourceMarks(text)] as const,
|
|
258
258
|
)
|
|
259
259
|
return [...headers, ...overlays].sort(([a], [b]) => (a < b ? -1 : 1))
|
|
@@ -430,7 +430,7 @@ let sdkDeclarations: Map<string, SdkDeclaration> | null = null
|
|
|
430
430
|
function sdkDeclaration(name: string): SdkDeclaration | null {
|
|
431
431
|
if (sdkDeclarations === null) {
|
|
432
432
|
const umbrellas = new Map<string, string>()
|
|
433
|
-
for (const [file, text] of Object.entries(
|
|
433
|
+
for (const [file, text] of Object.entries(iosSdk().headers)) {
|
|
434
434
|
const modulemap = FRAMEWORK_MODULEMAP.exec(file)
|
|
435
435
|
if (!modulemap) continue
|
|
436
436
|
const header = /umbrella header "([^"]+)"/.exec(text)?.[1]
|
|
@@ -441,7 +441,7 @@ function sdkDeclaration(name: string): SdkDeclaration | null {
|
|
|
441
441
|
if (!found.has(name))
|
|
442
442
|
found.set(name, { module, header: umbrellas.get(module) ?? header })
|
|
443
443
|
}
|
|
444
|
-
for (const [file, text] of Object.entries(
|
|
444
|
+
for (const [file, text] of Object.entries(iosSdk().headers)) {
|
|
445
445
|
const location = FRAMEWORK_HEADER.exec(file)
|
|
446
446
|
if (!location) continue
|
|
447
447
|
const [, module, header] = location
|
|
@@ -693,7 +693,7 @@ export function objcView(
|
|
|
693
693
|
const umbrella = `${name}/${name}.h`
|
|
694
694
|
if (
|
|
695
695
|
Object.hasOwn(
|
|
696
|
-
|
|
696
|
+
iosSdk().headers,
|
|
697
697
|
`System/Library/Frameworks/${name}.framework/Headers/${name}.h`,
|
|
698
698
|
)
|
|
699
699
|
) {
|
|
@@ -729,7 +729,7 @@ export function objcView(
|
|
|
729
729
|
// standard library names, since `Swift.Duration` also searches it.
|
|
730
730
|
const stubModule = (name: string, swift: boolean): boolean => {
|
|
731
731
|
const sdk = Object.hasOwn(
|
|
732
|
-
|
|
732
|
+
iosSdk().headers,
|
|
733
733
|
`System/Library/Frameworks/${name}.framework/Headers/${name}.h`,
|
|
734
734
|
)
|
|
735
735
|
if (!sdk && !swift) return stub(`${name}/${name}.h`, true)
|
package/src/swift-standins.ts
CHANGED
|
@@ -137,12 +137,14 @@ function failure(error: unknown): string {
|
|
|
137
137
|
const output =
|
|
138
138
|
error && typeof error === 'object' && 'stderr' in error
|
|
139
139
|
? `${String(error.stderr)}\n${'stdout' in error ? String(error.stdout) : ''}`
|
|
140
|
-
:
|
|
140
|
+
: error instanceof Error
|
|
141
|
+
? error.message
|
|
142
|
+
: String(error)
|
|
141
143
|
const errors = output
|
|
142
144
|
.split('\n')
|
|
143
|
-
.filter((line) =>
|
|
144
|
-
.map((line) => line.replace(
|
|
145
|
-
return [...new Set(errors)].slice(0, 3).join('; ') || output.trim().slice(
|
|
145
|
+
.filter((line) => /^(\S.*?:\d+:\d+: )?error:/.test(line))
|
|
146
|
+
.map((line) => line.replace(/^(.*?:\d+:\d+: )?error:\s*/, '').trim())
|
|
147
|
+
return [...new Set(errors)].slice(0, 3).join('; ') || output.trim().slice(-600)
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
const key = (...parts: string[]) =>
|
|
@@ -867,6 +869,8 @@ function peachModuleDirs(
|
|
|
867
869
|
target,
|
|
868
870
|
'-Xswiftc',
|
|
869
871
|
'-Osize',
|
|
872
|
+
'-Xswiftc',
|
|
873
|
+
'-gnone',
|
|
870
874
|
...plugins.libraries.flatMap((library) => [
|
|
871
875
|
'-Xswiftc',
|
|
872
876
|
'-load-plugin-library',
|
|
@@ -3036,10 +3040,9 @@ async function binaryStandins(
|
|
|
3036
3040
|
: cStandin(surface, binary, toolchain, dir),
|
|
3037
3041
|
)
|
|
3038
3042
|
} catch (error) {
|
|
3039
|
-
throw new Error(
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
)
|
|
3043
|
+
throw new Error(`no stand-in for ${surface.module}: ${failure(error)}`, {
|
|
3044
|
+
cause: error,
|
|
3045
|
+
})
|
|
3043
3046
|
}
|
|
3044
3047
|
}
|
|
3045
3048
|
publish(result)
|
package/src/swift-wasm-prune.ts
CHANGED
|
@@ -193,6 +193,8 @@ interface ParsedObject {
|
|
|
193
193
|
typePrefixesInObj: Set<string>
|
|
194
194
|
rootFuncs: number[]
|
|
195
195
|
rootSegs: number[]
|
|
196
|
+
/** absolute file offsets of each data segment's payload. */
|
|
197
|
+
segPayloadRanges: [number, number][]
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
const parsedObjectCache = new Map<string, ParsedObject>()
|
|
@@ -787,6 +789,10 @@ function parseWasmObjectBytes(
|
|
|
787
789
|
typePrefixesInObj,
|
|
788
790
|
rootFuncs,
|
|
789
791
|
rootSegs,
|
|
792
|
+
segPayloadRanges: sEnds.map((end, i) => [
|
|
793
|
+
dataStart + sPayloadStarts[i]!,
|
|
794
|
+
dataStart + end,
|
|
795
|
+
]),
|
|
790
796
|
}
|
|
791
797
|
}
|
|
792
798
|
|
|
@@ -1744,9 +1750,33 @@ export function pruneSwiftWasmLink(
|
|
|
1744
1750
|
'$s10Foundation16NSSortDescriptorC7keyPath9ascendingACs03KeyE0Cyxq_G_SbtcSLR_r0_lufc',
|
|
1745
1751
|
])
|
|
1746
1752
|
|
|
1753
|
+
// the runtime resolves a clang-imported class named in a mangled type name,
|
|
1754
|
+
// such as the argument of Outcome<AVTimedMetadataGroup>, by objc_getClass
|
|
1755
|
+
// alone: no relocation reaches the class, so a live name keeps its provider.
|
|
1756
|
+
const objectBytes = new Map<ParsedObject, Buffer>()
|
|
1757
|
+
const keepObjCClassesNamedInSegment = (obj: ParsedObject, segIdx: number) => {
|
|
1758
|
+
const range = obj.segPayloadRanges[segIdx]
|
|
1759
|
+
if (!range) return
|
|
1760
|
+
let bytes = objectBytes.get(obj)
|
|
1761
|
+
if (!bytes) objectBytes.set(obj, (bytes = fs.readFileSync(obj.file)))
|
|
1762
|
+
const text = bytes.toString('latin1', range[0], range[1])
|
|
1763
|
+
for (const match of text.matchAll(/So(\d+)/g)) {
|
|
1764
|
+
const start = match.index + 2 + match[1]!.length
|
|
1765
|
+
const length = Number(match[1])
|
|
1766
|
+
if (text[start + length] !== 'C') continue
|
|
1767
|
+
const symbol = `._OBJC_CLASS_${text.slice(start, start + length)}`
|
|
1768
|
+
for (const provider of lazyProviders.get(symbol) ?? []) {
|
|
1769
|
+
eagerDynamicObjects.add(provider)
|
|
1770
|
+
extractObject(provider)
|
|
1771
|
+
activateSymbolInObj(provider, provider.symNames.indexOf(symbol))
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1747
1776
|
while (workQueue.length > 0) {
|
|
1748
1777
|
const item = workQueue.pop()!
|
|
1749
1778
|
const obj = item.obj
|
|
1779
|
+
if (item.kind === 'seg') keepObjCClassesNamedInSegment(obj, item.idx)
|
|
1750
1780
|
let relocs: number[]
|
|
1751
1781
|
if (item.kind === 'func') {
|
|
1752
1782
|
relocs = obj.funcRelocs[item.idx]!
|