peachsim 0.1.1817 → 0.1.1821
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/agent-indicator-mode.ts +2 -1
- package/cli/commands/coverage-swift.ts +4 -3
- package/cli/commands/flow.ts +7 -0
- package/cli/commands/inspect/core.ts +14 -4
- package/cli/commands/inspect/wait-selector.ts +9 -1
- package/cli/commands/maestro-compare.ts +7 -0
- package/cli/commands/package.ts +5 -0
- package/cli/commands/screenshot-mode.ts +2 -1
- package/cli/commands/shell-boolean-mode.ts +7 -3
- package/cli/commands/shell-url.ts +4 -0
- package/cli/commands/show-touches-mode.ts +2 -1
- package/cli/commands/test.ts +3 -2
- package/cli/commands/three-mode.ts +2 -1
- package/cli/outbound-endpoints.ts +5 -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 +2842 -3830
- 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 +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +1722 -1580
- 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 +2800 -3794
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- 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 +32 -11
- 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 +28 -7
- package/dist-lib/native-app-identity-project.cjs +31 -6
- package/dist-lib/native-app-identity-project.mjs +295 -259
- 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 +29 -24
- package/dist-lib/public-origins-lib.json +100 -80
- 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 +8 -6
- package/dist-lib/sdk.mjs +8 -6
- package/dist-lib/skills.cjs +3192 -4150
- package/dist-lib/swift-compile.cjs +136 -29
- package/dist-lib/swift-compile.mjs +143 -34
- 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 +52 -6
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +2206 -2060
- package/dist-lib/vite.cjs +2 -2
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/ios/photoLibraryContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/render-worker/map-command-channel.d.ts +41 -0
- package/dist-types/packages/peach-engine/src/render-worker/mapServicesContract.d.ts +45 -0
- package/package.json +2 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +1 -1
- package/sdk/ios/usr/include/module.modulemap +3 -0
- package/sdk/ios/usr/include/notify.modulemap +9 -0
- package/sdk/ios/usr/lib/swift/Darwin.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/usr/lib/swift/Dispatch.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -1
- package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
- package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +21 -0
- package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -1
- package/sdk/ios/wasm/include/__header_time.h +4 -0
- package/sdk/ios/wasm/include/pthread.h +2 -0
- package/sdk/ios/wasm/include/sys/mman.h +1 -1
- package/sdk/ios/wasm/include/sys/resource.h +31 -0
- package/sdk/ios/wasm/include/unistd.h +4 -0
- package/src/answeredNativePackages.ts +11 -9
- package/src/expo-discovery-cache.ts +69 -52
- package/src/expo-native-workspace.ts +3 -1
- package/src/expo-swift-host.ts +45 -7
- package/src/installed-native-libraries.ts +103 -20
- package/src/native-static-libraries.ts +69 -33
- package/src/nitro-adapter.ts +0 -9
- package/src/nitro-compile.ts +45 -16
- package/src/nitro-superset.ts +4 -5
- package/src/plist-bytes.ts +9 -0
- package/src/portable-expo-workspace.ts +4 -3
- package/src/react-native-bridge-modules.ts +11 -15
- package/src/swift-compile.ts +146 -18
- package/src/swift-cxx-reachable.ts +13 -0
- package/src/swift-distribution.ts +3 -4
- package/src/swift-host.ts +5 -3
- package/src/swift-installed-targets.ts +32 -14
- package/src/swift-native-pin.ts +45 -0
- package/src/swift-objc-compile.ts +23 -1
- package/src/swift-objc-standin.ts +4 -1
- package/src/swift-package-manifest.ts +2 -2
- package/src/swift-root-lock.ts +4 -3
- package/src/swift-standins.ts +5 -26
- package/src/swift-toolchain.ts +69 -12
- package/src/swift-wasm-prune.ts +1 -0
- package/src/swift-xcframework.ts +23 -12
- package/src/swiftContract.ts +2 -0
- package/src/swiftNativePinContract.ts +68 -0
- package/src/turbo-bundle.ts +14 -6
- package/src/turbo-compile.ts +76 -11
- package/src/turbo-source.ts +91 -15
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// isolated homes instead of redoing the prepare and the workspace read.
|
|
5
5
|
// entries address content only; a store that cannot prove its paths refuses
|
|
6
6
|
// rather than serve bytes another home cannot trust.
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
7
|
+
// bodies, target metadata and units are separate content-addressed records.
|
|
8
|
+
// repeated headers and header maps share bytes without building one discovery-
|
|
9
|
+
// sized string on either the write or read path.
|
|
10
10
|
import { createHash, randomUUID } from 'node:crypto'
|
|
11
11
|
import fs from 'node:fs'
|
|
12
12
|
import { homedir } from 'node:os'
|
|
@@ -18,10 +18,10 @@ import { getCliVersion } from './cli-version'
|
|
|
18
18
|
import { hashExpoWorkspace } from './expo-native-workspace'
|
|
19
19
|
import { isRecord } from './is-record'
|
|
20
20
|
import { isNativeAppIdentity } from './native-app-identity'
|
|
21
|
-
import { isSwiftResourceBundles } from './swiftContract'
|
|
21
|
+
import { isSwiftNativeTargets, isSwiftResourceBundles } from './swiftContract'
|
|
22
22
|
import type { ExpoSwiftSourceUnit } from './expoSwiftContract'
|
|
23
23
|
|
|
24
|
-
const FORMAT = 'expo-discovery-
|
|
24
|
+
const FORMAT = 'expo-discovery-v5'
|
|
25
25
|
|
|
26
26
|
// pipeline files whose bytes change discovery output. resolved beside this
|
|
27
27
|
// module in source (.ts) and in a built cli (.js); a missing file pins as
|
|
@@ -137,15 +137,18 @@ function isExpoSwiftSourceUnit(value: unknown): value is ExpoSwiftSourceUnit {
|
|
|
137
137
|
// a stored unit holds blob digests where a live unit holds bodies.
|
|
138
138
|
type StoredExpoSwiftSourceUnit = Omit<
|
|
139
139
|
ExpoSwiftSourceUnit,
|
|
140
|
-
'files' | 'nativeFiles' | 'resources'
|
|
140
|
+
'files' | 'nativeFiles' | 'resources' | 'nativeTargets'
|
|
141
141
|
> & {
|
|
142
142
|
files: Record<string, string>
|
|
143
143
|
nativeFiles?: Record<string, string>
|
|
144
144
|
resources?: Record<string, string>
|
|
145
|
+
nativeTargets?: string[]
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
const isDigest = (value: string): boolean => /^[0-9a-f]{64}$/.test(value)
|
|
149
|
+
|
|
147
150
|
const digestRecord = (value: unknown): value is Record<string, string> =>
|
|
148
|
-
stringRecord(value) && Object.values(value).every(
|
|
151
|
+
stringRecord(value) && Object.values(value).every(isDigest)
|
|
149
152
|
|
|
150
153
|
function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
|
|
151
154
|
return (
|
|
@@ -159,7 +162,7 @@ function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
|
|
|
159
162
|
digestRecord(value.files) &&
|
|
160
163
|
strings(value.frameworks) &&
|
|
161
164
|
(value.nativeTargets === undefined ||
|
|
162
|
-
(
|
|
165
|
+
(strings(value.nativeTargets) && value.nativeTargets.every(isDigest))) &&
|
|
163
166
|
(value.nativeFiles === undefined || digestRecord(value.nativeFiles)) &&
|
|
164
167
|
(value.resources === undefined || digestRecord(value.resources)) &&
|
|
165
168
|
(value.resourceBundles === undefined ||
|
|
@@ -193,42 +196,53 @@ export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | u
|
|
|
193
196
|
return undefined
|
|
194
197
|
}
|
|
195
198
|
if (parsed.units === null) return null
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
if (!strings(parsed.units) || !parsed.units.every(isDigest)) return undefined
|
|
200
|
+
const blobs = new Map<string, string>()
|
|
201
|
+
const read = (digest: string): string => {
|
|
202
|
+
const known = blobs.get(digest)
|
|
203
|
+
if (known !== undefined) return known
|
|
204
|
+
const body = fs.readFileSync(path.join(sharedDir(), 'blobs', digest), 'utf8')
|
|
205
|
+
if (createHash('sha256').update(body).digest('hex') !== digest)
|
|
206
|
+
throw new Error('discovery blob differs from its digest')
|
|
207
|
+
blobs.set(digest, body)
|
|
208
|
+
return body
|
|
209
|
+
}
|
|
210
|
+
const resolve = (refs: Record<string, string>): Record<string, string> => {
|
|
204
211
|
const bodies: Record<string, string> = {}
|
|
205
212
|
for (const [name, digest] of Object.entries(refs)) {
|
|
206
|
-
|
|
207
|
-
if (body === undefined) return undefined
|
|
208
|
-
bodies[name] = body
|
|
213
|
+
bodies[name] = read(digest)
|
|
209
214
|
}
|
|
210
215
|
return bodies
|
|
211
216
|
}
|
|
212
217
|
const units: ExpoSwiftSourceUnit[] = []
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
try {
|
|
219
|
+
for (const digest of parsed.units) {
|
|
220
|
+
const stored: unknown = JSON.parse(read(digest))
|
|
221
|
+
if (!isStoredUnit(stored)) return undefined
|
|
222
|
+
const nativeTargets: unknown = stored.nativeTargets?.map((ref) =>
|
|
223
|
+
JSON.parse(read(ref)),
|
|
224
|
+
)
|
|
225
|
+
if (nativeTargets !== undefined && !isSwiftNativeTargets(nativeTargets))
|
|
226
|
+
return undefined
|
|
227
|
+
const files = resolve(stored.files)
|
|
228
|
+
const nativeFiles =
|
|
229
|
+
stored.nativeFiles === undefined ? undefined : resolve(stored.nativeFiles)
|
|
230
|
+
const resources =
|
|
231
|
+
stored.resources === undefined ? undefined : resolve(stored.resources)
|
|
232
|
+
const unit: ExpoSwiftSourceUnit = {
|
|
233
|
+
...stored,
|
|
234
|
+
nativeTargets,
|
|
235
|
+
files,
|
|
236
|
+
...(nativeFiles === undefined ? {} : { nativeFiles }),
|
|
237
|
+
...(resources === undefined ? {} : { resources }),
|
|
238
|
+
}
|
|
239
|
+
if (!isExpoSwiftSourceUnit(unit)) return undefined
|
|
240
|
+
units.push(unit)
|
|
227
241
|
}
|
|
228
|
-
|
|
229
|
-
|
|
242
|
+
return units
|
|
243
|
+
} catch {
|
|
244
|
+
return undefined
|
|
230
245
|
}
|
|
231
|
-
return units
|
|
232
246
|
}
|
|
233
247
|
|
|
234
248
|
const sourceLocationLine = /^#sourceLocation\(file: "(.*)", line: 1\)$/
|
|
@@ -458,7 +472,6 @@ export function writeExpoDiscovery(options: {
|
|
|
458
472
|
format: FORMAT,
|
|
459
473
|
key: options.key,
|
|
460
474
|
units: null,
|
|
461
|
-
blobs: {},
|
|
462
475
|
dependencies: {},
|
|
463
476
|
frameworks: {},
|
|
464
477
|
}),
|
|
@@ -475,48 +488,52 @@ export function writeExpoDiscovery(options: {
|
|
|
475
488
|
if ('refuse' in rewritten) return rewritten.refuse
|
|
476
489
|
// one blob per distinct body; units keep digests. repeated bodies hash
|
|
477
490
|
// once: string hashes memoize, so a shared body is a cheap map hit.
|
|
478
|
-
const
|
|
491
|
+
const blobDir = path.join(dir, 'blobs')
|
|
492
|
+
fs.mkdirSync(blobDir, { recursive: true })
|
|
479
493
|
const seen = new Map<string, string>()
|
|
480
494
|
const digestFor = (body: string): string => {
|
|
481
495
|
const known = seen.get(body)
|
|
482
496
|
if (known !== undefined) return known
|
|
497
|
+
options.signal?.throwIfAborted()
|
|
498
|
+
if (body.includes(options.preparedRoot))
|
|
499
|
+
throw new Error('a prepared path survives the rewrite')
|
|
483
500
|
const digest = createHash('sha256').update(body).digest('hex')
|
|
501
|
+
const file = path.join(blobDir, digest)
|
|
502
|
+
const temporary = path.join(blobDir, '.' + randomUUID() + '.tmp')
|
|
503
|
+
try {
|
|
504
|
+
fs.writeFileSync(temporary, body)
|
|
505
|
+
fs.renameSync(temporary, file)
|
|
506
|
+
} finally {
|
|
507
|
+
fs.rmSync(temporary, { force: true })
|
|
508
|
+
}
|
|
484
509
|
seen.set(body, digest)
|
|
485
|
-
blobs.set(digest, body)
|
|
486
510
|
return digest
|
|
487
511
|
}
|
|
488
512
|
const reference = (bodies: Record<string, string>) =>
|
|
489
513
|
Object.fromEntries(
|
|
490
514
|
Object.entries(bodies).map(([name, body]) => [name, digestFor(body)]),
|
|
491
515
|
)
|
|
492
|
-
const stored
|
|
516
|
+
const stored = rewritten.units.map((unit) => {
|
|
493
517
|
options.signal?.throwIfAborted()
|
|
494
|
-
|
|
518
|
+
const value: StoredExpoSwiftSourceUnit = {
|
|
495
519
|
...unit,
|
|
520
|
+
nativeTargets: unit.nativeTargets?.map((target) =>
|
|
521
|
+
digestFor(JSON.stringify(target)),
|
|
522
|
+
),
|
|
496
523
|
files: reference(unit.files),
|
|
497
524
|
...(unit.nativeFiles === undefined
|
|
498
525
|
? {}
|
|
499
526
|
: { nativeFiles: reference(unit.nativeFiles) }),
|
|
500
527
|
...(unit.resources === undefined ? {} : { resources: reference(unit.resources) }),
|
|
501
528
|
}
|
|
529
|
+
return digestFor(JSON.stringify(value))
|
|
502
530
|
})
|
|
503
|
-
// the surviving-path scan stays on bounded strings: the small reference
|
|
504
|
-
// maps, then each body alone. stringifying whole units here is what used
|
|
505
|
-
// to exceed the longest buildable string on large discoveries.
|
|
506
|
-
if (JSON.stringify(stored).includes(options.preparedRoot))
|
|
507
|
-
return 'a prepared path survives the rewrite'
|
|
508
|
-
for (const body of blobs.values()) {
|
|
509
|
-
options.signal?.throwIfAborted()
|
|
510
|
-
if (body.includes(options.preparedRoot))
|
|
511
|
-
return 'a prepared path survives the rewrite'
|
|
512
|
-
}
|
|
513
531
|
fs.writeFileSync(
|
|
514
532
|
tmp,
|
|
515
533
|
JSON.stringify({
|
|
516
534
|
format: FORMAT,
|
|
517
535
|
key: options.key,
|
|
518
536
|
units: stored,
|
|
519
|
-
blobs: Object.fromEntries(blobs),
|
|
520
537
|
dependencies: rewritten.dependencies,
|
|
521
538
|
frameworks: rewritten.frameworks,
|
|
522
539
|
}),
|
|
@@ -759,7 +759,9 @@ async function prepareNativeProject(
|
|
|
759
759
|
report: (message: string) => void,
|
|
760
760
|
) {
|
|
761
761
|
const appRequire = createRequire(path.join(app, 'package.json'))
|
|
762
|
-
|
|
762
|
+
// peach runs the new architecture only, and pods such as
|
|
763
|
+
// react-native-paste-input refuse to evaluate without it
|
|
764
|
+
const sourcePodEnv = { EXPO_USE_PRECOMPILED_MODULES: '0', RCT_NEW_ARCH_ENABLED: '1' }
|
|
763
765
|
const declares = (name: string) =>
|
|
764
766
|
Object.hasOwn(manifest.dependencies ?? {}, name) ||
|
|
765
767
|
Object.hasOwn(manifest.devDependencies ?? {}, name)
|
package/src/expo-swift-host.ts
CHANGED
|
@@ -29,6 +29,10 @@ import { cacheDir } from './home-paths'
|
|
|
29
29
|
import { isRecord } from './is-record'
|
|
30
30
|
import { readExpoConfigAsync } from './native-firebase-config'
|
|
31
31
|
import { NativePreparationReceipts } from './native-preparation'
|
|
32
|
+
import {
|
|
33
|
+
combineNativeStaticLibraries,
|
|
34
|
+
nonmodularFrameworkLibraries,
|
|
35
|
+
} from './native-static-libraries'
|
|
32
36
|
import {
|
|
33
37
|
NATIVE_PREPARE_QUERY_PARAM,
|
|
34
38
|
NATIVE_PREPARED_QUERY_PARAM,
|
|
@@ -641,7 +645,10 @@ function enrichInstalledUnits(
|
|
|
641
645
|
interfaceRoot?: string,
|
|
642
646
|
): void {
|
|
643
647
|
const { input, binaryFrameworks } = installed
|
|
644
|
-
|
|
648
|
+
// each unit generates its own binary stand-ins, so the workspace's are not re-mapped
|
|
649
|
+
const installedTargets = swiftManifestTargets(
|
|
650
|
+
input.files['Package.swift'] ?? '',
|
|
651
|
+
).filter((target) => !target.path.startsWith(`${SWIFT_STANDINS_DIR}/`))
|
|
645
652
|
const targetByName = new Map(installedTargets.map((target) => [target.name, target]))
|
|
646
653
|
const importedTargets = swiftTargetDependencies(input.files, installedTargets)
|
|
647
654
|
const byPath = [...installedTargets].sort((a, b) => b.path.length - a.path.length)
|
|
@@ -684,6 +691,12 @@ function enrichInstalledUnits(
|
|
|
684
691
|
}
|
|
685
692
|
for (const name of namespaceGroups.get(unit.namespace) ?? [unit.namespace])
|
|
686
693
|
visit(name, true)
|
|
694
|
+
// a unit lays each included target out at Sources/<name>, where its Bundle.module accessor reads the assignment
|
|
695
|
+
unit.resourceBundles = input.resourceBundles?.map((bundle) =>
|
|
696
|
+
targetByName.has(bundle.target)
|
|
697
|
+
? { ...bundle, sourcePath: `Sources/${bundle.target}` }
|
|
698
|
+
: bundle,
|
|
699
|
+
)
|
|
687
700
|
for (const [file, source] of Object.entries(input.files)) {
|
|
688
701
|
const owner = byPath.find((target) => file.startsWith(`${target.path}/`))
|
|
689
702
|
if (
|
|
@@ -1018,6 +1031,7 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1018
1031
|
{
|
|
1019
1032
|
configuration: 'Debug',
|
|
1020
1033
|
interfaceRoot: module.root,
|
|
1034
|
+
moduleRoot: module.root,
|
|
1021
1035
|
nativeModules: resolutions.flatMap((resolution) =>
|
|
1022
1036
|
isRecord(resolution) && Array.isArray(resolution.swiftModuleNames)
|
|
1023
1037
|
? resolution.swiftModuleNames.filter(
|
|
@@ -1637,7 +1651,7 @@ function expoManifest(
|
|
|
1637
1651
|
? [dependency.name]
|
|
1638
1652
|
: [],
|
|
1639
1653
|
)
|
|
1640
|
-
return `.target(name: ${JSON.stringify(name)}, dependencies: ${JSON.stringify(dependencies)}, path: ${JSON.stringify(dir)}${configuration ? ', ' + swiftManifestSettings(configuration) : ''})`
|
|
1654
|
+
return `.target(name: ${JSON.stringify(name)}, dependencies: ${JSON.stringify(dependencies)}, path: ${JSON.stringify(dir)}${declared?.resources ? ', resources: []' : ''}${configuration ? ', ' + swiftManifestSettings(configuration) : ''})`
|
|
1641
1655
|
})
|
|
1642
1656
|
return `// swift-tools-version: 6.0\nimport PackageDescription\nlet package = Package(name: "PeachExpo", targets: [${declarations.join(', ')}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])\n// stand-in inputs: ${generation}\n`
|
|
1643
1657
|
}
|
|
@@ -1645,7 +1659,9 @@ function expoManifest(
|
|
|
1645
1659
|
function targetSettings(units: ExpoSwiftSourceUnit[]) {
|
|
1646
1660
|
const settings = new Map<
|
|
1647
1661
|
string,
|
|
1648
|
-
Parameters<typeof swiftManifestSettings>[0] &
|
|
1662
|
+
Parameters<typeof swiftManifestSettings>[0] &
|
|
1663
|
+
Pick<SwiftPackageTarget, 'dependencies'> &
|
|
1664
|
+
Partial<Pick<SwiftPackageTarget, 'resources'>>
|
|
1649
1665
|
>()
|
|
1650
1666
|
for (const unit of units) {
|
|
1651
1667
|
for (const target of swiftManifestTargets(unit.files['Package.swift'] ?? ''))
|
|
@@ -1937,8 +1953,25 @@ async function compileExpoSwiftModulesTraced(
|
|
|
1937
1953
|
const generations = new Map<ExpoSwiftSourceUnit, string>()
|
|
1938
1954
|
const gaps = new Map<ExpoSwiftSourceUnit, string[]>()
|
|
1939
1955
|
const libraries = new Map<ExpoSwiftSourceUnit, Record<string, string>>()
|
|
1956
|
+
const [firstSharedLibrary, ...otherSharedLibraries] = nonmodularFrameworkLibraries(
|
|
1957
|
+
[...new Set(units.flatMap((unit) => unit.frameworks))],
|
|
1958
|
+
module.root,
|
|
1959
|
+
)
|
|
1960
|
+
const sharedLibrary =
|
|
1961
|
+
firstSharedLibrary === undefined
|
|
1962
|
+
? undefined
|
|
1963
|
+
: fs
|
|
1964
|
+
.readFileSync(
|
|
1965
|
+
combineNativeStaticLibraries(
|
|
1966
|
+
[firstSharedLibrary, ...otherSharedLibraries],
|
|
1967
|
+
module.root,
|
|
1968
|
+
),
|
|
1969
|
+
)
|
|
1970
|
+
.toString('base64')
|
|
1940
1971
|
for (const unit of units) {
|
|
1941
1972
|
signal.throwIfAborted()
|
|
1973
|
+
if (sharedLibrary !== undefined)
|
|
1974
|
+
libraries.set(unit, { [unit.namespace]: sharedLibrary })
|
|
1942
1975
|
if (unit.absentFrameworks)
|
|
1943
1976
|
gaps.set(
|
|
1944
1977
|
unit,
|
|
@@ -2025,15 +2058,15 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2025
2058
|
unit.nativeTargets.push(standinNativeTarget(standin, deploymentTarget))
|
|
2026
2059
|
}
|
|
2027
2060
|
if (linkedLibraries.size > 0)
|
|
2028
|
-
libraries.set(
|
|
2029
|
-
unit,
|
|
2030
|
-
Object.fromEntries(
|
|
2061
|
+
libraries.set(unit, {
|
|
2062
|
+
...libraries.get(unit),
|
|
2063
|
+
...Object.fromEntries(
|
|
2031
2064
|
[...linkedLibraries].map(([library, [first]]) => [
|
|
2032
2065
|
first!.module,
|
|
2033
2066
|
fs.readFileSync(library).toString('base64'),
|
|
2034
2067
|
]),
|
|
2035
2068
|
),
|
|
2036
|
-
)
|
|
2069
|
+
})
|
|
2037
2070
|
generations.set(unit, generation)
|
|
2038
2071
|
gaps.set(unit, [
|
|
2039
2072
|
...(gaps.get(unit) ?? []),
|
|
@@ -2114,8 +2147,13 @@ async function compileExpoSwiftModulesTraced(
|
|
|
2114
2147
|
),
|
|
2115
2148
|
)
|
|
2116
2149
|
const linkedLibraries = new Map<string, string>()
|
|
2150
|
+
let linkedSharedLibrary = false
|
|
2117
2151
|
for (const unit of linked)
|
|
2118
2152
|
for (const [name, library] of Object.entries(libraries.get(unit) ?? {})) {
|
|
2153
|
+
if (name === unit.namespace && library === sharedLibrary) {
|
|
2154
|
+
if (linkedSharedLibrary) continue
|
|
2155
|
+
linkedSharedLibrary = true
|
|
2156
|
+
}
|
|
2119
2157
|
if (linkedLibraries.has(name) && linkedLibraries.get(name) !== library)
|
|
2120
2158
|
throw new Error(`conflicting Expo Swift binary libraries for ${name}`)
|
|
2121
2159
|
linkedLibraries.set(name, library)
|
|
@@ -9,22 +9,24 @@ import { isRecord } from './is-record'
|
|
|
9
9
|
import {
|
|
10
10
|
combineNativeStaticLibraries,
|
|
11
11
|
nativeStaticLibrary,
|
|
12
|
+
nonmodularFrameworkLibraries,
|
|
12
13
|
nativeStaticLibraryRecipe,
|
|
13
14
|
} from './native-static-libraries'
|
|
14
15
|
import { readPackageFile, relativeInside } from './swift-source-file'
|
|
15
|
-
import {
|
|
16
|
+
import { simulatorNativeLibrary } from './swift-xcframework'
|
|
16
17
|
import { readXcodeAppTarget, requireInstalledXcodeWorkspace } from './xcode-project'
|
|
17
|
-
import type {
|
|
18
|
+
import type {
|
|
19
|
+
TurboInstalledPod,
|
|
20
|
+
TurboInstalledSources,
|
|
21
|
+
TurboProvider,
|
|
22
|
+
} from './turbo-source'
|
|
23
|
+
import type { XcodeModuleTarget } from './xcode-project'
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
function installedProviderTargets(
|
|
20
26
|
providers: readonly Pick<TurboProvider, 'name' | 'podspecPath'>[],
|
|
21
27
|
projectRoot: string,
|
|
22
|
-
moduleRoot: string,
|
|
23
28
|
iosTarget?: string,
|
|
24
|
-
|
|
25
|
-
): InstalledNativeLibraries {
|
|
26
|
-
const result: InstalledNativeLibraries = { pods: new Map(), unavailable: new Map() }
|
|
27
|
-
if (providers.length === 0) return result
|
|
29
|
+
) {
|
|
28
30
|
const workspace = requireInstalledXcodeWorkspace(projectRoot, 'native providers')
|
|
29
31
|
const app = readXcodeAppTarget(workspace, iosTarget, 'Release', {
|
|
30
32
|
installedPods: true,
|
|
@@ -34,6 +36,66 @@ export function installedNativeLibraries(
|
|
|
34
36
|
path.basename(provider.podspecPath, '.podspec'),
|
|
35
37
|
),
|
|
36
38
|
})
|
|
39
|
+
const targets = new Map<string, XcodeModuleTarget>()
|
|
40
|
+
for (const provider of providers) {
|
|
41
|
+
const name = path.basename(provider.podspecPath, '.podspec')
|
|
42
|
+
const target = app.frameworks.find((item) => item.name === name)
|
|
43
|
+
if (!target?.podRoot)
|
|
44
|
+
throw new Error(`${name}: installed target has no PODS_TARGET_SRCROOT`)
|
|
45
|
+
targets.set(provider.name, target)
|
|
46
|
+
}
|
|
47
|
+
return { app, targets }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function installedTargetSources(target: XcodeModuleTarget) {
|
|
51
|
+
const root = fs.realpathSync(target.podRoot!)
|
|
52
|
+
const files = new Set(
|
|
53
|
+
[
|
|
54
|
+
...target.allSources,
|
|
55
|
+
...(target.objc?.headers ?? []),
|
|
56
|
+
...(target.objc?.publicHeaders ?? []),
|
|
57
|
+
].map((file) => fs.realpathSync(file)),
|
|
58
|
+
)
|
|
59
|
+
return { root, files }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function installedNativeSources(
|
|
63
|
+
providers: readonly Pick<TurboProvider, 'name' | 'podspecPath'>[],
|
|
64
|
+
projectRoot: string,
|
|
65
|
+
iosTarget?: string,
|
|
66
|
+
): Map<string, TurboInstalledSources> {
|
|
67
|
+
if (providers.length === 0) return new Map()
|
|
68
|
+
const { targets } = installedProviderTargets(providers, projectRoot, iosTarget)
|
|
69
|
+
return new Map(
|
|
70
|
+
[...targets].map(([name, target]): [string, TurboInstalledSources] => {
|
|
71
|
+
const { root, files } = installedTargetSources(target)
|
|
72
|
+
return [
|
|
73
|
+
name,
|
|
74
|
+
{
|
|
75
|
+
root,
|
|
76
|
+
files: [...files]
|
|
77
|
+
.flatMap((file) => {
|
|
78
|
+
const relative = relativeInside(root, file)
|
|
79
|
+
return relative === null ? [] : [relative.split(path.sep).join('/')]
|
|
80
|
+
})
|
|
81
|
+
.sort(),
|
|
82
|
+
},
|
|
83
|
+
]
|
|
84
|
+
}),
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function installedNativeLibraries(
|
|
89
|
+
providers: readonly Pick<TurboProvider, 'name' | 'podspecPath'>[],
|
|
90
|
+
projectRoot: string,
|
|
91
|
+
moduleRoot: string,
|
|
92
|
+
iosTarget?: string,
|
|
93
|
+
frameworkLinkOwner: 'workspace' | 'provider' = 'workspace',
|
|
94
|
+
): InstalledNativeLibraries {
|
|
95
|
+
const result: InstalledNativeLibraries = { pods: new Map(), unavailable: new Map() }
|
|
96
|
+
if (providers.length === 0) return result
|
|
97
|
+
projectRoot = fs.realpathSync(projectRoot)
|
|
98
|
+
const { app, targets } = installedProviderTargets(providers, projectRoot, iosTarget)
|
|
37
99
|
const podsRoot = app.cocoapods && path.dirname(app.cocoapods.manifestLock)
|
|
38
100
|
const localPods = new Set(
|
|
39
101
|
(app.cocoapods?.localPodspecs ?? []).map((file) =>
|
|
@@ -49,6 +111,16 @@ export function installedNativeLibraries(
|
|
|
49
111
|
reactNativeRoot,
|
|
50
112
|
path.join(projectRoot, 'node_modules/react-native'),
|
|
51
113
|
]
|
|
114
|
+
// nonmodular frameworks publish their headers through CocoaPods search
|
|
115
|
+
// roots. their verified implementations link once through the shared core.
|
|
116
|
+
const [firstShared, ...otherShared] = nonmodularFrameworkLibraries(
|
|
117
|
+
app.binaryFrameworks.flatMap(({ path: directory }) => (directory ? [directory] : [])),
|
|
118
|
+
moduleRoot,
|
|
119
|
+
)
|
|
120
|
+
const sharedLibrary =
|
|
121
|
+
firstShared === undefined
|
|
122
|
+
? undefined
|
|
123
|
+
: combineNativeStaticLibraries([firstShared, ...otherShared], moduleRoot)
|
|
52
124
|
for (const provider of providers) {
|
|
53
125
|
const name = path.basename(provider.podspecPath, '.podspec')
|
|
54
126
|
const specFile = app.cocoapods?.localPodspecs.find(
|
|
@@ -71,10 +143,8 @@ export function installedNativeLibraries(
|
|
|
71
143
|
return value
|
|
72
144
|
throw new Error(`${specFile}: invalid vendored native paths`)
|
|
73
145
|
})
|
|
74
|
-
const target =
|
|
75
|
-
|
|
76
|
-
throw new Error(`${name}: installed target has no PODS_TARGET_SRCROOT`)
|
|
77
|
-
const root = fs.realpathSync(target.podRoot)
|
|
146
|
+
const target = targets.get(provider.name)!
|
|
147
|
+
const { root, files } = installedTargetSources(target)
|
|
78
148
|
// a declared archive selects its WebAssembly slice by its original bytes;
|
|
79
149
|
// one with no registered slice, or one CocoaPods selects through a
|
|
80
150
|
// subspec or a pattern, has no build peach can link.
|
|
@@ -82,7 +152,7 @@ export function installedNativeLibraries(
|
|
|
82
152
|
if (spec.subspecs || /[*?{]/.test(file)) return { file, recipe: null }
|
|
83
153
|
const declared = path.resolve(root, file)
|
|
84
154
|
const framework = declared.endsWith('.xcframework')
|
|
85
|
-
?
|
|
155
|
+
? simulatorNativeLibrary(declared)
|
|
86
156
|
: null
|
|
87
157
|
if (declared.endsWith('.xcframework') && !framework) return { file, recipe: null }
|
|
88
158
|
const native = framework?.file ?? declared
|
|
@@ -124,13 +194,6 @@ export function installedNativeLibraries(
|
|
|
124
194
|
return framework && frameworkLinkOwner === 'workspace' ? [] : [library]
|
|
125
195
|
})
|
|
126
196
|
const [firstLibrary, ...otherLibraries] = ownedLibraries
|
|
127
|
-
const files = new Set(
|
|
128
|
-
[
|
|
129
|
-
...target.allSources,
|
|
130
|
-
...(target.objc?.headers ?? []),
|
|
131
|
-
...(target.objc?.publicHeaders ?? []),
|
|
132
|
-
].map((file) => fs.realpathSync(file)),
|
|
133
|
-
)
|
|
134
197
|
const publicHeaders = new Set(
|
|
135
198
|
(target.objc?.publicHeaders ?? []).map((file) => fs.realpathSync(file)),
|
|
136
199
|
)
|
|
@@ -188,11 +251,30 @@ export function installedNativeLibraries(
|
|
|
188
251
|
return []
|
|
189
252
|
}),
|
|
190
253
|
})),
|
|
254
|
+
dependencyHeaderMaps: (target.objc?.headerMaps ?? []).map(({ flag, entries }) => ({
|
|
255
|
+
flag,
|
|
256
|
+
root: projectRoot,
|
|
257
|
+
entries: entries.flatMap(([name, file]): [string, string][] => {
|
|
258
|
+
if (reactNativeRoots.some((root) => relativeInside(root, file) !== null))
|
|
259
|
+
return []
|
|
260
|
+
const relative = relativeInside(projectRoot, file)
|
|
261
|
+
return relative === null ? [] : [[name, relative.split(path.sep).join('/')]]
|
|
262
|
+
}),
|
|
263
|
+
})),
|
|
191
264
|
headerSearchPaths: (target.objc?.headerSearchPaths ?? []).flatMap((directory) => {
|
|
192
265
|
if (!fs.existsSync(directory)) return []
|
|
193
266
|
const relative = relativeInside(root, fs.realpathSync(directory))
|
|
194
267
|
return relative === null ? [] : [relative.split(path.sep).join('/')]
|
|
195
268
|
}),
|
|
269
|
+
dependencySearchPaths: [...new Set(target.objc?.headerSearchPaths ?? [])].flatMap(
|
|
270
|
+
(directory) => {
|
|
271
|
+
if (!fs.statSync(directory, { throwIfNoEntry: false })?.isDirectory()) return []
|
|
272
|
+
const canonical = fs.realpathSync(directory)
|
|
273
|
+
if (relativeInside(root, canonical) !== null) return []
|
|
274
|
+
const relative = relativeInside(projectRoot, canonical)
|
|
275
|
+
return relative === null ? [] : [{ root: projectRoot, directory: relative }]
|
|
276
|
+
},
|
|
277
|
+
),
|
|
196
278
|
publicHeaders: [...publicHeaders].flatMap((file) => {
|
|
197
279
|
const relative = relativeInside(root, fs.realpathSync(file))
|
|
198
280
|
return relative === null ? [] : [relative.split(path.sep).join('/')]
|
|
@@ -207,6 +289,7 @@ export function installedNativeLibraries(
|
|
|
207
289
|
moduleRoot,
|
|
208
290
|
),
|
|
209
291
|
}),
|
|
292
|
+
...(sharedLibrary === undefined ? {} : { sharedLibrary }),
|
|
210
293
|
files: [...files]
|
|
211
294
|
.flatMap((file) => {
|
|
212
295
|
const relative = relativeInside(root, file)
|