peachsim 0.1.2423 → 0.1.2426
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/outbound-endpoints.ts +138 -23
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.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/bundle-channel.cjs +122 -29
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +121 -28
- 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 +122 -29
- 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 +24 -9
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +22 -7
- 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 +24 -9
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- 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 +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- 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 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +140 -40
- package/dist-lib/swift-compile.cjs +87 -15
- package/dist-lib/swift-compile.mjs +87 -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 +97 -19
- package/dist-lib/vite.cjs +24 -9
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/svg-native.d.ts +60 -0
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +1 -0
- package/kotlin/README.md +4 -3
- package/kotlin/sdk.tar.gz +0 -0
- package/kotlin/toolchain.json +2 -2
- package/package.json +1 -1
- package/src/native-static-libraries.ts +2 -1
- package/src/swift-compile.ts +1 -0
- package/src/swift-guest-compile.ts +2 -0
- package/src/swift-guest-image-ledger.ts +37 -2
- package/src/swift-guest-source-inputs.ts +45 -6
- package/src/swift-standin-builtin-behavior.ts +3 -0
- package/src/swift-standin-emit.ts +10 -1
- package/src/visit-parsed-program.ts +21 -6
|
@@ -373,6 +373,7 @@ function isRustSymbol(name: string, demangled: string): boolean {
|
|
|
373
373
|
((name.startsWith('_R') || /^_ZN.*17h[0-9a-f]{16}E$/.test(name)) &&
|
|
374
374
|
demangled !== name) ||
|
|
375
375
|
name === 'rust_eh_personality' ||
|
|
376
|
+
name === '__getrandom_custom' ||
|
|
376
377
|
name === '__getrandom_v03_custom'
|
|
377
378
|
)
|
|
378
379
|
}
|
|
@@ -380,7 +381,7 @@ function isRustSymbol(name: string, demangled: string): boolean {
|
|
|
380
381
|
export function rustStaticLibrary(file: string, moduleRoot: string): string {
|
|
381
382
|
const toolchain = swiftModuleToolchain(moduleRoot)
|
|
382
383
|
const key = createHash('sha256')
|
|
383
|
-
.update('rust-c-abi-
|
|
384
|
+
.update('rust-c-abi-v3\0')
|
|
384
385
|
.update(toolchain.release)
|
|
385
386
|
.update('\0')
|
|
386
387
|
.update(fs.readFileSync(file))
|
package/src/swift-compile.ts
CHANGED
|
@@ -64,6 +64,7 @@ export async function compileGuestLink(options: {
|
|
|
64
64
|
readonly output: string
|
|
65
65
|
readonly optimized: string
|
|
66
66
|
readonly optimize: boolean
|
|
67
|
+
readonly jobs: number
|
|
67
68
|
}): Promise<void> {
|
|
68
69
|
const directory = path.join(options.buildDirectory, '.peach-guest-link')
|
|
69
70
|
mkdirSync(directory, { recursive: true })
|
|
@@ -266,6 +267,7 @@ export async function compileGuestLink(options: {
|
|
|
266
267
|
toolchainBin: options.toolchainBin,
|
|
267
268
|
swiftCompiler: options.swiftCompiler,
|
|
268
269
|
objects: selectedSource.map((artifact) => artifact.path),
|
|
270
|
+
jobs: options.jobs,
|
|
269
271
|
})
|
|
270
272
|
const links = sourceGuestRuntimeLinks({
|
|
271
273
|
toolchainBin: options.toolchainBin,
|
|
@@ -120,6 +120,7 @@ function llvmType(value: number): string {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
const OBJC_INIT_RECORD = '.objc_init'
|
|
123
|
+
const OBJC_LOAD_FUNCTION = '.objcv2_load_function'
|
|
123
124
|
|
|
124
125
|
// change definition names in the linking symbol table, preserving symbol
|
|
125
126
|
// indices and relocations. no app or dependency source bodies are changed.
|
|
@@ -256,7 +257,8 @@ function rewriteObject(
|
|
|
256
257
|
if (sectionName === 'linking') {
|
|
257
258
|
const version = number()
|
|
258
259
|
if (version !== 2) throw new Error('unsupported wasm linking version')
|
|
259
|
-
const
|
|
260
|
+
const subsections: { kind: number; content: Buffer }[] = []
|
|
261
|
+
let objcLoader: number | undefined
|
|
260
262
|
while (offset < section.length) {
|
|
261
263
|
const kind = section[offset++]!
|
|
262
264
|
const length = number()
|
|
@@ -330,6 +332,9 @@ function rewriteObject(
|
|
|
330
332
|
}
|
|
331
333
|
} else if (symbolKind === 3) number()
|
|
332
334
|
else throw new Error('unsupported wasm symbol kind')
|
|
335
|
+
if (name === OBJC_LOAD_FUNCTION && symbolKind === 0 && !(flags & 16)) {
|
|
336
|
+
objcLoader = i
|
|
337
|
+
}
|
|
333
338
|
const alias = names.get(name)
|
|
334
339
|
// an undefined data symbol has no wasm import, only this linking entry.
|
|
335
340
|
if (flags & 16 && symbolKind === 1 && alias) usedSymbols.add(name)
|
|
@@ -392,7 +397,37 @@ function rewriteObject(
|
|
|
392
397
|
content = Buffer.concat([...entries, ...extraEntries])
|
|
393
398
|
}
|
|
394
399
|
offset = stop
|
|
395
|
-
|
|
400
|
+
subsections.push({ kind, content })
|
|
401
|
+
}
|
|
402
|
+
const parts = [encodedString(sectionName), encodeNumber(version)]
|
|
403
|
+
for (const subsection of subsections) {
|
|
404
|
+
let content = subsection.content
|
|
405
|
+
if (subsection.kind === 6 && objcLoader !== undefined) {
|
|
406
|
+
const [count, entriesStart] = readNumber(content, 0)
|
|
407
|
+
const entries = [content.subarray(0, entriesStart)]
|
|
408
|
+
let entryStart = entriesStart
|
|
409
|
+
for (let i = 0; i < count; i++) {
|
|
410
|
+
const [, symbolStart] = readNumber(content, entryStart)
|
|
411
|
+
const [symbol, entryEnd] = readNumber(content, symbolStart)
|
|
412
|
+
// load the merged objc metadata after Swift registration (0) and before user constructors (101+).
|
|
413
|
+
if (symbol === objcLoader) entries.push(encodeNumber(1))
|
|
414
|
+
entries.push(
|
|
415
|
+
content.subarray(
|
|
416
|
+
symbol === objcLoader ? symbolStart : entryStart,
|
|
417
|
+
entryEnd,
|
|
418
|
+
),
|
|
419
|
+
)
|
|
420
|
+
entryStart = entryEnd
|
|
421
|
+
}
|
|
422
|
+
if (entryStart !== content.length)
|
|
423
|
+
throw new Error('invalid init functions subsection')
|
|
424
|
+
content = Buffer.concat(entries)
|
|
425
|
+
}
|
|
426
|
+
parts.push(
|
|
427
|
+
Buffer.from([subsection.kind]),
|
|
428
|
+
encodeNumber(content.length),
|
|
429
|
+
content,
|
|
430
|
+
)
|
|
396
431
|
}
|
|
397
432
|
section = Buffer.concat(parts)
|
|
398
433
|
}
|
|
@@ -46,6 +46,26 @@ export function clangIrLinkOptions(ir: string): string[] {
|
|
|
46
46
|
// target whose <target>.build directory receives the object
|
|
47
47
|
export const CLANG_TARGET_MODULE_WRAPPER = '.peach-clang'
|
|
48
48
|
|
|
49
|
+
const PARALLEL_REPLAY = `
|
|
50
|
+
const { spawn } = require('node:child_process')
|
|
51
|
+
const commands = JSON.parse(require('node:fs').readFileSync(process.env.PEACH_CLANG_REPLAYS, 'utf8'))
|
|
52
|
+
let next = 0
|
|
53
|
+
const run = () => {
|
|
54
|
+
if (next >= commands.length) return Promise.resolve()
|
|
55
|
+
const [file, ...args] = commands[next++]
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
const child = spawn(file, args, { stdio: 'inherit' })
|
|
58
|
+
child.on('error', reject)
|
|
59
|
+
child.on('close', (code) => (code === 0 ? resolve() : reject(new Error('clang link replay failed: ' + file))))
|
|
60
|
+
}).then(run)
|
|
61
|
+
}
|
|
62
|
+
const jobs = Math.max(1, Number(process.env.PEACH_CLANG_JOBS) || 1)
|
|
63
|
+
Promise.all(Array.from({ length: jobs }, run)).catch((error) => {
|
|
64
|
+
console.error(error.message)
|
|
65
|
+
process.exit(1)
|
|
66
|
+
})
|
|
67
|
+
`
|
|
68
|
+
|
|
49
69
|
/** Replay only selected source-owned Clang commands to retain their IR link options. */
|
|
50
70
|
export function sourceGuestClangLinkOptions(options: {
|
|
51
71
|
buildDirectory: string
|
|
@@ -53,6 +73,7 @@ export function sourceGuestClangLinkOptions(options: {
|
|
|
53
73
|
toolchainBin: string
|
|
54
74
|
swiftCompiler: string
|
|
55
75
|
objects: readonly string[]
|
|
76
|
+
jobs: number
|
|
56
77
|
}): Map<string, string[]> {
|
|
57
78
|
const wanted = new Set(options.objects.map((file) => path.resolve(file)))
|
|
58
79
|
const commands = new Map<string, { tool: string; args: string[] }>()
|
|
@@ -89,7 +110,7 @@ export function sourceGuestClangLinkOptions(options: {
|
|
|
89
110
|
commands.set(file, { tool, args: value })
|
|
90
111
|
}
|
|
91
112
|
}
|
|
92
|
-
const
|
|
113
|
+
const replays: { file: string; compiler: string; args: string[]; output: string }[] = []
|
|
93
114
|
for (const [index, file] of [...wanted].entries()) {
|
|
94
115
|
const command = commands.get(file)
|
|
95
116
|
if (!command) throw new Error(`missing source object producer ${file}`)
|
|
@@ -127,11 +148,29 @@ export function sourceGuestClangLinkOptions(options: {
|
|
|
127
148
|
throw new Error(`missing clang ${flag} for ${file}`)
|
|
128
149
|
args[index + 1] = flag === '-o' ? output : `${output}.d`
|
|
129
150
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
[
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
replays.push({
|
|
152
|
+
file,
|
|
153
|
+
compiler: command.args[0]!,
|
|
154
|
+
args: [...args, '-S', '-emit-llvm', '-Xclang', '-disable-llvm-passes'],
|
|
155
|
+
output,
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
// the pruner's plan callback is synchronous, so one child runs the replays concurrently
|
|
159
|
+
const plan = path.join(options.directory, 'clang-link-replays.json')
|
|
160
|
+
writeFileSync(
|
|
161
|
+
plan,
|
|
162
|
+
JSON.stringify(replays.map(({ compiler, args }) => [compiler, ...args])),
|
|
163
|
+
)
|
|
164
|
+
execFileSync(process.execPath, ['-e', PARALLEL_REPLAY], {
|
|
165
|
+
stdio: 'inherit',
|
|
166
|
+
env: {
|
|
167
|
+
...process.env,
|
|
168
|
+
PEACH_CLANG_REPLAYS: plan,
|
|
169
|
+
PEACH_CLANG_JOBS: String(options.jobs),
|
|
170
|
+
},
|
|
171
|
+
})
|
|
172
|
+
const result = new Map<string, string[]>()
|
|
173
|
+
for (const { file, output } of replays) {
|
|
135
174
|
const flags = clangIrLinkOptions(readFileSync(output, 'utf8'))
|
|
136
175
|
for (let index = 0; index < flags.length; index++) {
|
|
137
176
|
const flag = flags[index]!
|
|
@@ -8,6 +8,9 @@ import type { SwiftStandinBehaviors } from './swift-standin-emit'
|
|
|
8
8
|
// start. the values below are what the iOS framework reports in that state;
|
|
9
9
|
// the receiver-facing and UI members stay trapping stand-ins.
|
|
10
10
|
const BUILTIN_STANDIN_BEHAVIOR: SwiftStandinBehaviors = {
|
|
11
|
+
FirebaseAnalytics: {
|
|
12
|
+
'Analytics.logEvent(_:parameters:)': { body: '' },
|
|
13
|
+
},
|
|
11
14
|
GoogleCast: {
|
|
12
15
|
kGCKCastDeviceCategory: { body: 'return "com.google.cast.CastDevice"' },
|
|
13
16
|
kGCKDefaultMediaReceiverApplicationID: { body: 'return "CC1AD845"' },
|
|
@@ -1291,9 +1291,18 @@ export function emitSwiftStandin(
|
|
|
1291
1291
|
typeByPath.has(name) ? '' : attr,
|
|
1292
1292
|
)
|
|
1293
1293
|
: spelledAttrs!
|
|
1294
|
+
const selector =
|
|
1295
|
+
context.inClass &&
|
|
1296
|
+
!options.inert &&
|
|
1297
|
+
member.kind.identifier === 'swift.type.method' &&
|
|
1298
|
+
!/\basync\b/.test(rest!)
|
|
1299
|
+
? /^c:objc\(cs\)\w+\(cm\)([A-Za-z_][A-Za-z_0-9:]*)$/.exec(
|
|
1300
|
+
member.identifier.precise,
|
|
1301
|
+
)?.[1]
|
|
1302
|
+
: undefined
|
|
1294
1303
|
const attrs = options.unobjc?.has(path)
|
|
1295
1304
|
? wrapped.replace(/@objc(?:\([^)]*\))?\s*/g, '')
|
|
1296
|
-
: wrapped
|
|
1305
|
+
: `${wrapped}${selector ? `@objc(${selector}) ` : ''}`
|
|
1297
1306
|
const modifiers =
|
|
1298
1307
|
/^((?:(?:required|final|override|convenience|unowned(?:\(\w+\))?|weak|lazy|nonisolated|mutating|nonmutating) )*)(.*)$/s.exec(
|
|
1299
1308
|
rest!,
|
|
@@ -3,19 +3,34 @@ import { isRecord } from './is-record'
|
|
|
3
3
|
|
|
4
4
|
// traverse the parser's published child keys without runtime-relative module loads.
|
|
5
5
|
export function visitParsedProgram(program: Program, visitor: VisitorObject): void {
|
|
6
|
+
const enterByType = new Map<string, (node: unknown) => void>()
|
|
7
|
+
const exitByType = new Map<string, (node: unknown) => void>()
|
|
8
|
+
for (const key of Object.keys(visitor)) {
|
|
9
|
+
const handler: unknown = Reflect.get(visitor, key)
|
|
10
|
+
if (typeof handler !== 'function') continue
|
|
11
|
+
const invoke = (node: unknown): void => {
|
|
12
|
+
handler(node)
|
|
13
|
+
}
|
|
14
|
+
if (key.endsWith(':exit')) exitByType.set(key.slice(0, -5), invoke)
|
|
15
|
+
else enterByType.set(key, invoke)
|
|
16
|
+
}
|
|
17
|
+
if (enterByType.size === 0 && exitByType.size === 0) return
|
|
18
|
+
const hasExit = exitByType.size > 0
|
|
6
19
|
function visit(value: unknown): void {
|
|
7
20
|
if (Array.isArray(value)) {
|
|
8
|
-
for (
|
|
21
|
+
for (let i = 0; i < value.length; i++) visit(value[i])
|
|
9
22
|
return
|
|
10
23
|
}
|
|
11
24
|
if (!isRecord(value) || typeof value.type !== 'string') return
|
|
12
25
|
const keys = visitorKeys[value.type]
|
|
13
26
|
if (!keys) return
|
|
14
|
-
const enter
|
|
15
|
-
if (
|
|
16
|
-
for (
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
const enter = enterByType.get(value.type)
|
|
28
|
+
if (enter) enter(value)
|
|
29
|
+
for (let i = 0; i < keys.length; i++) visit(value[keys[i]!])
|
|
30
|
+
if (hasExit) {
|
|
31
|
+
const exit = exitByType.get(value.type)
|
|
32
|
+
if (exit) exit(value)
|
|
33
|
+
}
|
|
19
34
|
}
|
|
20
35
|
visit(program)
|
|
21
36
|
}
|