peachsim 0.1.2487 → 0.1.2489
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/control.ts +1 -0
- package/cli/commands/shell-url.ts +12 -6
- 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 +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +167 -167
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-MHBKEX4S.mjs → acorn-46P725QB.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-RUTCB73U.mjs → chunk-2ZAKSUG3.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-HE7EAGQL.mjs → chunk-5F5TV3M5.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-2ZLORBLV.mjs → chunk-75IXYYPA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RCU5GHCK.mjs → chunk-CB2MREW2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-J2F3WW7E.mjs → chunk-E7Z6E4VM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WM3ZQJPN.mjs → chunk-FMR76G4M.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-N77R5GZV.mjs → chunk-FNFDX5OA.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-OXWMTMC4.mjs → chunk-FXOLLJ7N.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QXT6KHA4.mjs → chunk-G4KFSINI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-X2P3BLT5.mjs → chunk-HO4COZOG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OZIZZTJU.mjs → chunk-K3NXHJBV.mjs} +12 -12
- package/dist-lib/esm-chunks/{chunk-WBFRHLQG.mjs → chunk-KFJJOPLU.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-NM27TWXD.mjs → chunk-MOGXM5NJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FQLC3QU7.mjs → chunk-NN6KHA6F.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VTJKZ25F.mjs → chunk-PWLDSFLP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RCXANTR3.mjs → chunk-QR4AFBNL.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-VNI6WHVI.mjs → chunk-ST7BG6HB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-23DLL3LB.mjs → chunk-T53UQ6V7.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-2BZEUT66.mjs → chunk-XYRP56S5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KF6HW3YA.mjs → chunk-YH2VVDO2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-4WGIAUCS.mjs → chunk-ZGCWGHEX.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-5W4FZUHK.mjs → metro-layout-parser-FPL6XENQ.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-KJQO5GSC.mjs → swift-package-prebuilt-FYUAWFYO.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-JM6D76SD.mjs → swift-sdk-app-module-RVHNFMEY.mjs} +13 -13
- package/dist-lib/esm-chunks/{swift-sdk-image-JUXW737Q.mjs → swift-sdk-image-JHQ6DP5G.mjs} +13 -13
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-X55F2PAV.mjs → swift-sdk-image-producer-XQ5W4ONP.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +99 -99
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +972 -760
- package/dist-lib/host/fetch-proxy-handler.cjs +42 -42
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- 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/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +15 -15
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +79 -79
- package/dist-lib/public-origins-lib.json +74 -72
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- 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 +7 -7
- package/dist-lib/skills.cjs +1421 -1324
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +5 -5
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/core-abi/style/style-schema.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/render-worker/canvaskit-webgpu.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/webgpu-wire-server.d.ts +2 -0
- package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +4 -0
- package/package.json +1 -1
- package/src/expo-native-prebuilt.ts +16 -25
- package/src/host/bridge-host.ts +8 -0
- package/src/managed-expo-identity.ts +110 -0
- package/src/native-preparation.ts +8 -2
- package/src/nativePreparationContract.ts +1 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { isLoopbackHost } from './backend-origin'
|
|
5
|
+
import { getCliVersion } from './cli-version'
|
|
6
|
+
import { isManagedExpoApp, managedExpoNativeAppIdentity } from './expo-native-prebuilt'
|
|
7
|
+
import { stageHostDerivedBytes } from './host/staged-host-files'
|
|
8
|
+
import { createNativeAppIdentityHeader } from './native-app-identity'
|
|
9
|
+
import { NativeAppTargetSelectionError } from './native-app-identity-project'
|
|
10
|
+
import { nativeInputRevision } from './native-preparation'
|
|
11
|
+
import { MANAGED_EXPO_INPUTS_ROUTE } from './nativePreparationContract'
|
|
12
|
+
import { nodeHttpFetch } from './node-http-fetch'
|
|
13
|
+
import { getRuntimePlatformAdapter } from './runtimePlatformContract.ts'
|
|
14
|
+
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
15
|
+
|
|
16
|
+
const revisionType = 'application/vnd.peach.native-input-revision'
|
|
17
|
+
|
|
18
|
+
async function prepareIdentity(root: string, iosTarget?: string) {
|
|
19
|
+
try {
|
|
20
|
+
const identity = await managedExpoNativeAppIdentity(root, iosTarget)
|
|
21
|
+
return identity && createNativeAppIdentityHeader(identity)
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (error instanceof NativeAppTargetSelectionError) return null
|
|
24
|
+
throw error
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function readManagedExpoIdentity(
|
|
29
|
+
root: string,
|
|
30
|
+
platform: 'ios' | 'android',
|
|
31
|
+
iosTarget: string | undefined,
|
|
32
|
+
bridgeOrigin: string | undefined,
|
|
33
|
+
): Promise<string | null> {
|
|
34
|
+
if (!getRuntimePlatformAdapter(platform).isIOS || !isManagedExpoApp(root)) return null
|
|
35
|
+
if (bridgeOrigin) {
|
|
36
|
+
const url = new URL(MANAGED_EXPO_INPUTS_ROUTE, bridgeOrigin)
|
|
37
|
+
url.searchParams.set('root', root)
|
|
38
|
+
const response = await nodeHttpFetch(url.href)
|
|
39
|
+
if (response.ok && response.headers.get('content-type') === revisionType) {
|
|
40
|
+
// the CLI owns the environment for config plugins, including when a
|
|
41
|
+
// separate service started the daemon. only the digest indexes the cache.
|
|
42
|
+
const environment = createHash('sha256')
|
|
43
|
+
.update(JSON.stringify(Object.entries(process.env).sort()))
|
|
44
|
+
.digest('hex')
|
|
45
|
+
const inputs = Buffer.from(
|
|
46
|
+
JSON.stringify([
|
|
47
|
+
await response.text(),
|
|
48
|
+
root,
|
|
49
|
+
iosTarget,
|
|
50
|
+
getCliVersion(),
|
|
51
|
+
environment,
|
|
52
|
+
]),
|
|
53
|
+
)
|
|
54
|
+
const staged = await stageHostDerivedBytes(
|
|
55
|
+
inputs,
|
|
56
|
+
'managed-expo-identity-1',
|
|
57
|
+
bridgeOrigin,
|
|
58
|
+
'.txt',
|
|
59
|
+
async () => Buffer.from((await prepareIdentity(root, iosTarget)) ?? ''),
|
|
60
|
+
)
|
|
61
|
+
const identity = await nodeHttpFetch(staged)
|
|
62
|
+
if (!identity.ok)
|
|
63
|
+
throw new Error(`Managed Expo identity answered ${identity.status}`)
|
|
64
|
+
return (await identity.text()) || null
|
|
65
|
+
}
|
|
66
|
+
// an older bridge has no revision route.
|
|
67
|
+
if (!response.ok && response.status !== 404) throw new Error(await response.text())
|
|
68
|
+
await response.body?.cancel()
|
|
69
|
+
}
|
|
70
|
+
return prepareIdentity(root, iosTarget)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function handleManagedExpoInputs(
|
|
74
|
+
req: IncomingMessage,
|
|
75
|
+
res: ServerResponse,
|
|
76
|
+
url: URL,
|
|
77
|
+
) {
|
|
78
|
+
const remote = req.socket.remoteAddress?.replace(/^::ffff:/, '')
|
|
79
|
+
if (
|
|
80
|
+
!remote ||
|
|
81
|
+
!isLoopbackHost(remote) ||
|
|
82
|
+
req.headers.origin ||
|
|
83
|
+
req.headers['sec-fetch-mode']
|
|
84
|
+
) {
|
|
85
|
+
res.writeHead(403)
|
|
86
|
+
res.end('Managed Expo identity requires a local CLI client')
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
if (req.method !== 'GET') {
|
|
90
|
+
res.writeHead(405)
|
|
91
|
+
res.end('GET required')
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
const source = url.searchParams.get('root')
|
|
95
|
+
if (!source || !path.isAbsolute(source)) {
|
|
96
|
+
res.writeHead(400)
|
|
97
|
+
res.end('Missing absolute app root')
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
const root = fs.realpathSync(source)
|
|
101
|
+
const revision = nativeInputRevision(root)
|
|
102
|
+
res.setHeader('Cache-Control', 'no-store')
|
|
103
|
+
if (!revision) {
|
|
104
|
+
res.writeHead(204)
|
|
105
|
+
res.end()
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
res.writeHead(200, { 'Content-Type': revisionType })
|
|
109
|
+
res.end(revision)
|
|
110
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
1
2
|
import fs from 'node:fs'
|
|
2
3
|
import path from 'node:path'
|
|
3
4
|
import { clearTimeout, setTimeout } from 'node:timers'
|
|
@@ -11,7 +12,7 @@ import { findWorkspaceRoot } from './workspace-root'
|
|
|
11
12
|
const setTimeoutNode: (fn: () => void, ms: number) => NodeJS.Timeout = setTimeout
|
|
12
13
|
const RETENTION_MS = 30 * 60 * 1000
|
|
13
14
|
|
|
14
|
-
type NativeInputs = { expiry: NodeJS.Timeout }
|
|
15
|
+
type NativeInputs = { expiry: NodeJS.Timeout; revision: string }
|
|
15
16
|
type Preparation<T> = { result: Promise<T>; ready?: { value: T } }
|
|
16
17
|
const watchedInputs = new Map<string, NativeInputs>()
|
|
17
18
|
|
|
@@ -43,7 +44,7 @@ function watchNativeInputs(root: string): NativeInputs | undefined {
|
|
|
43
44
|
clearTimeout(expiry)
|
|
44
45
|
for (const watcher of watchers) watcher.close()
|
|
45
46
|
}
|
|
46
|
-
const inputs = { expiry }
|
|
47
|
+
const inputs = { expiry, revision: randomUUID() }
|
|
47
48
|
const watch = (directory: string, recursive: boolean, name?: string) => {
|
|
48
49
|
const watcher = fs.watch(
|
|
49
50
|
directory,
|
|
@@ -88,6 +89,11 @@ function watchNativeInputs(root: string): NativeInputs | undefined {
|
|
|
88
89
|
return inputs
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
export function nativeInputRevision(root: string): string | undefined {
|
|
93
|
+
const inputs = watchNativeInputs(root)
|
|
94
|
+
if (inputs) return JSON.stringify([inputs.revision, resolveActiveRuntimeRoot()])
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
// an open can reuse preparation from the current workspace. its token hands
|
|
92
98
|
// that same result to the first tenant request, even if the workspace changes.
|
|
93
99
|
export class NativePreparation<T> {
|