peachsim 0.1.1808 → 0.1.1811
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/README.md +4 -2
- package/cli/app-bundle-resources.ts +15 -2
- package/cli/cloud-box-artifact.ts +115 -0
- package/cli/cloud-client.ts +95 -53
- package/cli/cloud-dispatch.ts +4 -4
- package/cli/cloud-session.ts +60 -22
- package/cli/commands/box.ts +8 -2
- package/cli/commands/compat.ts +7 -4
- package/cli/commands/control.ts +60 -3
- package/cli/commands/coverage.ts +14 -4
- package/cli/commands/daemon.ts +41 -0
- package/cli/commands/no-bridge-hint.ts +9 -0
- package/cli/commands/package.ts +31 -56
- package/cli/commands/platform.ts +70 -52
- package/cli/commands/preview.ts +73 -24
- package/cli/commands/record.ts +10 -2
- package/cli/commands/screenshot.ts +17 -60
- package/cli/commands/setup.ts +3 -1
- package/cli/commands/three-mode.ts +22 -12
- package/cli/commands/upload.ts +2 -1
- package/cli/desktop-companion.ts +6 -1
- package/cli/drivers/desktop.ts +4 -1
- package/cli/main.ts +12 -2
- package/cli/metro-bundle-assets.ts +14 -4
- package/cli/outbound-endpoints.ts +7 -3
- package/cli/output-redaction.ts +38 -0
- package/cli/privacy.ts +2 -2
- package/cli/recording-access.ts +5 -0
- package/cli/remote-project-bundle.ts +83 -0
- package/cli/shell-init.ts +7 -11
- package/cli/telemetry.ts +41 -4
- package/cli/usage-error.ts +3 -0
- package/cli/ws-bridge.ts +42 -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 +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 +42783 -40717
- package/dist-lib/capture-contract.cjs +7 -8
- package/dist-lib/capture-contract.mjs +7 -8
- 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 +13 -7
- package/dist-lib/dev-bundle-resolution.cjs +10 -4
- package/dist-lib/expo-swift-bundle.cjs +15819 -15559
- package/dist-lib/expo-swift-metadata.cjs +2 -1
- package/dist-lib/expo-swift-metadata.mjs +2 -1
- package/dist-lib/home-paths.cjs +2 -33
- package/dist-lib/host/bridge-host.cjs +20857 -18756
- package/dist-lib/host/fetch-proxy-handler.cjs +10 -10
- 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 +588 -544
- 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 +25 -19
- package/dist-lib/native-app-identity-project.cjs +15 -6
- package/dist-lib/native-app-identity-project.mjs +23 -12
- 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 +27 -26
- package/dist-lib/public-origins-lib.json +104 -81
- 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 +30496 -24309
- package/dist-lib/swift-compile.cjs +292 -213
- package/dist-lib/swift-compile.mjs +334 -254
- package/dist-lib/swift-package.cjs +8 -4
- package/dist-lib/swift-package.mjs +8 -4
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +32 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +19172 -18941
- package/dist-lib/vite.cjs +11 -11
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/animated.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/expo-manifest.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +8 -1
- package/dist-types/packages/peach-globals/src/electronBridgeContract.d.ts +2 -1
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCall.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCallCenter.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCarrier.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriber.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriberInfo.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSExtensionItem.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVFoundation+MPNowPlayingInfoLanguageOptionAdditions.h +39 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVPlayerItem+MediaPlayerAdditions.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPContentItem.h +67 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPError.h +33 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaEntity.h +53 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItem.h +346 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItemCollection.h +42 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaLibrary.h +76 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPickerController.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlayback.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlaylist.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuery.h +120 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuerySection.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerController.h +444 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerViewController.h +43 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerApplicationController.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerController.h +147 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerQueueDescriptor.h +75 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoCenter.h +197 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoLanguageOption.h +107 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingSession.h +89 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDataSource.h +59 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDelegate.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManager.h +46 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManagerContext.h +32 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommand.h +143 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandCenter.h +66 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandEvent.h +128 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteControlTypes.h +27 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeSettings.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeView.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.apinotes +74 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.h +40 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayerDefines.h +84 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/NSUserActivity+MediaPlayerAdditions.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityCustomRotor.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBackgroundConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIButtonConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuInteraction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDeferredMenuElement.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenu.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPointerStyle.h +5 -5
- package/sdk/ios/usr/include/dispatch.modulemap +22 -0
- package/sdk/ios/usr/include/net/if.h +24 -0
- package/sdk/ios/usr/include/sys/time.h +1 -1
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +265 -0
- package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
- package/sdk/ios/wasm/include/fcntl.h +2 -0
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/stdlib.h +2 -0
- package/sdk/ios/wasm/include/unistd.h +2 -2
- package/skills/contrast/SKILL.md +2 -2
- package/src/bundle-channel.mjs +9 -72
- package/src/capture-contract.ts +12 -9
- package/src/desktop-host-delivery.ts +16 -2
- package/src/dev-bundle-resolution.ts +12 -3
- package/src/expo-native-workspace.ts +57 -19
- package/src/expo-swift-host.ts +17 -12
- package/src/expo-swift-ready.ts +4 -1
- package/src/expoSwiftContract.ts +1 -0
- package/src/home-paths.ts +4 -48
- package/src/host/bridge-host.ts +1 -0
- package/src/installed-native-libraries.ts +2 -8
- package/src/metro-project-root.ts +2 -1
- package/src/native-bundles.ts +122 -0
- package/src/native-static-libraries.ts +65 -8
- package/src/nitro-adapter.lock.json +278 -278
- package/src/nitro-bundle.ts +2 -2
- package/src/nitro-compile.ts +68 -28
- package/src/nitro-source.ts +24 -6
- package/src/nitro-superset.lock.json +94 -34
- package/src/nitroContract.ts +2 -0
- package/src/podspec-sources.ts +1966 -0
- package/src/storageSnapshotContract.ts +40 -0
- package/src/swift-compile.ts +57 -20
- package/src/swift-design-time.ts +18 -1
- package/src/swift-distribution.lock.json +11 -11
- package/src/swift-distribution.ts +9 -6
- package/src/swift-host.ts +1 -2
- package/src/swift-objc-standin.ts +316 -112
- package/src/swift-package-manifest.ts +4 -3
- package/src/swift-package.ts +10 -3
- package/src/swift-root-lock.ts +11 -0
- package/src/swift-shared-sdk.ts +10 -9
- package/src/swift-source-pods.ts +2 -2
- package/src/swift-standins.ts +40 -143
- package/src/swift-toolchain.ts +42 -0
- package/src/swift-wasm-prune.ts +53 -21
- package/src/turbo-bundle.ts +2 -2
- package/src/turbo-codegen-intake.ts +111 -108
- package/src/turbo-compile.ts +63 -33
- package/src/turbo-runtime.lock.json +21 -21
- package/src/turbo-source.ts +171 -76
- package/src/wasm-optimize.ts +31 -2
- package/src/xcode-project.ts +36 -3
package/src/swift-source-pods.ts
CHANGED
|
@@ -5,7 +5,7 @@ import yaml from 'yaml'
|
|
|
5
5
|
import { cacheDir } from './home-paths'
|
|
6
6
|
import { compileInput, withXcodeProject, prepareXcodeSwiftPackages } from './swift-host'
|
|
7
7
|
import { swiftManifestTargets } from './swift-package'
|
|
8
|
-
import { withSwiftRootLock } from './swift-root-lock'
|
|
8
|
+
import { withCocoaPodsCacheLock, withSwiftRootLock } from './swift-root-lock'
|
|
9
9
|
import { readXcodeAppTarget } from './xcode-project'
|
|
10
10
|
import type { SwiftCompileInput } from './swift-compile'
|
|
11
11
|
|
|
@@ -316,7 +316,7 @@ export async function collectSwiftSourcePods(
|
|
|
316
316
|
fs.writeFileSync(path.join(work, `${APP}.xcodeproj/project.pbxproj`), project)
|
|
317
317
|
fs.writeFileSync(path.join(work, 'main.swift'), 'import Foundation\n')
|
|
318
318
|
fs.writeFileSync(path.join(work, 'Podfile'), podfile)
|
|
319
|
-
await runPod(['install'])
|
|
319
|
+
await withCocoaPodsCacheLock(() => runPod(['install']))
|
|
320
320
|
fs.writeFileSync(complete, key)
|
|
321
321
|
}
|
|
322
322
|
const actualLock: unknown = yaml.parse(fs.readFileSync(installed, 'utf8'))
|
package/src/swift-standins.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { execFileSync, spawn, spawnSync } from 'node:child_process'
|
|
|
13
13
|
import { createHash } from 'node:crypto'
|
|
14
14
|
import fs from 'node:fs'
|
|
15
15
|
import path from 'node:path'
|
|
16
|
-
import { cacheDir as peachCacheDir
|
|
16
|
+
import { cacheDir as peachCacheDir } from './home-paths'
|
|
17
17
|
import { isRecord } from './is-record'
|
|
18
18
|
import { fetchNativeEntry, nativeEntryKey } from './native-prebuilt'
|
|
19
19
|
import { nativeSliceEntry, NATIVE_SLICE_RECIPES } from './native-slices'
|
|
@@ -34,14 +34,10 @@ import {
|
|
|
34
34
|
swiftSdkPaths,
|
|
35
35
|
} from './swift-compile'
|
|
36
36
|
import { emitCxxStandin } from './swift-cxx-standin'
|
|
37
|
-
import { IOS_SDK_TARGET } from './swift-objc-sdk'
|
|
38
37
|
import {
|
|
39
38
|
IOS_SDK_ID,
|
|
40
|
-
NATIVE_GRAPH_ID,
|
|
41
|
-
pinnedNativeSdkReady,
|
|
42
39
|
WASI_EMULATION,
|
|
43
40
|
WASI_EMULATION_FLAGS,
|
|
44
|
-
nativeInterfaceView,
|
|
45
41
|
moduleMapHeaders,
|
|
46
42
|
objcView,
|
|
47
43
|
type ObjcSurface,
|
|
@@ -65,7 +61,11 @@ import {
|
|
|
65
61
|
synthesizedInterfaceEnums,
|
|
66
62
|
restoreSwiftInterfaceSPI,
|
|
67
63
|
} from './swift-standin-emit'
|
|
68
|
-
import {
|
|
64
|
+
import {
|
|
65
|
+
sourceSwiftCheckout,
|
|
66
|
+
swiftEnvironment,
|
|
67
|
+
swiftPackageCacheOptions,
|
|
68
|
+
} from './swift-toolchain'
|
|
69
69
|
import { simulatorStaticArchive } from './swift-xcframework'
|
|
70
70
|
import type { SwiftPackageBinary } from './swift-packages'
|
|
71
71
|
|
|
@@ -663,15 +663,6 @@ function surfaces(
|
|
|
663
663
|
return found
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
-
export function standinsNeedNativeSdk(binaries: readonly SwiftPackageBinary[]): boolean {
|
|
667
|
-
return binaries.some(
|
|
668
|
-
(binary) =>
|
|
669
|
-
binary.publicHeaders === undefined &&
|
|
670
|
-
binary.placeholder === undefined &&
|
|
671
|
-
surfaces(xcframework(binary).dir).some((surface) => surface.kind === 'mixed'),
|
|
672
|
-
)
|
|
673
|
-
}
|
|
674
|
-
|
|
675
666
|
// the peach modules an interface imports, compiled for wasm: a distribution
|
|
676
667
|
// ships them; a checkout builds the ones named into its own build directory,
|
|
677
668
|
// with the flags scripts/build.sh uses, so the two share one build.
|
|
@@ -734,11 +725,30 @@ function peachModuleDirs(
|
|
|
734
725
|
// swiftpm generated in its build directory. a peach module re-exporting one
|
|
735
726
|
// fails to load without it
|
|
736
727
|
const release = path.join(moduleRoot, '.build', TRIPLE, 'release')
|
|
728
|
+
const declarations = swiftManifestDeclarations(
|
|
729
|
+
fs.readFileSync(path.join(moduleRoot, 'Package.swift'), 'utf8'),
|
|
730
|
+
)
|
|
731
|
+
const supplied = new Set(
|
|
732
|
+
declarations
|
|
733
|
+
.filter(
|
|
734
|
+
(target) =>
|
|
735
|
+
sdkIncludes.some((dir) =>
|
|
736
|
+
fs.existsSync(path.join(dir, target.name, 'module.modulemap')),
|
|
737
|
+
) ||
|
|
738
|
+
fs.existsSync(
|
|
739
|
+
path.join(
|
|
740
|
+
moduleRoot,
|
|
741
|
+
target.path,
|
|
742
|
+
target.kind === 'systemLibrary' ? '' : 'include',
|
|
743
|
+
'module.modulemap',
|
|
744
|
+
),
|
|
745
|
+
),
|
|
746
|
+
)
|
|
747
|
+
.map((target) => target.name),
|
|
748
|
+
)
|
|
737
749
|
return [
|
|
738
750
|
path.join(release, 'Modules'),
|
|
739
|
-
...
|
|
740
|
-
fs.readFileSync(path.join(moduleRoot, 'Package.swift'), 'utf8'),
|
|
741
|
-
)
|
|
751
|
+
...declarations
|
|
742
752
|
// the sdk already exposes some of these modules (DarwinRecords in its
|
|
743
753
|
// sysroot, libxml2 in its darwin intake). adding the source copy of the
|
|
744
754
|
// same module map redefines that module.
|
|
@@ -761,6 +771,7 @@ function peachModuleDirs(
|
|
|
761
771
|
.filter(
|
|
762
772
|
(name) =>
|
|
763
773
|
name.endsWith('.build') &&
|
|
774
|
+
!supplied.has(name.slice(0, -'.build'.length)) &&
|
|
764
775
|
fs.existsSync(path.join(release, name, 'module.modulemap')),
|
|
765
776
|
)
|
|
766
777
|
.sort()
|
|
@@ -1115,7 +1126,15 @@ function mixedStandin(
|
|
|
1115
1126
|
frameworkDirs: readonly string[],
|
|
1116
1127
|
siblings: ReadonlySet<string>,
|
|
1117
1128
|
): SwiftStandin {
|
|
1118
|
-
const view =
|
|
1129
|
+
const view = objcView(
|
|
1130
|
+
surface,
|
|
1131
|
+
toolchain.toolchainBin,
|
|
1132
|
+
path.join(toolchain.moduleRoot, 'ios-simulator-stdlib'),
|
|
1133
|
+
cacheDir,
|
|
1134
|
+
path.join(work, 'objc'),
|
|
1135
|
+
undefined,
|
|
1136
|
+
frameworkDirs,
|
|
1137
|
+
)
|
|
1119
1138
|
const interfaceText = fs.readFileSync(surface.interface, 'utf8')
|
|
1120
1139
|
restoreSwiftInterfaceSPI(interfaceText, surface.module, view.graphs)
|
|
1121
1140
|
const values = new Map([
|
|
@@ -1166,116 +1185,13 @@ function mixedStandin(
|
|
|
1166
1185
|
behavior,
|
|
1167
1186
|
imports,
|
|
1168
1187
|
true,
|
|
1169
|
-
|
|
1170
|
-
? nativeProtocolProperties(surface, view.graphs, frameworkDirs, work)
|
|
1171
|
-
: new Map(),
|
|
1188
|
+
view.protocolProperties ?? new Map(),
|
|
1172
1189
|
null,
|
|
1173
1190
|
view.inheritedConformances,
|
|
1174
1191
|
interfaceProjections(view.graphs, interfaceText),
|
|
1175
1192
|
)
|
|
1176
1193
|
}
|
|
1177
1194
|
|
|
1178
|
-
// symbol graphs omit custom property accessors. clang reads those selectors
|
|
1179
|
-
// from the same native headers before a referenced objc protocol is emitted.
|
|
1180
|
-
function nativeProtocolProperties(
|
|
1181
|
-
surface: Extract<Surface, { kind: 'mixed' }>,
|
|
1182
|
-
graphs: SymbolGraph[],
|
|
1183
|
-
frameworkDirs: readonly string[],
|
|
1184
|
-
work: string,
|
|
1185
|
-
): Map<string, { getter: string; setter?: string }> {
|
|
1186
|
-
const properties = new Map<string, { getter: string; setter?: string }>()
|
|
1187
|
-
const protocols = objcProtocolsInSwiftSignatures(graphs)
|
|
1188
|
-
if (protocols.size === 0) return properties
|
|
1189
|
-
const headers = files(surface.headers, (name) => name.endsWith('.h')).map((name) => ({
|
|
1190
|
-
file: path.join(surface.headers, name),
|
|
1191
|
-
text: fs.readFileSync(path.join(surface.headers, name), 'utf8'),
|
|
1192
|
-
}))
|
|
1193
|
-
// runner-toolchain-platform: darwin
|
|
1194
|
-
const sdk = exec('xcrun', ['--sdk', 'iphonesimulator', '--show-sdk-path']).trim()
|
|
1195
|
-
// runner-toolchain-platform: darwin
|
|
1196
|
-
const clang = exec('xcrun', ['--find', 'clang']).trim()
|
|
1197
|
-
for (const id of protocols) {
|
|
1198
|
-
const name = /^c:objc\(pl\)(\w+)$/.exec(id)?.[1]
|
|
1199
|
-
if (!name) throw new Error(`unknown Objective-C protocol identity ${id}`)
|
|
1200
|
-
const pattern = new RegExp(`@protocol\\s+${name}\\b(?!\\s*;)`)
|
|
1201
|
-
const candidates = headers.filter((header) => pattern.test(header.text))
|
|
1202
|
-
if (candidates.length === 0)
|
|
1203
|
-
throw new Error(`native headers have no definition of Objective-C protocol ${name}`)
|
|
1204
|
-
const probe = path.join(work, 'objc-protocol-properties.m')
|
|
1205
|
-
fs.writeFileSync(
|
|
1206
|
-
probe,
|
|
1207
|
-
// the module's own roots first: a defining header may rely on the
|
|
1208
|
-
// declarations its umbrella imports before it, as NS_ENUM does
|
|
1209
|
-
[
|
|
1210
|
-
...moduleMapHeaders(surface.modulemap).map((file) =>
|
|
1211
|
-
path.join(surface.headers, file),
|
|
1212
|
-
),
|
|
1213
|
-
...candidates.map(({ file }) => file),
|
|
1214
|
-
]
|
|
1215
|
-
.map((file) => `#import ${JSON.stringify(file)}\n`)
|
|
1216
|
-
.join(''),
|
|
1217
|
-
)
|
|
1218
|
-
const output = exec(clang, [
|
|
1219
|
-
'-x',
|
|
1220
|
-
'objective-c',
|
|
1221
|
-
'-fobjc-arc',
|
|
1222
|
-
'-fblocks',
|
|
1223
|
-
'-fmodules',
|
|
1224
|
-
`-fmodule-name=${surface.module}`,
|
|
1225
|
-
'-fsyntax-only',
|
|
1226
|
-
'-target',
|
|
1227
|
-
IOS_SDK_TARGET,
|
|
1228
|
-
'-isysroot',
|
|
1229
|
-
sdk,
|
|
1230
|
-
...frameworkDirs.flatMap((dir) => ['-F', dir]),
|
|
1231
|
-
'-I',
|
|
1232
|
-
surface.headers,
|
|
1233
|
-
'-Xclang',
|
|
1234
|
-
'-ast-dump-all=json',
|
|
1235
|
-
'-Xclang',
|
|
1236
|
-
'-ast-dump-filter',
|
|
1237
|
-
'-Xclang',
|
|
1238
|
-
name,
|
|
1239
|
-
probe,
|
|
1240
|
-
])
|
|
1241
|
-
let found = false
|
|
1242
|
-
for (const chunk of output.split(/\n(?=\{\n)/).filter((part) => part.trim())) {
|
|
1243
|
-
const declaration: unknown = JSON.parse(chunk)
|
|
1244
|
-
if (
|
|
1245
|
-
!isRecord(declaration) ||
|
|
1246
|
-
declaration.kind !== 'ObjCProtocolDecl' ||
|
|
1247
|
-
declaration.name !== name ||
|
|
1248
|
-
!Array.isArray(declaration.inner)
|
|
1249
|
-
)
|
|
1250
|
-
continue
|
|
1251
|
-
found = true
|
|
1252
|
-
for (const child of declaration.inner) {
|
|
1253
|
-
if (
|
|
1254
|
-
!isRecord(child) ||
|
|
1255
|
-
child.kind !== 'ObjCPropertyDecl' ||
|
|
1256
|
-
typeof child.name !== 'string'
|
|
1257
|
-
)
|
|
1258
|
-
continue
|
|
1259
|
-
const getter =
|
|
1260
|
-
isRecord(child.getter) && typeof child.getter.name === 'string'
|
|
1261
|
-
? child.getter.name
|
|
1262
|
-
: child.name
|
|
1263
|
-
const setter =
|
|
1264
|
-
isRecord(child.setter) && typeof child.setter.name === 'string'
|
|
1265
|
-
? child.setter.name
|
|
1266
|
-
: `set${child.name[0]?.toUpperCase() ?? ''}${child.name.slice(1)}:`
|
|
1267
|
-
properties.set(`${id}(py)${child.name}`, {
|
|
1268
|
-
getter,
|
|
1269
|
-
...(child.readonly === true ? {} : { setter }),
|
|
1270
|
-
})
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
if (!found)
|
|
1274
|
-
throw new Error(`clang found no definition of Objective-C protocol ${name}`)
|
|
1275
|
-
}
|
|
1276
|
-
return properties
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
1195
|
// the sdk toolset passes this to every swiftc compile; raw swiftc does not read the toolset,
|
|
1280
1196
|
// and emitting a module aborts without it when the source reaches the wasm exception model.
|
|
1281
1197
|
// swift-symbolgraph-extract has no -Xllvm.
|
|
@@ -2299,7 +2215,6 @@ async function sourceStandins(
|
|
|
2299
2215
|
behavior,
|
|
2300
2216
|
generation: preparedGeneration,
|
|
2301
2217
|
release: toolchain.release,
|
|
2302
|
-
native: standinsNeedNativeSdk(local),
|
|
2303
2218
|
}),
|
|
2304
2219
|
)
|
|
2305
2220
|
// the submit waits on remote admission for minutes; it runs async so the
|
|
@@ -2508,11 +2423,6 @@ export function standinGenerationInputs(
|
|
|
2508
2423
|
surfaces(xcframework(binary).dir).some((surface) => surface.kind === 'swift')
|
|
2509
2424
|
)
|
|
2510
2425
|
parts.push(`interface-emulation/${WASI_EMULATION.join(',')}`)
|
|
2511
|
-
if (
|
|
2512
|
-
binary.publicHeaders === undefined &&
|
|
2513
|
-
surfaces(xcframework(binary).dir).some((surface) => surface.kind === 'mixed')
|
|
2514
|
-
)
|
|
2515
|
-
parts.push(`native-graph/${NATIVE_GRAPH_ID}`)
|
|
2516
2426
|
parts.push(
|
|
2517
2427
|
binary.target,
|
|
2518
2428
|
binary.source,
|
|
@@ -2758,24 +2668,11 @@ export async function swiftStandins(
|
|
|
2758
2668
|
): Promise<SwiftStandins> {
|
|
2759
2669
|
const requested = binaries.filter((binary) => !provided.has(binary.target))
|
|
2760
2670
|
if (requested.length === 0) return { standins: [], gaps: new Map() }
|
|
2761
|
-
// agent sessions set CI, which used to force every stand-in onto the local
|
|
2762
|
-
// xcode. a mixed framework still has to be extracted where the pinned sdk
|
|
2763
|
-
// is installed; an older selected sdk is not a stand-in.
|
|
2764
|
-
const pinnedSdkMissing =
|
|
2765
|
-
process.env.CI === 'true' &&
|
|
2766
|
-
requested.some((binary) => {
|
|
2767
|
-
try {
|
|
2768
|
-
return standinsNeedNativeSdk([binary])
|
|
2769
|
-
} catch {
|
|
2770
|
-
return false
|
|
2771
|
-
}
|
|
2772
|
-
}) &&
|
|
2773
|
-
!pinnedNativeSdkReady()
|
|
2774
2671
|
if (
|
|
2775
2672
|
process.platform === 'darwin' &&
|
|
2776
2673
|
process.env.TM_EXEC_BUILD_PLATFORM !== 'mac' &&
|
|
2777
2674
|
process.env.TM_SESSION &&
|
|
2778
|
-
|
|
2675
|
+
process.env.CI !== 'true' &&
|
|
2779
2676
|
toolchain.moduleRoot === sourceSwiftCheckout() &&
|
|
2780
2677
|
!swiftDistributionAt(toolchain.moduleRoot)
|
|
2781
2678
|
)
|
package/src/swift-toolchain.ts
CHANGED
|
@@ -452,6 +452,48 @@ function peachHome(): string {
|
|
|
452
452
|
return override ? path.resolve(override) : path.join(os.homedir(), '.peach')
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
+
export const BUILDERS_ROOT_ENV = 'CONTRAST_BUILDERS_ROOT'
|
|
456
|
+
|
|
457
|
+
// builder sessions export the resolved native build root (`<heavy>/builders`
|
|
458
|
+
// when machine policy configures heavy storage, else `~/builders`).
|
|
459
|
+
// remote.sh refuses before source transfer when a configured root is
|
|
460
|
+
// unavailable, so a set value is always usable and nothing here falls back to
|
|
461
|
+
// the internal disk: a missing directory fails at first write like the other
|
|
462
|
+
// heavy-root consumers.
|
|
463
|
+
function buildersRootEnv(): string | null {
|
|
464
|
+
const root = process.env[BUILDERS_ROOT_ENV]?.trim()
|
|
465
|
+
return root ? root : null
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// machine-wide swift scratch and package caches, shared across lanes. keep
|
|
469
|
+
// their implementation with the compiler so daemon edits cannot cold-split
|
|
470
|
+
// the twin warm trees. the complete implementation remains a hashed input.
|
|
471
|
+
export function swiftCacheDir(): string {
|
|
472
|
+
const root = buildersRootEnv()
|
|
473
|
+
return root ? path.join(root, 'peach-cache') : path.join(peachHome(), 'cache')
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// shared builder roots are serialized by the content key's existing lock;
|
|
477
|
+
// local checkouts keep their private source roots outside the artifact cache.
|
|
478
|
+
export function swiftProjectBuildsDir(checkoutRoot: string): string {
|
|
479
|
+
const root = buildersRootEnv()
|
|
480
|
+
return root
|
|
481
|
+
? path.join(swiftCacheDir(), 'swift-project-builds')
|
|
482
|
+
: path.join(checkoutRoot, 'scripts', 'tmp', 'swift-projects')
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// isolated swiftpm caches retain netrc and never prompt for a keychain.
|
|
486
|
+
export function swiftPackageCacheOptions(): string[] {
|
|
487
|
+
const root = path.join(swiftCacheDir(), 'swiftpm')
|
|
488
|
+
return [
|
|
489
|
+
...['cache', 'config', 'security'].flatMap((name) => [
|
|
490
|
+
`--${name}-path`,
|
|
491
|
+
path.join(root, name),
|
|
492
|
+
]),
|
|
493
|
+
'--disable-keychain',
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
|
|
455
497
|
let scratch: { directory: string; home: string } | undefined
|
|
456
498
|
let linuxLibraryPath: string | undefined
|
|
457
499
|
let linuxHostSdkRoot: string | undefined
|
package/src/swift-wasm-prune.ts
CHANGED
|
@@ -676,15 +676,13 @@ function parseWasmObjectBytes(
|
|
|
676
676
|
}
|
|
677
677
|
|
|
678
678
|
const typePrefixesInObj = new Set<string>()
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
)
|
|
686
|
-
typePrefixesInObj.add(symNames[i]!.slice(0, -2))
|
|
687
|
-
}
|
|
679
|
+
for (let i = 0; i < symKind.length; i++) {
|
|
680
|
+
if (
|
|
681
|
+
(symFlags[i]! & 0x10) === 0 &&
|
|
682
|
+
symNames[i]!.startsWith('$s') &&
|
|
683
|
+
symNames[i]!.endsWith('Mn')
|
|
684
|
+
) {
|
|
685
|
+
typePrefixesInObj.add(symNames[i]!.slice(0, -2))
|
|
688
686
|
}
|
|
689
687
|
}
|
|
690
688
|
|
|
@@ -1037,17 +1035,18 @@ export function pruneSwiftWasmLink(
|
|
|
1037
1035
|
workQueue.push({ kind: 'datasym', obj, symIdx })
|
|
1038
1036
|
}
|
|
1039
1037
|
|
|
1040
|
-
//
|
|
1041
|
-
//
|
|
1042
|
-
const
|
|
1038
|
+
// foreign conformances wait for their type, including types defined in SDK
|
|
1039
|
+
// objects that the linker keeps whole. no value of a dead type can reach a cast.
|
|
1040
|
+
const knownTypes = new Set<string>()
|
|
1043
1041
|
for (const o of distObjs.values())
|
|
1044
|
-
for (const t of o.typePrefixesInObj)
|
|
1042
|
+
for (const t of o.typePrefixesInObj) knownTypes.add(t)
|
|
1045
1043
|
const globalLiveTypes = new Set<string>()
|
|
1046
1044
|
const pendingConformances = new Map<string, { obj: ParsedObject; symIdx: number }[]>()
|
|
1045
|
+
const eagerConformanceObjects = new Set<ParsedObject>()
|
|
1047
1046
|
const conformingType = (name: string): string | undefined => {
|
|
1048
1047
|
for (let n = name.length - 1; n > 2; n--) {
|
|
1049
1048
|
const prefix = name.slice(0, n)
|
|
1050
|
-
if (
|
|
1049
|
+
if (knownTypes.has(prefix)) return prefix
|
|
1051
1050
|
}
|
|
1052
1051
|
return undefined
|
|
1053
1052
|
}
|
|
@@ -1060,7 +1059,11 @@ export function pruneSwiftWasmLink(
|
|
|
1060
1059
|
const waiting = pendingConformances.get(pref)
|
|
1061
1060
|
if (waiting) {
|
|
1062
1061
|
pendingConformances.delete(pref)
|
|
1063
|
-
for (const w of waiting)
|
|
1062
|
+
for (const w of waiting) {
|
|
1063
|
+
eagerConformanceObjects.add(w.obj)
|
|
1064
|
+
extractObject(w.obj)
|
|
1065
|
+
activateSymbolInObj(w.obj, w.symIdx)
|
|
1066
|
+
}
|
|
1064
1067
|
}
|
|
1065
1068
|
|
|
1066
1069
|
const mnName = `${pref}Mn`
|
|
@@ -1089,7 +1092,7 @@ export function pruneSwiftWasmLink(
|
|
|
1089
1092
|
}
|
|
1090
1093
|
|
|
1091
1094
|
const checkTypeTrigger = (obj: ParsedObject, rawSymName: string) => {
|
|
1092
|
-
if (!
|
|
1095
|
+
if (!rawSymName) return
|
|
1093
1096
|
const sName = rawSymName.startsWith('.Lgot.') ? rawSymName.slice(6) : rawSymName
|
|
1094
1097
|
const objcPref = obj.objcClassSymToTypePrefix.get(sName)
|
|
1095
1098
|
if (objcPref) {
|
|
@@ -1191,6 +1194,17 @@ export function pruneSwiftWasmLink(
|
|
|
1191
1194
|
for (const fIdx of obj.rootFuncs) markFuncLive(obj, fIdx)
|
|
1192
1195
|
for (const sIdx of obj.rootSegs) markSegLive(obj, sIdx)
|
|
1193
1196
|
|
|
1197
|
+
// the runtime sends +load to every loaded class whether or not anything
|
|
1198
|
+
// names it, and ld64 never dead-strips an objective-c class, so a class
|
|
1199
|
+
// with +load (`_c_<class>__load`) is a root like an initializer.
|
|
1200
|
+
for (const name of obj.symNames) {
|
|
1201
|
+
const loaded = name?.match(/^_c_(\w+)__load$/)?.[1]
|
|
1202
|
+
if (!loaded) continue
|
|
1203
|
+
const classSym = obj.symNames.indexOf(`._OBJC_CLASS_${loaded}`)
|
|
1204
|
+
if (classSym !== -1 && (obj.symFlags[classSym]! & 0x10) === 0)
|
|
1205
|
+
activateSymbolInObj(obj, classSym)
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1194
1208
|
if (obj.file.endsWith('libswiftCore__Swift.o')) {
|
|
1195
1209
|
for (const pref of obj.typePrefixesInObj) {
|
|
1196
1210
|
if (!pref.startsWith('$ss')) {
|
|
@@ -1216,11 +1230,6 @@ export function pruneSwiftWasmLink(
|
|
|
1216
1230
|
const type = conformingType(mcName)
|
|
1217
1231
|
if (type === undefined || globalLiveTypes.has(type))
|
|
1218
1232
|
activateSymbolInObj(obj, r.rs)
|
|
1219
|
-
else {
|
|
1220
|
-
let list = pendingConformances.get(type)
|
|
1221
|
-
if (!list) pendingConformances.set(type, (list = []))
|
|
1222
|
-
list.push({ obj, symIdx: r.rs })
|
|
1223
|
-
}
|
|
1224
1233
|
}
|
|
1225
1234
|
}
|
|
1226
1235
|
}
|
|
@@ -1229,6 +1238,21 @@ export function pruneSwiftWasmLink(
|
|
|
1229
1238
|
}
|
|
1230
1239
|
}
|
|
1231
1240
|
|
|
1241
|
+
// a dynamic cast reaches foreign conformances without referencing a symbol
|
|
1242
|
+
// in their object. index them before extracting any provider so a live type
|
|
1243
|
+
// can extract its extensions as well as its own metadata.
|
|
1244
|
+
for (const obj of distObjs.values()) {
|
|
1245
|
+
if (!obj.isDist) continue
|
|
1246
|
+
for (const r of obj.dataRelocList) {
|
|
1247
|
+
if (obj.segNames[r.segIdx] !== 'swift5_protocol_conformances') continue
|
|
1248
|
+
const type = conformingType(obj.symNames[r.rs]!)
|
|
1249
|
+
if (type === undefined || obj.typePrefixesInObj.has(type)) continue
|
|
1250
|
+
let list = pendingConformances.get(type)
|
|
1251
|
+
if (!list) pendingConformances.set(type, (list = []))
|
|
1252
|
+
list.push({ obj, symIdx: r.rs })
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1232
1256
|
let hasClangObjCEager = false
|
|
1233
1257
|
const eagerBuildPrunable: ParsedObject[] = []
|
|
1234
1258
|
for (const f of eagerFiles) {
|
|
@@ -1741,6 +1765,14 @@ export function pruneSwiftWasmLink(
|
|
|
1741
1765
|
emittedPruned.add(ef)
|
|
1742
1766
|
}
|
|
1743
1767
|
}
|
|
1768
|
+
// these providers were reached through runtime type lookup, so no
|
|
1769
|
+
// undefined symbol would extract them from the following archive region.
|
|
1770
|
+
for (const obj of eagerConformanceObjects) {
|
|
1771
|
+
if (!emittedPruned.has(obj.file) && prunedMap.has(obj.file)) {
|
|
1772
|
+
outTokens.push(prunedMap.get(obj.file)!)
|
|
1773
|
+
emittedPruned.add(obj.file)
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1744
1776
|
outTokens.push('--start-lib')
|
|
1745
1777
|
for (const rf of prunableCandidates) {
|
|
1746
1778
|
if (emittedPruned.has(rf)) continue
|
package/src/turbo-bundle.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'
|
|
2
2
|
import path from 'node:path'
|
|
3
|
-
import {
|
|
3
|
+
import { prepareNativeAppRoot } from './expo-native-workspace'
|
|
4
4
|
import { readIosAppTarget } from './native-app-identity-project'
|
|
5
5
|
import {
|
|
6
6
|
compiledModuleAssets,
|
|
@@ -38,7 +38,7 @@ export async function compileTurboApp(
|
|
|
38
38
|
const module = moduleRoot ?? (await swiftDistributionRoot())
|
|
39
39
|
const projectRoot = readIosAppTarget(appRoot, iosTarget)
|
|
40
40
|
? appRoot
|
|
41
|
-
:
|
|
41
|
+
: await prepareNativeAppRoot(appRoot)
|
|
42
42
|
const { artifact, collection } = await compileTurboModule({
|
|
43
43
|
appRoot,
|
|
44
44
|
reactNativeRoot: path.dirname(
|