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/turbo-source.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execFile
|
|
1
|
+
import { execFile } from 'node:child_process'
|
|
2
2
|
// the original native source of an app's C++ TurboModules, collected as
|
|
3
3
|
// CocoaPods builds it for iOS: every autolinked pod whose sources register a
|
|
4
4
|
// module into React Native's global C++ module map
|
|
@@ -10,13 +10,20 @@ import { execFile, execFileSync } from 'node:child_process'
|
|
|
10
10
|
// classes are left out: React Native never reaches them for a C++ module.
|
|
11
11
|
import { createHash } from 'node:crypto'
|
|
12
12
|
import fs from 'node:fs'
|
|
13
|
-
import { createRequire } from 'node:module'
|
|
14
13
|
import path from 'node:path'
|
|
15
14
|
import { promisify } from 'node:util'
|
|
16
15
|
import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
|
|
17
16
|
import { rnxHomeDir } from './home-paths'
|
|
18
17
|
|
|
19
18
|
const execFileAsync = promisify(execFile)
|
|
19
|
+
|
|
20
|
+
// react-native 0.81 emits codegen specs directly under build/generated/ios;
|
|
21
|
+
// other releases nest them in a ReactCodegen subdirectory. use whichever
|
|
22
|
+
// layout the installed release produced.
|
|
23
|
+
function codegenSpecRoot(codegen: string): string {
|
|
24
|
+
const nested = path.join(codegen, 'ReactCodegen')
|
|
25
|
+
return fs.existsSync(nested) ? nested : codegen
|
|
26
|
+
}
|
|
20
27
|
import {
|
|
21
28
|
glogSources,
|
|
22
29
|
nitroDependencyIncludes,
|
|
@@ -24,9 +31,15 @@ import {
|
|
|
24
31
|
nitroDependencySources,
|
|
25
32
|
prepareNitroDependencies,
|
|
26
33
|
} from './nitro-dependencies'
|
|
27
|
-
import { iosAutolinkedDependencies
|
|
34
|
+
import { iosAutolinkedDependencies } from './nitro-source'
|
|
28
35
|
import { TURBO_RUNTIME_HEADER } from './nitroAdapterContract'
|
|
29
36
|
import { COMPILED_TURBO_NATIVE_PACKAGES } from './nitroContract'
|
|
37
|
+
import {
|
|
38
|
+
loadPodspec,
|
|
39
|
+
podspecLinksBinaries,
|
|
40
|
+
podspecMembers,
|
|
41
|
+
podspecSourceFiles as specSourceFiles,
|
|
42
|
+
} from './podspec-sources'
|
|
30
43
|
import { readPackageFile, relativeInside } from './swift-source-file'
|
|
31
44
|
import { MAX_SWIFT_COMPILE_SOURCE_BYTES } from './swift-submit'
|
|
32
45
|
import {
|
|
@@ -80,6 +93,8 @@ export interface TurboSourceCollection {
|
|
|
80
93
|
configured?: { template: string; originalSha256: string }
|
|
81
94
|
}[]
|
|
82
95
|
externalPodSources: { moduleName: string; file: string }[]
|
|
96
|
+
/** the Swift targets compiled from react-native's own renderer pods */
|
|
97
|
+
rendererSwiftTargets: string[]
|
|
83
98
|
}
|
|
84
99
|
|
|
85
100
|
export const TURBO_CORE_TARGET = 'TurboCore'
|
|
@@ -97,6 +112,8 @@ const OBJC_TURBO =
|
|
|
97
112
|
/-\s*\(\s*std::shared_ptr<\s*(?:facebook::react::)?TurboModule\s*>\s*\)\s*getTurboModule\s*:/
|
|
98
113
|
// RCT_EXTERN_MODULE pods are Swift bridge modules owned by collectInstalledSwiftBridgeUnits
|
|
99
114
|
const OBJC_BRIDGE = /\b(?:RCT_EXPORT_MODULE|RCT_EXPORT_MODULE_NO_LOAD)\s*\(/
|
|
115
|
+
// the macros whose +load registers the class with RCTRegisterModule
|
|
116
|
+
const OBJC_REGISTERED = /\bRCT_EXPORT_MODULE\s*\(|\bRCT_EXTERN(?:_REMAP)?_MODULE\s*\(/
|
|
100
117
|
|
|
101
118
|
function fabricComponents(root: string): boolean {
|
|
102
119
|
const manifest: unknown = JSON.parse(
|
|
@@ -168,12 +185,15 @@ const REACT_NATIVE_OBJC_UNITS = [
|
|
|
168
185
|
'React/Base/RCTModuleRegistry.m',
|
|
169
186
|
'React/Base/RCTParserUtils.m',
|
|
170
187
|
'React/Base/RCTRedBoxSetEnabled.m',
|
|
171
|
-
'React/Base/RCTUtils.mm',
|
|
172
188
|
'React/Base/RCTViewRegistry.m',
|
|
173
189
|
'React/Modules/RCTEventEmitter.m',
|
|
174
190
|
]
|
|
175
191
|
// units added or removed between react native releases; compile those installed
|
|
176
192
|
const REACT_NATIVE_OBJC_VERSIONED_UNITS = [
|
|
193
|
+
// RCTUtils is plain Objective-C in some releases (.m in 0.78) and
|
|
194
|
+
// Objective-C++ in others (.mm from 0.81); compile whichever is installed
|
|
195
|
+
'React/Base/RCTUtils.mm',
|
|
196
|
+
'React/Base/RCTUtils.m',
|
|
177
197
|
// removed in react-native 0.79; nothing references it there
|
|
178
198
|
'ReactCommon/runtimeexecutor/platform/ios/ReactCommon/RuntimeExecutorSyncUIThreadUtils.mm',
|
|
179
199
|
'React/Base/RCTArrayBuffer.mm',
|
|
@@ -205,6 +225,12 @@ const REACT_NATIVE_HEADER_DIRS = [
|
|
|
205
225
|
},
|
|
206
226
|
]
|
|
207
227
|
|
|
228
|
+
// pod public headers a quoted bare include reaches through CocoaPods' project
|
|
229
|
+
// header map, which lists every public header by file name
|
|
230
|
+
const REACT_NATIVE_BARE_HEADER_DIRS = [
|
|
231
|
+
'ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager',
|
|
232
|
+
]
|
|
233
|
+
|
|
208
234
|
function object(value: unknown): value is Record<string, unknown> {
|
|
209
235
|
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
210
236
|
}
|
|
@@ -449,9 +475,9 @@ async function resolveExternalTurboPod(
|
|
|
449
475
|
}
|
|
450
476
|
|
|
451
477
|
type Pod = {
|
|
478
|
+
appRoot: string
|
|
452
479
|
root: string
|
|
453
480
|
file: string
|
|
454
|
-
installationRoot: string
|
|
455
481
|
directory: string
|
|
456
482
|
text: string
|
|
457
483
|
name: string
|
|
@@ -468,9 +494,9 @@ function readPod(
|
|
|
468
494
|
const root = installed?.root ?? originalRoot
|
|
469
495
|
const podspec = path.join(root, relative)
|
|
470
496
|
return {
|
|
497
|
+
appRoot,
|
|
471
498
|
root,
|
|
472
499
|
file: podspec,
|
|
473
|
-
installationRoot: path.join(appRoot, 'ios'),
|
|
474
500
|
// CocoaPods resolves every glob against the podspec's own directory
|
|
475
501
|
directory: path.relative(root, path.dirname(podspec)).split(path.sep).join('/'),
|
|
476
502
|
text: readPackageFile(root, podspec, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString('utf8'),
|
|
@@ -515,7 +541,7 @@ function podSegments(pod: Pod): string[] {
|
|
|
515
541
|
return walk(pod.text.split('\n'))
|
|
516
542
|
}
|
|
517
543
|
|
|
518
|
-
// literal pod globs select directly;
|
|
544
|
+
// literal pod globs select directly; computed membership is evaluated from the podspec.
|
|
519
545
|
function podGlobFiles(pod: Pod): string[] | null {
|
|
520
546
|
const segments = podSegments(pod)
|
|
521
547
|
const lists = (attribute: string) =>
|
|
@@ -523,43 +549,20 @@ function podGlobFiles(pod: Pod): string[] | null {
|
|
|
523
549
|
const allSources = lists('source_files')
|
|
524
550
|
const allExcludes = lists('exclude_files')
|
|
525
551
|
if ([...allSources, ...allExcludes].includes('computed')) {
|
|
526
|
-
const
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
Pod::Config.instance.installation_root = Pathname.new(ARGV.fetch(2))
|
|
541
|
-
spec = Pod::Specification.from_file(ARGV.fetch(1))
|
|
542
|
-
selected = lambda do |member|
|
|
543
|
-
[member] + member.subspec_dependencies(:ios).flat_map { |dependency| selected.call(spec.subspec_by_name(dependency.name)) }
|
|
544
|
-
end
|
|
545
|
-
files = selected.call(spec).flat_map do |member|
|
|
546
|
-
Pod::Sandbox::FileAccessor.new(Pathname.new(ARGV.fetch(1)).dirname, member.consumer(:ios)).source_files
|
|
547
|
-
end
|
|
548
|
-
json_output.puts JSON.generate(files.uniq.map { |file| file.realpath.relative_path_from(root).to_s }.sort)`,
|
|
549
|
-
pod.root,
|
|
550
|
-
pod.file,
|
|
551
|
-
pod.installationRoot,
|
|
552
|
-
path.join(reactNative, 'scripts/react_native_pods.rb'),
|
|
553
|
-
],
|
|
554
|
-
{ encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 },
|
|
555
|
-
)
|
|
556
|
-
const files: unknown = JSON.parse(output)
|
|
557
|
-
if (
|
|
558
|
-
!Array.isArray(files) ||
|
|
559
|
-
!files.every((file): file is string => typeof file === 'string')
|
|
560
|
-
)
|
|
561
|
-
throw new Error(`${pod.name}: CocoaPods returned invalid source membership`)
|
|
562
|
-
return files
|
|
552
|
+
const directory = path.dirname(pod.file)
|
|
553
|
+
const root = fs.realpathSync(pod.root)
|
|
554
|
+
return [
|
|
555
|
+
...new Set(
|
|
556
|
+
podspecMembers(loadPodspec(pod.file, pod.appRoot)).flatMap((member) =>
|
|
557
|
+
specSourceFiles(directory, member).map((file) =>
|
|
558
|
+
path
|
|
559
|
+
.relative(root, fs.realpathSync(path.join(directory, file)))
|
|
560
|
+
.split(path.sep)
|
|
561
|
+
.join('/'),
|
|
562
|
+
),
|
|
563
|
+
),
|
|
564
|
+
),
|
|
565
|
+
].sort()
|
|
563
566
|
}
|
|
564
567
|
const flat = (all: (string[] | 'computed' | null)[]) =>
|
|
565
568
|
all.flatMap((list) => (Array.isArray(list) ? list : []))
|
|
@@ -612,16 +615,30 @@ function podHeaderMappings(pod: Pod): { dir: string; headerDir: string }[] {
|
|
|
612
615
|
function podFiles(pod: Pod): string[] {
|
|
613
616
|
if (pod.installed) return pod.installed.files
|
|
614
617
|
const file = `${pod.name}.podspec`
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
618
|
+
// a binary named in a branch the podspec does not take is not linked, so the
|
|
619
|
+
// evaluated membership decides, as CocoaPods' own evaluation would
|
|
620
|
+
const named = ['vendored_frameworks', 'vendored_libraries'].filter((binary) =>
|
|
621
|
+
new RegExp(`\\.${binary}\\s*=`).test(pod.text),
|
|
622
|
+
)
|
|
623
|
+
if (
|
|
624
|
+
named.length > 0 &&
|
|
625
|
+
podspecMembers(loadPodspec(pod.file, pod.appRoot)).some(podspecLinksBinaries)
|
|
626
|
+
)
|
|
627
|
+
throw new Error(
|
|
628
|
+
`${file}: the pod links prebuilt ${named.join(' and ')}, which only its own wasm build can replace`,
|
|
629
|
+
)
|
|
620
630
|
const files = podGlobFiles(pod)
|
|
621
631
|
if (!files?.length) throw new Error(`${file}: no source_files`)
|
|
622
632
|
return files
|
|
623
633
|
}
|
|
624
634
|
|
|
635
|
+
/** the files a provider's podspec selects as CocoaPods would, absolute, for a
|
|
636
|
+
* project with no installed pods. refused when the pod links prebuilt binaries. */
|
|
637
|
+
export function podspecSourceFiles(provider: TurboProvider, appRoot: string): string[] {
|
|
638
|
+
const pod = readPod(provider, appRoot)
|
|
639
|
+
return podFiles(pod).map((file) => path.join(pod.root, file))
|
|
640
|
+
}
|
|
641
|
+
|
|
625
642
|
function podPublicHeaders(pod: Pod, files: string[]): Set<string> {
|
|
626
643
|
if (pod.installed) return new Set(pod.installed.publicHeaders)
|
|
627
644
|
const segments = podSegments(pod)
|
|
@@ -755,19 +772,17 @@ function registers(root: string, files: Iterable<string>, objc = true): boolean
|
|
|
755
772
|
export async function discoverTurboProviders(appRoot: string): Promise<TurboProvider[]> {
|
|
756
773
|
const providers: TurboProvider[] = []
|
|
757
774
|
for (const { name, root, podspecPath } of await iosAutolinkedDependencies(appRoot)) {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
!COMPILED_TURBO_NATIVE_PACKAGES.includes(name) &&
|
|
762
|
-
!fabric
|
|
763
|
-
)
|
|
775
|
+
// a package peach-compat answers keeps its answer, Fabric views included,
|
|
776
|
+
// until COMPILED_TURBO_NATIVE_PACKAGES moves it to its original source.
|
|
777
|
+
if (answeredPackages.has(name) && !COMPILED_TURBO_NATIVE_PACKAGES.includes(name))
|
|
764
778
|
continue
|
|
779
|
+
// a pod can register Nitro objects and Fabric components independently.
|
|
780
|
+
const fabric = fabricComponents(root)
|
|
765
781
|
if (!podspecPath) continue
|
|
766
782
|
const provider = { name, root, podspecPath }
|
|
767
783
|
const pod = readPod(provider, appRoot)
|
|
768
|
-
const files = podGlobFiles(pod)
|
|
769
|
-
if (files
|
|
770
|
-
if (registers(pod.root, files) || fabric) {
|
|
784
|
+
const files = fabric ? null : podGlobFiles(pod)
|
|
785
|
+
if (fabric || (files !== null && registers(pod.root, files))) {
|
|
771
786
|
const dependencies = await Promise.all(
|
|
772
787
|
podspecDependencies(pod.text).map((dep) =>
|
|
773
788
|
resolveExternalTurboPod(dep.name, dep.version),
|
|
@@ -893,6 +908,7 @@ export async function collectTurboSources(options: {
|
|
|
893
908
|
reactNative,
|
|
894
909
|
sources: [],
|
|
895
910
|
externalPodSources: [],
|
|
911
|
+
rendererSwiftTargets: [],
|
|
896
912
|
}
|
|
897
913
|
const add = (file: string, text: string) => {
|
|
898
914
|
if (Object.hasOwn(result.files, file)) {
|
|
@@ -966,6 +982,13 @@ export async function collectTurboSources(options: {
|
|
|
966
982
|
reactHeaderMap.set(name, file)
|
|
967
983
|
}
|
|
968
984
|
}
|
|
985
|
+
for (const from of REACT_NATIVE_BARE_HEADER_DIRS) {
|
|
986
|
+
const found = new Set<string>()
|
|
987
|
+
walkFiles(reactNative.root, from, found)
|
|
988
|
+
for (const file of [...found].sort())
|
|
989
|
+
if (HEADER.test(file))
|
|
990
|
+
reactHeaderMap.set(`bare/${path.posix.basename(file)}`, file)
|
|
991
|
+
}
|
|
969
992
|
// react native pods expose their umbrella headers through subspecs with
|
|
970
993
|
// an empty header_dir and a mapping rooted at the podspec directory.
|
|
971
994
|
const podspecs = new Set<string>()
|
|
@@ -1128,7 +1151,7 @@ export async function collectTurboSources(options: {
|
|
|
1128
1151
|
return
|
|
1129
1152
|
}
|
|
1130
1153
|
if (codegen && HEADER.test(include)) {
|
|
1131
|
-
const generated =
|
|
1154
|
+
const generated = codegenSpecRoot(codegen)
|
|
1132
1155
|
const relative = path.posix.normalize(include.replace(/^ReactCodegen\//, ''))
|
|
1133
1156
|
if (
|
|
1134
1157
|
!relative.startsWith('../') &&
|
|
@@ -1179,7 +1202,10 @@ export async function collectTurboSources(options: {
|
|
|
1179
1202
|
.find((file) => file !== undefined)
|
|
1180
1203
|
const react =
|
|
1181
1204
|
mappedReact ??
|
|
1182
|
-
|
|
1205
|
+
(quoted && !include.includes('/')
|
|
1206
|
+
? (reactHeaders().get(`React/${include}`) ??
|
|
1207
|
+
reactHeaders().get(`bare/${include}`))
|
|
1208
|
+
: reactHeaders().get(include))
|
|
1183
1209
|
if (react) {
|
|
1184
1210
|
alias(
|
|
1185
1211
|
`${core}/include/${include}`,
|
|
@@ -1273,6 +1299,8 @@ export async function collectTurboSources(options: {
|
|
|
1273
1299
|
let objc = false
|
|
1274
1300
|
let fabric = false
|
|
1275
1301
|
const objcClasses = new Set<string>()
|
|
1302
|
+
// module classes no macro registers: React Native finds them by name
|
|
1303
|
+
const unregisteredObjcClasses = new Set<string>()
|
|
1276
1304
|
const deferredDepUnits: {
|
|
1277
1305
|
targetName: string
|
|
1278
1306
|
label: string
|
|
@@ -1302,7 +1330,6 @@ export async function collectTurboSources(options: {
|
|
|
1302
1330
|
{ tool: 'cxx', flags: pod.installed.preprocessorFlags.cxx },
|
|
1303
1331
|
]
|
|
1304
1332
|
const root = pod.root
|
|
1305
|
-
const nitro = nitroRegisteredNames(root)
|
|
1306
1333
|
fabric ||= fabricComponents(root)
|
|
1307
1334
|
if (pod.installed?.library) {
|
|
1308
1335
|
result.libraries ??= {}
|
|
@@ -1317,7 +1344,15 @@ export async function collectTurboSources(options: {
|
|
|
1317
1344
|
headers,
|
|
1318
1345
|
label,
|
|
1319
1346
|
root,
|
|
1320
|
-
|
|
1347
|
+
// without an installed pod, the roots the podspec's own HEADER_SEARCH_PATHS
|
|
1348
|
+
// name under the pod directory
|
|
1349
|
+
searchPaths:
|
|
1350
|
+
pod.installed?.headerSearchPaths ??
|
|
1351
|
+
[...pod.text.matchAll(/HEADER_SEARCH_PATHS['"]?\s*=>\s*(.+)/g)].flatMap((line) =>
|
|
1352
|
+
[...line[1]!.matchAll(/\$\(PODS_TARGET_SRCROOT\)\/([^\s"'\\)]+)/g)].map(
|
|
1353
|
+
(match) => match[1]!,
|
|
1354
|
+
),
|
|
1355
|
+
),
|
|
1321
1356
|
reactHeaderMaps: (pod.installed?.reactHeaderMaps ?? []).map(
|
|
1322
1357
|
({ flag, entries }) => ({
|
|
1323
1358
|
flag,
|
|
@@ -1386,8 +1421,12 @@ export async function collectTurboSources(options: {
|
|
|
1386
1421
|
providerObjC = true
|
|
1387
1422
|
const stripped = stripComments(text)
|
|
1388
1423
|
if (OBJC_TURBO.test(stripped) || OBJC_BRIDGE.test(stripped)) {
|
|
1424
|
+
const registers = OBJC_REGISTERED.test(stripped)
|
|
1389
1425
|
for (const [, className] of stripped.matchAll(/@implementation\s+(\w+)/g))
|
|
1390
|
-
if (!managers.has(className!))
|
|
1426
|
+
if (!managers.has(className!)) {
|
|
1427
|
+
objcClasses.add(className!)
|
|
1428
|
+
if (!registers) unregisteredObjcClasses.add(className!)
|
|
1429
|
+
}
|
|
1391
1430
|
for (const [, className] of stripped.matchAll(
|
|
1392
1431
|
/\bRCT_EXTERN_MODULE\s*\(\s*(\w+)/g,
|
|
1393
1432
|
))
|
|
@@ -1398,7 +1437,7 @@ export async function collectTurboSources(options: {
|
|
|
1398
1437
|
if (!managers.has(className!)) objcClasses.add(className!)
|
|
1399
1438
|
}
|
|
1400
1439
|
}
|
|
1401
|
-
} else if (file.endsWith('.swift')
|
|
1440
|
+
} else if (file.endsWith('.swift')) swiftSources.push(file)
|
|
1402
1441
|
}
|
|
1403
1442
|
if (providerObjC) sources.push(...codegenObjCSources)
|
|
1404
1443
|
const depUnits: {
|
|
@@ -1546,7 +1585,7 @@ export async function collectTurboSources(options: {
|
|
|
1546
1585
|
throw new Error(`${label}: codegenConfig has no name`)
|
|
1547
1586
|
codegen ??= (await runInstalledTurboCodegen(options.appRoot, options.codegenDir))
|
|
1548
1587
|
.generatedRoot
|
|
1549
|
-
const generated =
|
|
1588
|
+
const generated = codegenSpecRoot(codegen)
|
|
1550
1589
|
const owned = new Set<string>()
|
|
1551
1590
|
walkFiles(generated, '', owned)
|
|
1552
1591
|
const spec = codegenConfig.name
|
|
@@ -1774,15 +1813,18 @@ export async function collectTurboSources(options: {
|
|
|
1774
1813
|
])
|
|
1775
1814
|
codegen ??= (await runInstalledTurboCodegen(options.appRoot, options.codegenDir))
|
|
1776
1815
|
.generatedRoot
|
|
1777
|
-
const generated =
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1816
|
+
const generated = codegenSpecRoot(codegen)
|
|
1817
|
+
// some releases (0.78) emit no central provider file; their specs self-register
|
|
1818
|
+
if (fs.existsSync(path.join(generated, 'RCTModuleProviders.mm'))) {
|
|
1819
|
+
original(TURBO_CORE_TARGET, 'ReactCodegen', generated, 'RCTModuleProviders.mm')
|
|
1820
|
+
alias(
|
|
1821
|
+
`${core}/include/ReactCodegen/RCTModuleProviders.h`,
|
|
1822
|
+
original(TURBO_CORE_TARGET, 'ReactCodegen', generated, 'RCTModuleProviders.h'),
|
|
1823
|
+
)
|
|
1824
|
+
}
|
|
1783
1825
|
}
|
|
1784
1826
|
if (fabric) {
|
|
1785
|
-
for (const pod of
|
|
1827
|
+
for (const pod of installedFabricSources(reactNative.root)) {
|
|
1786
1828
|
const swift = pod.files.some((file) => file.endsWith('.swift'))
|
|
1787
1829
|
const name = swift ? pod.module : TURBO_CORE_TARGET
|
|
1788
1830
|
if (swift) {
|
|
@@ -1795,10 +1837,11 @@ export async function collectTurboSources(options: {
|
|
|
1795
1837
|
languageMode: Number(pod.swiftVersion),
|
|
1796
1838
|
cxxInterop: false,
|
|
1797
1839
|
})
|
|
1840
|
+
result.rendererSwiftTargets.push(name)
|
|
1798
1841
|
}
|
|
1799
1842
|
for (const file of pod.files) original(name, 'react-native', reactNative.root, file)
|
|
1800
1843
|
}
|
|
1801
|
-
const patterns =
|
|
1844
|
+
const patterns = installedRendererDependencyGlobs(reactNative.root)
|
|
1802
1845
|
const matchers = new Map(
|
|
1803
1846
|
Object.entries(patterns).map(([name, globs]) => [name, globs.map(globRegex)]),
|
|
1804
1847
|
)
|
|
@@ -1830,7 +1873,11 @@ export async function collectTurboSources(options: {
|
|
|
1830
1873
|
add(
|
|
1831
1874
|
host,
|
|
1832
1875
|
objc
|
|
1833
|
-
? turboObjCHostSource(
|
|
1876
|
+
? turboObjCHostSource(
|
|
1877
|
+
[...objcClasses].sort(),
|
|
1878
|
+
[...unregisteredObjcClasses].sort(),
|
|
1879
|
+
decoratorHasPerformanceLogger,
|
|
1880
|
+
)
|
|
1834
1881
|
: turboHostSource(withRuntime),
|
|
1835
1882
|
)
|
|
1836
1883
|
scanText(
|
|
@@ -1969,9 +2016,13 @@ extern "C" __attribute__((export_name("peach_turbo_module_names"))) const char*
|
|
|
1969
2016
|
|
|
1970
2017
|
function turboObjCHostSource(
|
|
1971
2018
|
objcClasses: readonly string[],
|
|
2019
|
+
unregisteredClasses: readonly string[],
|
|
1972
2020
|
decoratorHasPerformanceLogger: boolean,
|
|
1973
2021
|
): string {
|
|
1974
2022
|
const classNamesList = objcClasses.map((name) => `@${JSON.stringify(name)}`).join(', ')
|
|
2023
|
+
const unregisteredList = unregisteredClasses
|
|
2024
|
+
.map((name) => `@${JSON.stringify(name)}`)
|
|
2025
|
+
.join(', ')
|
|
1975
2026
|
return `// React Native's RCTTurboModuleManager on the process's JSI runtime, set up
|
|
1976
2027
|
// as a bridgeless RCTInstance sets it up, with the delegate an app gets from
|
|
1977
2028
|
// RCTDefaultReactNativeFactoryDelegate: module providers from the app's codegen
|
|
@@ -2135,6 +2186,18 @@ static BOOL peachIdleTimerDisabled = NO;
|
|
|
2135
2186
|
}
|
|
2136
2187
|
@end
|
|
2137
2188
|
|
|
2189
|
+
// React Native's own modules register before any provider's, and RCTBridge.mm
|
|
2190
|
+
// creates the registry's queue in the first RCTRegisterModule. the engine
|
|
2191
|
+
// supplies those modules, so a process whose providers register none (codegen
|
|
2192
|
+
// or class-name modules) would reach RCTGetModuleClasses with a nil queue and
|
|
2193
|
+
// trap. this module stands in for the registration native always has.
|
|
2194
|
+
@interface PeachTurboRegistry : NSObject <RCTBridgeModule>
|
|
2195
|
+
@end
|
|
2196
|
+
|
|
2197
|
+
@implementation PeachTurboRegistry
|
|
2198
|
+
RCT_EXPORT_MODULE()
|
|
2199
|
+
@end
|
|
2200
|
+
|
|
2138
2201
|
@interface RCTTurboModuleManager (PeachTurboLegacy)
|
|
2139
2202
|
- (std::shared_ptr<facebook::react::TurboModule>)provideLegacyModule:(const char *)moduleName;
|
|
2140
2203
|
@end
|
|
@@ -2142,6 +2205,7 @@ static BOOL peachIdleTimerDisabled = NO;
|
|
|
2142
2205
|
@interface PeachTurboModuleDelegate : NSObject <RCTTurboModuleManagerDelegate>
|
|
2143
2206
|
@end
|
|
2144
2207
|
|
|
2208
|
+
extern "C" void RCTRegisterModule(Class);
|
|
2145
2209
|
static PeachTurboModuleDelegate *delegate;
|
|
2146
2210
|
static RCTTurboModuleManager *manager;
|
|
2147
2211
|
|
|
@@ -2219,6 +2283,15 @@ extern "C" void peachTurboInitialize() {
|
|
|
2219
2283
|
moduleRegistry:[RCTModuleRegistry new]
|
|
2220
2284
|
bundleManager:nil
|
|
2221
2285
|
callableJSModules:[RCTCallableJSModules new]${decoratorHasPerformanceLogger ? '\n launchOptions:nil\n performanceLogger:[RCTPerformanceLogger new]' : ''}];
|
|
2286
|
+
// RCTGetModuleClasses reads a queue only RCTRegisterModule creates. a React
|
|
2287
|
+
// Native app always has its core modules registered; here the app's own
|
|
2288
|
+
// RCT_EXPORT_MODULE classes are the only registrations, so a provider found by
|
|
2289
|
+
// name alone leaves the manager reading a queue that does not exist
|
|
2290
|
+
for (NSString *className in @[${unregisteredList}]) {
|
|
2291
|
+
Class moduleClass = NSClassFromString(className);
|
|
2292
|
+
if (moduleClass && [moduleClass conformsToProtocol:@protocol(RCTBridgeModule)])
|
|
2293
|
+
RCTRegisterModule(moduleClass);
|
|
2294
|
+
}
|
|
2222
2295
|
RCTEnableTurboModuleInterop(YES);
|
|
2223
2296
|
delegate = [PeachTurboModuleDelegate new];
|
|
2224
2297
|
manager = [[RCTTurboModuleManager alloc] initWithBridgeProxy:nil
|
|
@@ -2226,10 +2299,31 @@ extern "C" void peachTurboInitialize() {
|
|
|
2226
2299
|
delegate:delegate
|
|
2227
2300
|
jsInvoker:invoker
|
|
2228
2301
|
devMenuConfigurationDecorator:nil];
|
|
2302
|
+
// native's RCTInstance routes a module's callFunctionOnModule into React
|
|
2303
|
+
// Native's callable-module registry; here the guest's evaluation answers it,
|
|
2304
|
+
// so a module's RCTEventEmitter events reach the guest's RCTDeviceEventEmitter.
|
|
2305
|
+
[decorator.callableJSModules
|
|
2306
|
+
setBridgelessJSModuleMethodInvoker:^(NSString *moduleName, NSString *methodName, NSArray *args, dispatch_block_t onComplete) {
|
|
2307
|
+
invoker->invokeAsync([=](jsi::Runtime& rt) {
|
|
2308
|
+
auto call = rt.global().getPropertyAsFunction(rt, "peachInvokeCallableModule");
|
|
2309
|
+
call.call(rt,
|
|
2310
|
+
jsi::String::createFromUtf8(rt, moduleName.UTF8String),
|
|
2311
|
+
jsi::String::createFromUtf8(rt, methodName.UTF8String),
|
|
2312
|
+
react::TurboModuleConvertUtils::convertObjCObjectToJSIValue(rt, args));
|
|
2313
|
+
if (onComplete) onComplete();
|
|
2314
|
+
});
|
|
2315
|
+
}];
|
|
2229
2316
|
[decorator.moduleRegistry setTurboModuleRegistry:manager];
|
|
2230
2317
|
[manager installJSBindings:runtime];
|
|
2231
2318
|
}
|
|
2232
2319
|
|
|
2320
|
+
// the screenshot the device took, as UIKit posts it to every observer in the
|
|
2321
|
+
// app: the host calls this when the device's screenshot action fires.
|
|
2322
|
+
extern "C" __attribute__((export_name("peach_turbo_post_screenshot"))) void peachTurboPostScreenshot() {
|
|
2323
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationUserDidTakeScreenshotNotification
|
|
2324
|
+
object:nil];
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2233
2327
|
// the names the process answers, newline separated, for the host to claim:
|
|
2234
2328
|
// the global C++ map, the codegen module providers and each registered
|
|
2235
2329
|
// Objective-C TurboModule class
|
|
@@ -2239,8 +2333,9 @@ extern "C" __attribute__((export_name("peach_turbo_module_names"))) const char*
|
|
|
2239
2333
|
[found addObject:@(name.c_str())];
|
|
2240
2334
|
[found addObjectsFromArray:RCTModuleProviders.moduleProviders.allKeys];
|
|
2241
2335
|
for (Class moduleClass in RCTGetModuleClasses())
|
|
2242
|
-
if (
|
|
2243
|
-
[moduleClass conformsToProtocol:@protocol(
|
|
2336
|
+
if (moduleClass != [PeachTurboRegistry class] &&
|
|
2337
|
+
([moduleClass conformsToProtocol:@protocol(RCTTurboModule)] ||
|
|
2338
|
+
[moduleClass conformsToProtocol:@protocol(RCTBridgeModule)]))
|
|
2244
2339
|
[found addObject:RCTBridgeModuleNameForClass(moduleClass)];
|
|
2245
2340
|
for (NSString *className in @[${classNamesList}]) {
|
|
2246
2341
|
Class moduleClass = NSClassFromString(className);
|
package/src/wasm-optimize.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { BinaryNotFoundError, BINARYEN_VERSION, wasmOpt } from 'wasm-opt'
|
|
2
3
|
|
|
3
4
|
// the linked executable of a Nitro or Turbo module, size-optimized. clang's own
|
|
4
5
|
// optimizer pass is off (-O0 on the link) so an edit never pays for it and the
|
|
@@ -21,7 +22,7 @@ const FEATURES = [
|
|
|
21
22
|
/** feeds the artifact hash: a new optimizer or flag set is a new artifact. */
|
|
22
23
|
export const WASM_OPTIMIZE_IDENTITY = `wasm-opt ${BINARYEN_VERSION} -Oz ${FEATURES.join(',')}`
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
async function runWasmOpt(file: string, output: string): Promise<void> {
|
|
25
26
|
const result = await wasmOpt([
|
|
26
27
|
'-Oz',
|
|
27
28
|
...FEATURES.map((feature) => `--enable-${feature}`),
|
|
@@ -32,3 +33,31 @@ export async function optimizeWasm(file: string, output: string): Promise<void>
|
|
|
32
33
|
if (result.status !== 0)
|
|
33
34
|
throw new Error(`wasm-opt exited ${result.status}: ${result.stderr}`)
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
// the standalone CLI ships no native binaryen, and a stranger's machine has
|
|
38
|
+
// none on PATH: fetch the pinned release into the shared cache on first use
|
|
39
|
+
// so the first native link works instead of failing.
|
|
40
|
+
function installWasmOpt(): void {
|
|
41
|
+
try {
|
|
42
|
+
execFileSync('npx', ['-y', 'wasm-opt', '--wasm-opt-install'], {
|
|
43
|
+
timeout: 600_000,
|
|
44
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
45
|
+
env: { ...process.env, WASM_OPT_VERSION: BINARYEN_VERSION },
|
|
46
|
+
})
|
|
47
|
+
} catch (error) {
|
|
48
|
+
const detail = error instanceof Error ? error.message : String(error)
|
|
49
|
+
throw new Error(`wasm-opt binary missing and on-demand install failed: ${detail}`, {
|
|
50
|
+
cause: error,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function optimizeWasm(file: string, output: string): Promise<void> {
|
|
56
|
+
try {
|
|
57
|
+
await runWasmOpt(file, output)
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (!(error instanceof BinaryNotFoundError)) throw error
|
|
60
|
+
installWasmOpt()
|
|
61
|
+
await runWasmOpt(file, output)
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/xcode-project.ts
CHANGED
|
@@ -475,6 +475,31 @@ export function selectXcodeWorkspace(
|
|
|
475
475
|
return named.length === 1 ? path.join(directory, named[0]!) : null
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
+
/** the CocoaPods workspace in a project's ios directory, or null while no pods
|
|
479
|
+
* are installed: off a Mac, prebuild alone produces the Xcode project. */
|
|
480
|
+
export function installedXcodeWorkspace(projectRoot: string): string | null {
|
|
481
|
+
const ios = path.join(projectRoot, 'ios')
|
|
482
|
+
if (!fs.existsSync(ios)) return null
|
|
483
|
+
return selectXcodeWorkspace(
|
|
484
|
+
ios,
|
|
485
|
+
fs.readdirSync(ios).filter((name) => name.endsWith('.xcworkspace')),
|
|
486
|
+
)
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** the installed workspace for a compile step that cannot proceed from
|
|
490
|
+
* podspecs alone, with the reason it is missing off a Mac. */
|
|
491
|
+
export function requireInstalledXcodeWorkspace(
|
|
492
|
+
projectRoot: string,
|
|
493
|
+
needed: string,
|
|
494
|
+
): string {
|
|
495
|
+
const workspace = installedXcodeWorkspace(projectRoot)
|
|
496
|
+
if (!workspace)
|
|
497
|
+
throw new Error(
|
|
498
|
+
`${needed} needs the installed CocoaPods workspace in ${path.join(projectRoot, 'ios')}, which only a Mac prepares or PEACH_PREPARED_NATIVE_WORKSPACES supplies`,
|
|
499
|
+
)
|
|
500
|
+
return workspace
|
|
501
|
+
}
|
|
502
|
+
|
|
478
503
|
function versionRequirement(
|
|
479
504
|
url: string,
|
|
480
505
|
requirement: PlistDict,
|
|
@@ -1657,12 +1682,16 @@ export function readXcodeAppTarget(
|
|
|
1657
1682
|
? appTargets.filter((ref) => ref.target.name === targetName)
|
|
1658
1683
|
: appTargets
|
|
1659
1684
|
if (named.length !== 1) {
|
|
1685
|
+
if (appTargets.length === 0)
|
|
1686
|
+
throw new Error(
|
|
1687
|
+
`${container} has no application targets; open a project or workspace that contains one`,
|
|
1688
|
+
)
|
|
1660
1689
|
throw new Error(
|
|
1661
1690
|
targetName && named.length === 0
|
|
1662
1691
|
? `${container} has no application target ${targetName}; it has ${appTargetNames.join(', ') || 'none'}`
|
|
1663
1692
|
: targetName
|
|
1664
1693
|
? `${container} has ${named.length} application targets named ${targetName}; open its .xcodeproj`
|
|
1665
|
-
: `${container} has ${appTargetNames.length} application targets (${appTargetNames.join(', ')
|
|
1694
|
+
: `${container} has ${appTargetNames.length} application targets (${appTargetNames.join(', ')}); pass --target`,
|
|
1666
1695
|
)
|
|
1667
1696
|
}
|
|
1668
1697
|
const app = named[0]!
|
|
@@ -2183,7 +2212,9 @@ export function readXcodeAppTarget(
|
|
|
2183
2212
|
),
|
|
2184
2213
|
...podHeaders.filter((file) => HEADER_FILE.test(file)),
|
|
2185
2214
|
],
|
|
2186
|
-
headers
|
|
2215
|
+
headers: [
|
|
2216
|
+
...new Set([...headers, ...headerFiles.map(({ file }) => file)]),
|
|
2217
|
+
],
|
|
2187
2218
|
prefixHeader: settings('GCC_PREFIX_HEADER')
|
|
2188
2219
|
? absolute(settings('GCC_PREFIX_HEADER'))
|
|
2189
2220
|
: null,
|
|
@@ -2389,7 +2420,9 @@ export function readXcodeAppTarget(
|
|
|
2389
2420
|
const bundleTargets = builtTargets.filter(
|
|
2390
2421
|
({ ref }) => ref.target.productType === RESOURCE_BUNDLE,
|
|
2391
2422
|
)
|
|
2392
|
-
|
|
2423
|
+
// the app target copies every pod resource bundle, whichever native modules
|
|
2424
|
+
// peach compiles: native code finds them through Bundle at runtime.
|
|
2425
|
+
for (const owner of options.installedPods ? builtTargets : []) {
|
|
2393
2426
|
for (const phaseId of list(owner.ref.target.buildPhases)) {
|
|
2394
2427
|
const phase = owner.ref.project.object(phaseId)
|
|
2395
2428
|
if (
|