peachsim 0.1.2036 → 0.1.2037
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/cloud-test-tunnel.ts +43 -6
- package/cli/outbound-endpoints.ts +4 -0
- 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 +3809 -3745
- 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 +15 -7
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +3082 -3031
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +2 -2
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +3781 -3715
- package/dist-lib/host/fetch-proxy-handler.cjs +5119 -274
- 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 +16678 -16580
- 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 +12463 -12361
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +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/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 +577 -181
- 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 +4400 -4311
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- 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 +2 -2
- package/dist-lib/vite.cjs +5159 -342
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/expo-autolinking.ts +36 -13
- package/src/expo-native-workspace.ts +10 -9
- package/src/expo-pod-prebuilt.ts +122 -0
- package/src/expo-swift-host.ts +38 -8
- package/src/expo-swift-ready.ts +11 -5
- package/src/expoSwiftContract.ts +2 -1
- package/src/host/dev-server-package-versions.ts +20 -4
- package/src/native-failure-output.ts +34 -0
- package/src/native-prebuilt.ts +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2037 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/package.json
CHANGED
package/runtime-companion.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":1,"sha256":"
|
|
1
|
+
{"abi":1,"sha256":"4f57b56031901847c4b58b0a8a000279a4718438d3dad8494c82fc83e6c3417d","file":"node/cli-4f57b56031901847c4b58b0a8a000279a4718438d3dad8494c82fc83e6c3417d.cjs"}
|
package/src/expo-autolinking.ts
CHANGED
|
@@ -30,17 +30,13 @@ export function autolinkerAppleFlags(autolinkerManifest: string, appRoot: string
|
|
|
30
30
|
|
|
31
31
|
const run = promisify(execFile)
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
* React Native autolinker leaves out; an app without the autolinker has none. */
|
|
35
|
-
export async function expoAutolinkedPods(
|
|
36
|
-
appRoot: string,
|
|
37
|
-
): Promise<{ name: string; root: string; podspecPath: string }[]> {
|
|
33
|
+
async function autolinkerResults(appRoot: string) {
|
|
38
34
|
const appRequire = createRequire(path.join(appRoot, 'package.json'))
|
|
39
35
|
let manifest: string
|
|
40
36
|
try {
|
|
41
37
|
manifest = appRequire.resolve('expo-modules-autolinking/package.json')
|
|
42
38
|
} catch (error) {
|
|
43
|
-
if (Reflect.get(Object(error), 'code') === 'MODULE_NOT_FOUND') return
|
|
39
|
+
if (Reflect.get(Object(error), 'code') === 'MODULE_NOT_FOUND') return null
|
|
44
40
|
throw error
|
|
45
41
|
}
|
|
46
42
|
const cli = path.join(path.dirname(manifest), 'bin/expo-modules-autolinking.js')
|
|
@@ -59,12 +55,39 @@ export async function expoAutolinkedPods(
|
|
|
59
55
|
),
|
|
60
56
|
),
|
|
61
57
|
)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
const modules: AutolinkedModule[] = resolve.modules
|
|
59
|
+
return { search, modules }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface AutolinkedModule {
|
|
63
|
+
packageName: string
|
|
64
|
+
swiftModuleNames?: string[]
|
|
65
|
+
pods: { podName: string; podspecDir: string }[]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** the Apple pods of every Expo module the app's autolinker selects, which the
|
|
69
|
+
* React Native autolinker leaves out; an app without the autolinker has none. */
|
|
70
|
+
export async function expoAutolinkedPods(
|
|
71
|
+
appRoot: string,
|
|
72
|
+
): Promise<{ name: string; root: string; podspecPath: string }[]> {
|
|
73
|
+
const linked = await autolinkerResults(appRoot)
|
|
74
|
+
return (linked?.modules ?? []).flatMap((module) =>
|
|
75
|
+
module.pods.map((pod) => ({
|
|
76
|
+
name: module.packageName,
|
|
77
|
+
root: linked!.search[module.packageName].path,
|
|
78
|
+
podspecPath: path.join(pod.podspecDir, `${pod.podName}.podspec`),
|
|
79
|
+
})),
|
|
69
80
|
)
|
|
70
81
|
}
|
|
82
|
+
|
|
83
|
+
/** each installed Expo module package the app's autolinker selects, with the Swift modules it builds. */
|
|
84
|
+
export async function expoAutolinkedPackages(
|
|
85
|
+
appRoot: string,
|
|
86
|
+
): Promise<{ name: string; root: string; swiftModuleNames: string[] }[]> {
|
|
87
|
+
const linked = await autolinkerResults(appRoot)
|
|
88
|
+
return (linked?.modules ?? []).map((module) => ({
|
|
89
|
+
name: module.packageName,
|
|
90
|
+
root: fs.realpathSync(linked!.search[module.packageName].path),
|
|
91
|
+
swiftModuleNames: module.swiftModuleNames ?? [],
|
|
92
|
+
}))
|
|
93
|
+
}
|
|
@@ -9,6 +9,7 @@ import { detectPackageManager } from '../cli/commands/detect'
|
|
|
9
9
|
import { teamMachineInstalled } from './admitted-mac-build'
|
|
10
10
|
import { workspaceExclusion } from './expo-workspace-exclusion'
|
|
11
11
|
import { cacheDir } from './home-paths'
|
|
12
|
+
import { failedOutputLine } from './native-failure-output'
|
|
12
13
|
import { prepareOneSDKSources } from './one-sdk-preparation'
|
|
13
14
|
import { portableExpoWorkspace } from './portable-expo-workspace'
|
|
14
15
|
import {
|
|
@@ -1018,14 +1019,14 @@ async function runAdmitted(
|
|
|
1018
1019
|
child.stderr.on('data', (bytes: Buffer) => output.push(bytes))
|
|
1019
1020
|
await new Promise<void>((resolve, reject) => {
|
|
1020
1021
|
child.once('error', reject)
|
|
1021
|
-
child.once('close', (status) =>
|
|
1022
|
-
status === 0
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
)
|
|
1022
|
+
child.once('close', (status, signal) => {
|
|
1023
|
+
if (status === 0) return resolve()
|
|
1024
|
+
const bytes = Buffer.concat(output)
|
|
1025
|
+
reject(
|
|
1026
|
+
new Error(
|
|
1027
|
+
`${command} exited ${status ?? signal}: ${bytes.toString('utf8')}\n${failedOutputLine(command, cwd, bytes)}`,
|
|
1028
|
+
),
|
|
1029
|
+
)
|
|
1030
|
+
})
|
|
1030
1031
|
})
|
|
1031
1032
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// one installed Expo module package's compiled Swift from the prebuilt registry
|
|
2
|
+
// (specs/peach/swift/expo-native-compilation.md). a hosted run has no native
|
|
3
|
+
// workspace to compile in, so our builder publishes each package alone under a
|
|
4
|
+
// key of its name, version and source tree, the compilers and the runtime's
|
|
5
|
+
// pins. the host looks up every Expo module package an app installs and loads
|
|
6
|
+
// the ones published; the rest stay unanswered, as before.
|
|
7
|
+
import fs from 'node:fs'
|
|
8
|
+
import path from 'node:path'
|
|
9
|
+
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
10
|
+
import { expoAutolinkedPackages } from './expo-autolinking'
|
|
11
|
+
import { EXPO_NATIVE_COMPILER_DIGEST } from './expo-native-prebuilt'
|
|
12
|
+
import {
|
|
13
|
+
isExpoSwiftCompilationResult,
|
|
14
|
+
type ExpoSwiftCompilationResult,
|
|
15
|
+
} from './expoSwiftContract'
|
|
16
|
+
import { isRecord } from './is-record'
|
|
17
|
+
import {
|
|
18
|
+
NATIVE_PREBUILT_ORIGIN,
|
|
19
|
+
nativeEntryKey,
|
|
20
|
+
nativeEntryPrefix,
|
|
21
|
+
} from './native-prebuilt'
|
|
22
|
+
import { packageTreeDigest } from './package-tree-digest'
|
|
23
|
+
import { swiftNativePin } from './swift-native-pin'
|
|
24
|
+
|
|
25
|
+
export interface ExpoPodPackage {
|
|
26
|
+
name: string
|
|
27
|
+
root: string
|
|
28
|
+
version: string
|
|
29
|
+
swiftModule: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** the installed Expo module packages a package entry can hold: one Swift module each, from node_modules, not answered by the runtime. */
|
|
33
|
+
export async function expoPodPackages(appRoot: string): Promise<ExpoPodPackage[]> {
|
|
34
|
+
const answered = peachAnsweredNativePackages()
|
|
35
|
+
return (await expoAutolinkedPackages(appRoot)).flatMap((pod) => {
|
|
36
|
+
const [swiftModule] = pod.swiftModuleNames
|
|
37
|
+
if (
|
|
38
|
+
swiftModule === undefined ||
|
|
39
|
+
pod.swiftModuleNames.length !== 1 ||
|
|
40
|
+
answered.has(pod.name) ||
|
|
41
|
+
!pod.root.split(path.sep).includes('node_modules')
|
|
42
|
+
)
|
|
43
|
+
return []
|
|
44
|
+
const manifest: unknown = JSON.parse(
|
|
45
|
+
fs.readFileSync(path.join(pod.root, 'package.json'), 'utf8'),
|
|
46
|
+
)
|
|
47
|
+
const version = isRecord(manifest) ? manifest.version : null
|
|
48
|
+
if (typeof version !== 'string')
|
|
49
|
+
throw new Error(`${pod.root}: package has no version`)
|
|
50
|
+
return [{ name: pod.name, root: pod.root, version, swiftModule }]
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function expoPodInputs(
|
|
55
|
+
pod: ExpoPodPackage,
|
|
56
|
+
): Promise<Record<string, string>> {
|
|
57
|
+
return {
|
|
58
|
+
compiler: EXPO_NATIVE_COMPILER_DIGEST,
|
|
59
|
+
'swift-pin': JSON.stringify(swiftNativePin()),
|
|
60
|
+
answered: JSON.stringify([...peachAnsweredNativePackages()].sort()),
|
|
61
|
+
name: pod.name,
|
|
62
|
+
version: pod.version,
|
|
63
|
+
tree: await packageTreeDigest(pod.root),
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// a scoped package name holds a slash the entry path cannot
|
|
68
|
+
export const expoPodEntryName = (name: string) => name.replace('/', '+')
|
|
69
|
+
|
|
70
|
+
export const expoPodEntryUrl = (name: string, key: string, file: string) =>
|
|
71
|
+
`${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix('expo-pod', expoPodEntryName(name), key)}/${file}`
|
|
72
|
+
|
|
73
|
+
// the package's own root id: the tenant prefixes its installation, so only
|
|
74
|
+
// uniqueness among one app's modules matters.
|
|
75
|
+
export const expoPodRootId = (pod: ExpoPodPackage) =>
|
|
76
|
+
`expo-pod/${pod.name}@${pod.version}`
|
|
77
|
+
|
|
78
|
+
// one process asks for each key once: an entry never changes.
|
|
79
|
+
const published = new Map<string, Promise<ExpoSwiftCompilationResult | null>>()
|
|
80
|
+
|
|
81
|
+
function lookup(url: string) {
|
|
82
|
+
let pending = published.get(url)
|
|
83
|
+
if (!pending) {
|
|
84
|
+
pending = fetch(url)
|
|
85
|
+
.then(async (response) => {
|
|
86
|
+
if (!response.ok) return null
|
|
87
|
+
const entry: unknown = await response.json()
|
|
88
|
+
return isExpoSwiftCompilationResult(entry) ? entry : null
|
|
89
|
+
})
|
|
90
|
+
.catch(() => null)
|
|
91
|
+
published.set(url, pending)
|
|
92
|
+
}
|
|
93
|
+
return pending
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* the published Swift for every Expo module package the app installs, or null
|
|
98
|
+
* when none is published. a network failure is a miss: the module stays
|
|
99
|
+
* unanswered, as it is without an entry.
|
|
100
|
+
*/
|
|
101
|
+
export async function prebuiltExpoPods(
|
|
102
|
+
appRoot: string,
|
|
103
|
+
): Promise<ExpoSwiftCompilationResult | null> {
|
|
104
|
+
const entries = await Promise.all(
|
|
105
|
+
(await expoPodPackages(fs.realpathSync(appRoot))).map(async (pod) =>
|
|
106
|
+
lookup(
|
|
107
|
+
expoPodEntryUrl(
|
|
108
|
+
pod.name,
|
|
109
|
+
nativeEntryKey(await expoPodInputs(pod)),
|
|
110
|
+
'metadata.json',
|
|
111
|
+
),
|
|
112
|
+
),
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
const hits = entries.filter((entry) => entry !== null)
|
|
116
|
+
if (hits.length === 0) return null
|
|
117
|
+
return {
|
|
118
|
+
namespaces: hits.flatMap((entry) => entry.namespaces),
|
|
119
|
+
modules: hits.flatMap((entry) => entry.modules),
|
|
120
|
+
failures: [],
|
|
121
|
+
}
|
|
122
|
+
}
|
package/src/expo-swift-host.ts
CHANGED
|
@@ -1329,7 +1329,7 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1329
1329
|
if (namespaces.length > 1 && !installed) {
|
|
1330
1330
|
// without that membership the package's natives cannot be split, so it
|
|
1331
1331
|
// stays unbuilt and the app reports it like any module Peach lacks.
|
|
1332
|
-
if (!
|
|
1332
|
+
if (!prepareNative) {
|
|
1333
1333
|
if (!answered)
|
|
1334
1334
|
report(
|
|
1335
1335
|
`${packageName}: ${namespaces.join(', ')} need CocoaPods target membership, which only a Mac prepares; not compiled`,
|
|
@@ -2067,6 +2067,27 @@ function readFailedCompilation(packagePath: string) {
|
|
|
2067
2067
|
return { stamp: record.stamp, diagnostic: record.diagnostic }
|
|
2068
2068
|
}
|
|
2069
2069
|
|
|
2070
|
+
// the named Swift modules and the modules they import, transitively
|
|
2071
|
+
function onlyModules(
|
|
2072
|
+
units: ExpoSwiftSourceUnit[],
|
|
2073
|
+
only: readonly string[] | undefined,
|
|
2074
|
+
): ExpoSwiftSourceUnit[] {
|
|
2075
|
+
if (!only) return units
|
|
2076
|
+
const wanted = new Set(only)
|
|
2077
|
+
const selected = new Set<ExpoSwiftSourceUnit>()
|
|
2078
|
+
for (let grew = true; grew; ) {
|
|
2079
|
+
grew = false
|
|
2080
|
+
for (const unit of units) {
|
|
2081
|
+
if (selected.has(unit) || !wanted.has(unit.namespace)) continue
|
|
2082
|
+
selected.add(unit)
|
|
2083
|
+
grew = true
|
|
2084
|
+
for (const source of Object.values(unit.files))
|
|
2085
|
+
for (const name of swiftImportNames(source)) wanted.add(name)
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
return units.filter((unit) => selected.has(unit))
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2070
2091
|
export async function compileExpoSwiftModules(
|
|
2071
2092
|
root: string,
|
|
2072
2093
|
base: string,
|
|
@@ -2085,7 +2106,7 @@ export async function compileExpoSwiftModules(
|
|
|
2085
2106
|
installSwiftInputTrace()
|
|
2086
2107
|
let key: string
|
|
2087
2108
|
try {
|
|
2088
|
-
key = await discoveryKey(root, options.installedWorkspace, true, options.iosTarget)
|
|
2109
|
+
key = `${await discoveryKey(root, options.installedWorkspace, true, options.iosTarget)}\0${options.only?.join(',') ?? ''}`
|
|
2089
2110
|
} catch {
|
|
2090
2111
|
return compileExpoSwiftModulesTraced(root, base, publishArtifact, options)
|
|
2091
2112
|
}
|
|
@@ -2125,9 +2146,12 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2125
2146
|
console.error(`[expo-swift ${Math.round(performance.now() - started)}ms] ${message}`)
|
|
2126
2147
|
try {
|
|
2127
2148
|
signal.throwIfAborted()
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2149
|
+
// a package-scoped compile is what per-package entries hold, so it never
|
|
2150
|
+
// reads the whole-app entry or a CocoaPods workspace
|
|
2151
|
+
const prebuilt =
|
|
2152
|
+
options.installedWorkspace || options.only
|
|
2153
|
+
? null
|
|
2154
|
+
: await prebuiltExpoNative(root, options.iosTarget)
|
|
2131
2155
|
if (prebuilt) {
|
|
2132
2156
|
report('using the published native build for this app')
|
|
2133
2157
|
return await prebuiltExpoSwiftResult(root, prebuilt, signal)
|
|
@@ -2137,7 +2161,7 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2137
2161
|
root,
|
|
2138
2162
|
signal,
|
|
2139
2163
|
options.installedWorkspace,
|
|
2140
|
-
nativeWorkspaceAvailable(),
|
|
2164
|
+
nativeWorkspaceAvailable() && !options.only,
|
|
2141
2165
|
options.iosTarget,
|
|
2142
2166
|
)
|
|
2143
2167
|
signal.throwIfAborted()
|
|
@@ -2159,7 +2183,10 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2159
2183
|
)
|
|
2160
2184
|
)
|
|
2161
2185
|
await ensureSwiftToolchain(signal)
|
|
2162
|
-
|
|
2186
|
+
// app target modules are never part of an installed package
|
|
2187
|
+
let bridge = options.only
|
|
2188
|
+
? null
|
|
2189
|
+
: collectBridgeModuleSources(fs.realpathSync(root), signal)
|
|
2163
2190
|
if (
|
|
2164
2191
|
nativeWorkspaceAvailable() &&
|
|
2165
2192
|
fs.existsSync(path.join(root, 'ios', 'Podfile')) &&
|
|
@@ -2215,7 +2242,10 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2215
2242
|
unit.files[EXPO_SWIFT_ENTRY] = expoEntry([unit])
|
|
2216
2243
|
unit.files['Package.swift'] = expoManifest(unit.files, '', targetSettings([unit]))
|
|
2217
2244
|
}
|
|
2218
|
-
const units =
|
|
2245
|
+
const units = onlyModules(
|
|
2246
|
+
[...(expoUnits ?? []), ...(bridge?.units ?? [])],
|
|
2247
|
+
options.only,
|
|
2248
|
+
)
|
|
2219
2249
|
const bridgeFailures = bridge?.failures ?? []
|
|
2220
2250
|
if (units.length === 0 && bridgeFailures.length === 0 && expoUnits === null)
|
|
2221
2251
|
return null
|
package/src/expo-swift-ready.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getCliVersion } from './cli-version'
|
|
2
2
|
import { LAUNCH_METADATA_QUERY_PARAM, readLaunchMetadata } from './launchMetadataContract'
|
|
3
|
+
import { FAILED_OUTPUT_MARKER } from './native-failure-output'
|
|
3
4
|
import { NATIVE_PREPARE_QUERY_PARAM } from './nativePreparationContract'
|
|
4
5
|
import { readTurboMetadata } from './nitroContract'
|
|
5
6
|
import { nodeHttpFetch } from './node-http-fetch'
|
|
@@ -52,22 +53,27 @@ export async function awaitExpoSwiftReady(
|
|
|
52
53
|
)
|
|
53
54
|
}
|
|
54
55
|
if (!res.ok) {
|
|
55
|
-
const
|
|
56
|
+
const lines = (await res.text()).trim().split('\n')
|
|
57
|
+
// the saved-output line is the one a reader needs most and ends the
|
|
58
|
+
// message, so it is kept whole outside the length cap on the diagnostics.
|
|
59
|
+
const saved = lines.filter((line) => line.startsWith(FAILED_OUTPUT_MARKER))
|
|
60
|
+
const output = lines.filter((line) => !line.startsWith(FAILED_OUTPUT_MARKER))
|
|
56
61
|
// parallel compiler jobs can print warnings after the fatal diagnostic;
|
|
57
62
|
// cocoapods marks its failures `[!]` and a crashed hook `NameError - `.
|
|
58
|
-
const
|
|
59
|
-
.split('\n')
|
|
63
|
+
const detail = output
|
|
60
64
|
.filter((line) =>
|
|
61
65
|
/(?:^|:\s)(?:fatal )?error:|^\[!\] |^\w+(?:::\w+)*Error - /.test(line),
|
|
62
66
|
)
|
|
63
|
-
|
|
64
|
-
const
|
|
67
|
+
.join('\n')
|
|
68
|
+
const text = output.join('\n').trim()
|
|
69
|
+
const diagnostics = detail
|
|
65
70
|
? detail.length > 2000
|
|
66
71
|
? `${detail.slice(0, 2000)}…`
|
|
67
72
|
: detail
|
|
68
73
|
: text.length > 2000
|
|
69
74
|
? `…${text.slice(-2000)}`
|
|
70
75
|
: text
|
|
76
|
+
const body = [diagnostics, ...saved].filter(Boolean).join('\n')
|
|
71
77
|
// nothing here identifies the server, so the restart is conditional.
|
|
72
78
|
const hint =
|
|
73
79
|
res.status === 404
|
package/src/expoSwiftContract.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface ExpoSwiftPreparationOptions {
|
|
|
12
12
|
signal?: AbortSignal
|
|
13
13
|
installedWorkspace?: string
|
|
14
14
|
iosTarget?: string
|
|
15
|
+
// compile only these Swift modules and the modules they import
|
|
16
|
+
only?: readonly string[]
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface ExpoSwiftSourceUnit {
|
|
@@ -69,7 +71,6 @@ export function isExpoSwiftCompilationResult(
|
|
|
69
71
|
!isRecord(value) ||
|
|
70
72
|
!strings(value.namespaces) ||
|
|
71
73
|
!Array.isArray(value.modules) ||
|
|
72
|
-
value.modules.length > 1 ||
|
|
73
74
|
!Array.isArray(value.failures)
|
|
74
75
|
)
|
|
75
76
|
return false
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import path from 'path'
|
|
3
|
+
import { prebuiltExpoPods } from '../expo-pod-prebuilt'
|
|
3
4
|
import { readInstalledNativePackageVersionsAsync } from '../installed-package-versions.ts'
|
|
4
5
|
import { resolveMetroProjectRoot } from '../metro-project-root.ts'
|
|
6
|
+
import type { ExpoSwiftCompilationResult } from '../expoSwiftContract'
|
|
5
7
|
import type { PackageVersions } from '../packageVersionsContract'
|
|
6
8
|
|
|
7
9
|
// a plain Metro or Expo dev server records no installed versions in its
|
|
8
10
|
// bundle. the bridge serving that bundle reads them from the project the
|
|
9
11
|
// server names, the way `peach open` reads its own project. a server that
|
|
10
12
|
// names no project, or one whose project is not on this machine, gets none.
|
|
11
|
-
|
|
12
|
-
bundleUrl: URL,
|
|
13
|
-
): Promise<PackageVersions | null> {
|
|
13
|
+
async function devServerProjectRoot(bundleUrl: URL): Promise<string | null> {
|
|
14
14
|
if (!bundleUrl.pathname.endsWith('.bundle')) return null
|
|
15
15
|
const projectRoot = await resolveMetroProjectRoot(bundleUrl.href)
|
|
16
16
|
if (!projectRoot) return null
|
|
@@ -19,5 +19,21 @@ export async function readDevServerPackageVersions(
|
|
|
19
19
|
} catch {
|
|
20
20
|
return null
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return projectRoot
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function readDevServerPackageVersions(
|
|
26
|
+
bundleUrl: URL,
|
|
27
|
+
): Promise<PackageVersions | null> {
|
|
28
|
+
const projectRoot = await devServerProjectRoot(bundleUrl)
|
|
29
|
+
return projectRoot ? readInstalledNativePackageVersionsAsync(projectRoot) : null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// the same bundle has no native compile behind it, so the project's Expo
|
|
33
|
+
// module packages come from the prebuilt registry.
|
|
34
|
+
export async function readDevServerExpoPods(
|
|
35
|
+
bundleUrl: URL,
|
|
36
|
+
): Promise<ExpoSwiftCompilationResult | null> {
|
|
37
|
+
const projectRoot = await devServerProjectRoot(bundleUrl)
|
|
38
|
+
return projectRoot ? prebuiltExpoPods(projectRoot) : null
|
|
23
39
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { cacheDir } from './home-paths'
|
|
4
|
+
|
|
5
|
+
// callers show only the tail of a failure message, and a bundler's own
|
|
6
|
+
// diagnostic sits before the stack that ends the output, so the whole output is
|
|
7
|
+
// kept in a file the message names on its last line. a save that fails must not
|
|
8
|
+
// replace the command's own failure, so the line then names why it was not kept.
|
|
9
|
+
export const FAILED_OUTPUT_MARKER = '[peach] full output of the failed command: '
|
|
10
|
+
const FAILED_OUTPUT_KEPT_MS = 7 * 24 * 3_600_000
|
|
11
|
+
|
|
12
|
+
function saveFailedOutput(command: string, cwd: string, output: Buffer) {
|
|
13
|
+
const directory = path.join(cacheDir(), 'native-prepare-failures')
|
|
14
|
+
fs.mkdirSync(directory, { recursive: true })
|
|
15
|
+
for (const name of fs.readdirSync(directory)) {
|
|
16
|
+
const old = path.join(directory, name)
|
|
17
|
+
if (Date.now() - fs.statSync(old).mtimeMs > FAILED_OUTPUT_KEPT_MS)
|
|
18
|
+
fs.rmSync(old, { force: true })
|
|
19
|
+
}
|
|
20
|
+
const file = path.join(
|
|
21
|
+
directory,
|
|
22
|
+
`${new Date().toISOString().replaceAll(/[:.]/g, '-')}-${process.pid}-${path.basename(command)}.log`,
|
|
23
|
+
)
|
|
24
|
+
fs.writeFileSync(file, `cwd: ${cwd}\n${output.toString('utf8')}`)
|
|
25
|
+
return file
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function failedOutputLine(command: string, cwd: string, output: Buffer) {
|
|
29
|
+
try {
|
|
30
|
+
return `${FAILED_OUTPUT_MARKER}${saveFailedOutput(command, cwd, output)}`
|
|
31
|
+
} catch (error) {
|
|
32
|
+
return `${FAILED_OUTPUT_MARKER}(not saved: ${error instanceof Error ? error.message : String(error)})`
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/native-prebuilt.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
//
|
|
8
8
|
// <kind> is `rust` for the build cache, `slice` for a hand-ported library's
|
|
9
9
|
// wasm slice, `turbo` for an app's compiled C++ TurboModule executable, `nitro`
|
|
10
|
-
// for the shared Nitro executable
|
|
11
|
-
// build; <key> is a digest of everything the bytes depend on, so an entry can
|
|
10
|
+
// for the shared Nitro executable, `expo` for a standard Expo app's native
|
|
11
|
+
// build and `expo-pod` for one installed Expo module package's compiled Swift; <key> is a digest of everything the bytes depend on, so an entry can
|
|
12
12
|
// never serve different inputs. only CI publishers hold the bucket credentials
|
|
13
13
|
// (scripts/ops/native-prebuilt-publish.ts, nitro-superset.ts,
|
|
14
14
|
// expo-native-prebuilt.ts); a host only reads.
|
|
@@ -21,7 +21,7 @@ import { isRecord } from './is-record'
|
|
|
21
21
|
|
|
22
22
|
export const NATIVE_PREBUILT_ORIGIN = 'https://r2.rnxsim.com'
|
|
23
23
|
|
|
24
|
-
export type NativeEntryKind = 'expo' | 'nitro' | 'rust' | 'slice' | 'turbo'
|
|
24
|
+
export type NativeEntryKind = 'expo' | 'expo-pod' | 'nitro' | 'rust' | 'slice' | 'turbo'
|
|
25
25
|
|
|
26
26
|
export interface NativeEntryFile {
|
|
27
27
|
path: string
|