peachsim 0.1.2299 → 0.1.2301
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/control.ts +1 -0
- package/cli/commands/serve.ts +12 -3
- package/cli/commands/shell-url.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 +413 -100
- 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 +3 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +385 -93
- 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 +2608 -102
- package/dist-lib/host/fetch-proxy-handler.cjs +6 -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 +68 -33
- 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 +66 -32
- package/dist-lib/native-app-identity-project.cjs +49 -24
- package/dist-lib/native-app-identity-project.mjs +49 -24
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +56 -53
- 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 +2 -1
- package/dist-lib/sdk.mjs +2 -1
- package/dist-lib/skills.cjs +481 -125
- package/dist-lib/swift-compile.cjs +40 -8
- package/dist-lib/swift-compile.mjs +40 -8
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +94 -37
- package/dist-lib/vite.cjs +12 -11
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/activitykit-activityContract.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-arbitration-native.d.ts +124 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +3 -1
- package/dist-types/packages/peach-kit/src/transitions/screen-transition-math.d.ts +2 -2
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/bundle-channel.mjs +4 -3
- package/src/cli-runtime.ts +6 -0
- package/src/expo-discovery-cache.ts +6 -6
- package/src/expo-swift-host.ts +19 -4
- package/src/host/bridge-host.ts +9 -0
- package/src/launchMetadataContract.ts +1 -0
- package/src/native-firebase-config.ts +14 -0
- package/src/swift-compile.ts +28 -1
- package/src/swift-guest-compile.ts +19 -3
- package/src/swift-guest-source-plan.ts +7 -2
- package/src/swiftContract.ts +3 -0
- package/src/turbo-compile.ts +60 -4
- package/src/turbo-source.ts +239 -35
- package/src/vite-plugin-one.ts +3 -3
- package/src/widget-extension-bundle.ts +48 -0
- package/src/xcode-project.ts +67 -25
package/src/turbo-compile.ts
CHANGED
|
@@ -103,10 +103,15 @@ export function collectTurboCompileInput(
|
|
|
103
103
|
dependencyTargets = dependencyTargets.filter(
|
|
104
104
|
(_, index) => !providerNames.has(parsedTargets[index]!.name),
|
|
105
105
|
)
|
|
106
|
-
|
|
106
|
+
// an app that links UIKit, through Swift sources or the Objective-C host, is a
|
|
107
|
+
// package: its key window shows what its modules present
|
|
108
|
+
const swift =
|
|
109
|
+
collection.coreMode === 'turbo' ||
|
|
110
|
+
Object.keys(files).some((file) => file.endsWith('.swift'))
|
|
107
111
|
const entry = `Sources/PeachTurboApp/main.${swift ? 'swift' : 'cpp'}`
|
|
108
112
|
const targetNames = targets.map(({ name }) => name)
|
|
109
113
|
const loadTargetNames = new Set(collection.loads.map(({ target }) => target))
|
|
114
|
+
// the core, each +load and each Swift target; a Cxx umbrella stays unimported
|
|
110
115
|
const swiftImportedTargetNames = targets
|
|
111
116
|
.filter(
|
|
112
117
|
(target) =>
|
|
@@ -117,10 +122,61 @@ export function collectTurboCompileInput(
|
|
|
117
122
|
),
|
|
118
123
|
)
|
|
119
124
|
.map(({ name }) => name)
|
|
125
|
+
const initialize = [
|
|
126
|
+
'_PeachReactNativeWindow.launch()',
|
|
127
|
+
...collection.loads.map(({ symbol }) => `${symbol}()`),
|
|
128
|
+
...(runtime ? ['peachTurboInitialize()'] : []),
|
|
129
|
+
]
|
|
130
|
+
const fabric = collection.fabricComponents.length > 0
|
|
131
|
+
// the app as a package: its mounted roots are the key window, where what a
|
|
132
|
+
// module presents shows over the app, or one of its Fabric component views
|
|
120
133
|
files[entry] = swift
|
|
121
|
-
?
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
? [
|
|
135
|
+
'import SwiftUI',
|
|
136
|
+
'import UIKit',
|
|
137
|
+
'import PeachJSON',
|
|
138
|
+
...swiftImportedTargetNames.map((target) => `import ${target}`),
|
|
139
|
+
'',
|
|
140
|
+
'@main struct PeachTurboApp: PeachPackage {',
|
|
141
|
+
` init() { ${initialize.join('; ')} }`,
|
|
142
|
+
...(fabric
|
|
143
|
+
? [
|
|
144
|
+
' func view(props: JSON) -> PeachTurboRoot { PeachTurboRoot(props: props) }',
|
|
145
|
+
'}',
|
|
146
|
+
'',
|
|
147
|
+
'struct PeachTurboRoot: View {',
|
|
148
|
+
' let fabric: Int32?',
|
|
149
|
+
'',
|
|
150
|
+
' init(props: JSON) {',
|
|
151
|
+
' guard case .object(let fields) = props, let field = fields.first(where: { $0.0 == "fabric" }), case .number(let tag) = field.1 else {',
|
|
152
|
+
' fabric = nil',
|
|
153
|
+
' return',
|
|
154
|
+
' }',
|
|
155
|
+
' fabric = Int32(tag)',
|
|
156
|
+
' }',
|
|
157
|
+
'',
|
|
158
|
+
' var body: some View {',
|
|
159
|
+
' if let fabric { PeachFabricComponent(tag: fabric) } else { _PeachReactNativeWindow() }',
|
|
160
|
+
' }',
|
|
161
|
+
'}',
|
|
162
|
+
'',
|
|
163
|
+
'struct PeachFabricComponent: UIViewRepresentable {',
|
|
164
|
+
' let tag: Int32',
|
|
165
|
+
'',
|
|
166
|
+
' func makeUIView(context: Context) -> UIView {',
|
|
167
|
+
' guard let view = peach_fabric_view_content(tag) else { fatalError("Fabric view \\(tag) is not mounted") }',
|
|
168
|
+
' return Unmanaged<UIView>.fromOpaque(view).takeRetainedValue()',
|
|
169
|
+
' }',
|
|
170
|
+
'',
|
|
171
|
+
' func updateUIView(_ view: UIView, context: Context) {}',
|
|
172
|
+
'}',
|
|
173
|
+
]
|
|
174
|
+
: [
|
|
175
|
+
' func view(props: JSON) -> _PeachReactNativeWindow { _PeachReactNativeWindow() }',
|
|
176
|
+
'}',
|
|
177
|
+
]),
|
|
178
|
+
'',
|
|
179
|
+
].join('\n')
|
|
124
180
|
: [
|
|
125
181
|
'extern "C" void peachTurboInitialize();',
|
|
126
182
|
...collection.loads.map(({ symbol }) => `extern "C" void ${symbol}();`),
|
package/src/turbo-source.ts
CHANGED
|
@@ -112,6 +112,14 @@ export interface TurboSourceCollection {
|
|
|
112
112
|
externalPodSources: { moduleName: string; file: string }[]
|
|
113
113
|
/** the Swift targets compiled from react-native's own renderer pods */
|
|
114
114
|
rendererSwiftTargets: string[]
|
|
115
|
+
/** the codegen component names whose views the host mounts */
|
|
116
|
+
fabricComponents: string[]
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// a codegen component and the class RCTThirdPartyComponentsProvider maps it to
|
|
120
|
+
interface FabricComponent {
|
|
121
|
+
name: string
|
|
122
|
+
className: string
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
export const TURBO_CORE_TARGET = 'TurboCore'
|
|
@@ -1166,6 +1174,7 @@ export async function collectTurboSources(options: {
|
|
|
1166
1174
|
sources: [],
|
|
1167
1175
|
externalPodSources: [],
|
|
1168
1176
|
rendererSwiftTargets: [],
|
|
1177
|
+
fabricComponents: [],
|
|
1169
1178
|
}
|
|
1170
1179
|
const sharedLibrary = [...(options.installedPods?.values() ?? [])].find(
|
|
1171
1180
|
(pod) => pod.sharedLibrary,
|
|
@@ -1718,6 +1727,10 @@ export async function collectTurboSources(options: {
|
|
|
1718
1727
|
|
|
1719
1728
|
let objc = Boolean(options.reactNativeProvider)
|
|
1720
1729
|
let fabric = Boolean(options.reactNativeProvider)
|
|
1730
|
+
// the packages whose own Fabric components compile here
|
|
1731
|
+
const fabricPackages = new Set<string>()
|
|
1732
|
+
const fabricViews: FabricComponent[] = []
|
|
1733
|
+
let fabricTarget: { targetName: string; label: string; root: string } | null = null
|
|
1721
1734
|
let legacyBridge = false
|
|
1722
1735
|
let hermesHeaders: string | null = null
|
|
1723
1736
|
const objcClasses = new Set<string>()
|
|
@@ -1752,7 +1765,11 @@ export async function collectTurboSources(options: {
|
|
|
1752
1765
|
{ tool: 'cxx', flags: pod.installed.preprocessorFlags.cxx },
|
|
1753
1766
|
]
|
|
1754
1767
|
const root = pod.root
|
|
1755
|
-
|
|
1768
|
+
if (fabricComponents(provider.root)) {
|
|
1769
|
+
fabric = true
|
|
1770
|
+
fabricPackages.add(provider.name)
|
|
1771
|
+
fabricTarget ??= { targetName, label, root: provider.root }
|
|
1772
|
+
}
|
|
1756
1773
|
if (pod.installed?.library) {
|
|
1757
1774
|
result.libraries ??= {}
|
|
1758
1775
|
result.libraries[targetName] = fs
|
|
@@ -2066,6 +2083,20 @@ export async function collectTurboSources(options: {
|
|
|
2066
2083
|
const owned = new Set<string>()
|
|
2067
2084
|
walkFiles(generated, '', owned)
|
|
2068
2085
|
const spec = codegenConfig.name
|
|
2086
|
+
let definedComponentNames: Set<string> | undefined
|
|
2087
|
+
const getDefinedComponentNames = () => {
|
|
2088
|
+
if (definedComponentNames) return definedComponentNames
|
|
2089
|
+
definedComponentNames = new Set()
|
|
2090
|
+
const pattern =
|
|
2091
|
+
/\b(?:const\s+char|char\s+const)\s+(\w+ComponentName)\s*\[\s*\]\s*=/g
|
|
2092
|
+
for (const sourceFile of sources) {
|
|
2093
|
+
const text = readPackageFile(root, path.join(root, sourceFile), Infinity)
|
|
2094
|
+
.toString('utf8')
|
|
2095
|
+
.replace(/\/\/[^\n]*/g, '')
|
|
2096
|
+
for (const match of text.matchAll(pattern)) definedComponentNames.add(match[1]!)
|
|
2097
|
+
}
|
|
2098
|
+
return definedComponentNames
|
|
2099
|
+
}
|
|
2069
2100
|
for (const file of [...owned].sort()) {
|
|
2070
2101
|
const base = path.posix.basename(file)
|
|
2071
2102
|
// the Objective-C spec classes only an Objective-C module reaches
|
|
@@ -2092,7 +2123,35 @@ export async function collectTurboSources(options: {
|
|
|
2092
2123
|
relative: file,
|
|
2093
2124
|
},
|
|
2094
2125
|
)
|
|
2095
|
-
else
|
|
2126
|
+
else {
|
|
2127
|
+
if (component && base === 'ShadowNodes.cpp') {
|
|
2128
|
+
const defined = getDefinedComponentNames()
|
|
2129
|
+
if (defined.size) {
|
|
2130
|
+
const source = readPackageFile(
|
|
2131
|
+
generated,
|
|
2132
|
+
path.join(generated, file),
|
|
2133
|
+
Infinity,
|
|
2134
|
+
).toString('utf8')
|
|
2135
|
+
const filtered = source.replace(
|
|
2136
|
+
/^[ \t]*(?:extern[ \t]+)?(?:const[ \t]+char|char[ \t]+const)[ \t]+(\w+ComponentName)[ \t]*\[[ \t]*\][ \t]*=[^;]*;[ \t]*\r?\n?/gm,
|
|
2137
|
+
(line, name: string) => (defined.has(name) ? '' : line),
|
|
2138
|
+
)
|
|
2139
|
+
if (filtered !== source) {
|
|
2140
|
+
// a pod's own Fabric node sources can already define ComponentName[], clashing with codegen's ShadowNodes.cpp
|
|
2141
|
+
if (
|
|
2142
|
+
!/\b(?:const\s+char|char\s+const)\s+\w+ComponentName\s*\[\s*\]\s*=/.test(
|
|
2143
|
+
filtered,
|
|
2144
|
+
)
|
|
2145
|
+
)
|
|
2146
|
+
continue
|
|
2147
|
+
const key = original(targetName, 'ReactCodegen', generated, file)
|
|
2148
|
+
result.files[key] = filtered
|
|
2149
|
+
continue
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
original(targetName, 'ReactCodegen', generated, file)
|
|
2154
|
+
}
|
|
2096
2155
|
}
|
|
2097
2156
|
}
|
|
2098
2157
|
for (const file of sources) original(targetName, label, root, file)
|
|
@@ -2165,7 +2224,7 @@ export async function collectTurboSources(options: {
|
|
|
2165
2224
|
// React module defines itself
|
|
2166
2225
|
add(
|
|
2167
2226
|
`${core}/${TURBO_CORE_PUBLIC_HEADERS}/${TURBO_ENTRY_HEADER}`,
|
|
2168
|
-
'#pragma once\nextern "C" void peachTurboInitialize();\n',
|
|
2227
|
+
'#pragma once\nextern "C" void peachTurboInitialize();\n// the +1 Fabric component view a root of the process shows, in an app with one\nextern "C" void *peach_fabric_view_content(int tag);\n',
|
|
2169
2228
|
)
|
|
2170
2229
|
add(
|
|
2171
2230
|
`${core}/${TURBO_CORE_PUBLIC_HEADERS}/module.modulemap`,
|
|
@@ -2319,6 +2378,26 @@ export async function collectTurboSources(options: {
|
|
|
2319
2378
|
original(TURBO_CORE_TARGET, 'ReactCodegen', generated, 'RCTModuleProviders.h'),
|
|
2320
2379
|
)
|
|
2321
2380
|
}
|
|
2381
|
+
// the app's components as its RCTThirdPartyComponentsProvider maps them,
|
|
2382
|
+
// less those of packages Peach answers itself, whose classes are not linked
|
|
2383
|
+
const thirdParty = path.join(generated, 'RCTThirdPartyComponentsProvider.mm')
|
|
2384
|
+
if (fabricPackages.size > 0 && fs.existsSync(thirdParty))
|
|
2385
|
+
for (const [, name, className, owner] of fs
|
|
2386
|
+
.readFileSync(thirdParty, 'utf8')
|
|
2387
|
+
.matchAll(/@"([^"]+)": NSClassFromString\(@"([^"]+)"\), \/\/ (\S+)/g))
|
|
2388
|
+
if (fabricPackages.has(owner!))
|
|
2389
|
+
fabricViews.push({ name: name!, className: className! })
|
|
2390
|
+
// the host compiles with the first Fabric package's own settings, which
|
|
2391
|
+
// reach the React Fabric headers its component views include
|
|
2392
|
+
if (fabricViews.length > 0 && fabricTarget) {
|
|
2393
|
+
result.fabricComponents = fabricViews.map(({ name }) => name)
|
|
2394
|
+
const unit = `${targetPath(fabricTarget.targetName)}/PeachFabricHost.mm`
|
|
2395
|
+
add(unit, fabricHostSource(fabricViews))
|
|
2396
|
+
scanText(
|
|
2397
|
+
{ key: unit, ...fabricTarget, relative: 'PeachFabricHost.mm' },
|
|
2398
|
+
result.files[unit]!,
|
|
2399
|
+
)
|
|
2400
|
+
}
|
|
2322
2401
|
}
|
|
2323
2402
|
if (fabric || legacyBridge) {
|
|
2324
2403
|
// React-Core's own compiler_flags select the Hermes executor factory,
|
|
@@ -2723,38 +2802,6 @@ void dispatchToJSThread(dispatch_block_t block) {
|
|
|
2723
2802
|
}
|
|
2724
2803
|
} // namespace
|
|
2725
2804
|
|
|
2726
|
-
static CGFloat peachScreenBrightness = 0.5;
|
|
2727
|
-
|
|
2728
|
-
@implementation UIScreen (PeachTurboRuntime)
|
|
2729
|
-
+ (UIScreen *)mainScreen {
|
|
2730
|
-
static UIScreen *screen = nil;
|
|
2731
|
-
if (!screen) screen = [[UIScreen alloc] init];
|
|
2732
|
-
return screen;
|
|
2733
|
-
}
|
|
2734
|
-
- (CGFloat)brightness {
|
|
2735
|
-
return peachScreenBrightness;
|
|
2736
|
-
}
|
|
2737
|
-
- (void)setBrightness:(CGFloat)value {
|
|
2738
|
-
peachScreenBrightness = value;
|
|
2739
|
-
}
|
|
2740
|
-
@end
|
|
2741
|
-
|
|
2742
|
-
static BOOL peachIdleTimerDisabled = NO;
|
|
2743
|
-
|
|
2744
|
-
@implementation UIApplication (PeachTurboRuntime)
|
|
2745
|
-
+ (UIApplication *)sharedApplication {
|
|
2746
|
-
static UIApplication *app = nil;
|
|
2747
|
-
if (!app) app = [[UIApplication alloc] init];
|
|
2748
|
-
return app;
|
|
2749
|
-
}
|
|
2750
|
-
- (BOOL)isIdleTimerDisabled {
|
|
2751
|
-
return peachIdleTimerDisabled;
|
|
2752
|
-
}
|
|
2753
|
-
- (void)setIdleTimerDisabled:(BOOL)disabled {
|
|
2754
|
-
peachIdleTimerDisabled = disabled;
|
|
2755
|
-
}
|
|
2756
|
-
@end
|
|
2757
|
-
|
|
2758
2805
|
// React Native's own modules register before any provider's, and RCTBridge.mm
|
|
2759
2806
|
// creates the registry's queue in the first RCTRegisterModule. the engine
|
|
2760
2807
|
// supplies those modules, so a process whose providers register none (codegen
|
|
@@ -2875,6 +2922,12 @@ ${
|
|
|
2875
2922
|
|
|
2876
2923
|
@end
|
|
2877
2924
|
|
|
2925
|
+
// an app's Fabric component views, which its own Fabric host defines
|
|
2926
|
+
extern "C" void peachInstallFabricViews(facebook::jsi::Runtime &runtime) __attribute__((weak));
|
|
2927
|
+
|
|
2928
|
+
// UIKitCore: the key window and root view controller an app delegate makes at launch
|
|
2929
|
+
extern "C" void PeachLaunchReactNativeWindow(void);
|
|
2930
|
+
|
|
2878
2931
|
extern "C" void peachTurboInitialize() {
|
|
2879
2932
|
objc_create_block_classes_as_subclasses_of([NSObject class]);
|
|
2880
2933
|
if (Class blockClass = NSClassFromString(@"_NSBlock")) {
|
|
@@ -2888,6 +2941,7 @@ extern "C" void peachTurboInitialize() {
|
|
|
2888
2941
|
static_cast<uint32_t *>((__bridge void *)mainQueueClass)[4] &= ~2048u;
|
|
2889
2942
|
*reinterpret_cast<void **>(&_dispatch_main_q) = (__bridge void *)mainQueueClass;
|
|
2890
2943
|
}
|
|
2944
|
+
PeachLaunchReactNativeWindow();
|
|
2891
2945
|
auto& runtime = peach::jsi_runtime::create(
|
|
2892
2946
|
[] { invoker->drain(); },
|
|
2893
2947
|
[] {
|
|
@@ -2952,6 +3006,7 @@ ${
|
|
|
2952
3006
|
}];
|
|
2953
3007
|
[decorator.moduleRegistry setTurboModuleRegistry:manager];
|
|
2954
3008
|
[manager installJSBindings:runtime];
|
|
3009
|
+
if (peachInstallFabricViews) peachInstallFabricViews(runtime);
|
|
2955
3010
|
}
|
|
2956
3011
|
|
|
2957
3012
|
// the screenshot the device took, as UIKit posts it to every observer in the
|
|
@@ -2997,3 +3052,152 @@ ${moduleProviders ? ' [found addObjectsFromArray:RCTModuleProviders.moduleProvi
|
|
|
2997
3052
|
}
|
|
2998
3053
|
`
|
|
2999
3054
|
}
|
|
3055
|
+
|
|
3056
|
+
const FABRIC_HOST_INCLUDES = `#import <Foundation/Foundation.h>
|
|
3057
|
+
#import <React/RCTComponentViewFactory.h>
|
|
3058
|
+
#import <React/RCTComponentViewProtocol.h>
|
|
3059
|
+
#import <React/RCTComponentViewRegistry.h>
|
|
3060
|
+
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
|
|
3061
|
+
#include <react/renderer/core/LayoutMetrics.h>
|
|
3062
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
3063
|
+
#include <react/renderer/core/RawProps.h>
|
|
3064
|
+
#include <react/utils/ContextContainer.h>
|
|
3065
|
+
#include <cstdio>
|
|
3066
|
+
#include <cstdlib>
|
|
3067
|
+
#include <unordered_map>
|
|
3068
|
+
#include <jsi/jsi.h>
|
|
3069
|
+
|
|
3070
|
+
using namespace facebook;
|
|
3071
|
+
`
|
|
3072
|
+
|
|
3073
|
+
// the app's codegen components mounted as React Native's RCTMountingManager
|
|
3074
|
+
// mounts them (RCTPerformMountInstructions): the component view factory with
|
|
3075
|
+
// the app's third-party components, one registry dequeuing and recycling
|
|
3076
|
+
// views, and props each component's descriptor clones from the props React
|
|
3077
|
+
// passes. the engine lays the view out and paints its style; the view is the
|
|
3078
|
+
// content of a root of this process.
|
|
3079
|
+
function fabricHostSource(views: readonly FabricComponent[]): string {
|
|
3080
|
+
const entries = views
|
|
3081
|
+
.map(
|
|
3082
|
+
({ name, className }) =>
|
|
3083
|
+
`@${JSON.stringify(name)}: NSClassFromString(@${JSON.stringify(className)})`,
|
|
3084
|
+
)
|
|
3085
|
+
.join(', ')
|
|
3086
|
+
return `${FABRIC_HOST_INCLUDES}
|
|
3087
|
+
@interface PeachFabricComponents : NSObject <RCTComponentViewFactoryComponentProvider>
|
|
3088
|
+
@end
|
|
3089
|
+
|
|
3090
|
+
@implementation PeachFabricComponents
|
|
3091
|
+
- (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
|
3092
|
+
{
|
|
3093
|
+
return @{${entries}};
|
|
3094
|
+
}
|
|
3095
|
+
@end
|
|
3096
|
+
|
|
3097
|
+
namespace {
|
|
3098
|
+
struct PeachFabricView {
|
|
3099
|
+
react::ComponentHandle handle;
|
|
3100
|
+
const react::ComponentDescriptor *descriptor;
|
|
3101
|
+
react::Props::Shared props;
|
|
3102
|
+
react::LayoutMetrics layoutMetrics;
|
|
3103
|
+
};
|
|
3104
|
+
PeachFabricComponents *fabricComponents;
|
|
3105
|
+
RCTComponentViewRegistry *fabricRegistry;
|
|
3106
|
+
std::shared_ptr<const react::ContextContainer> fabricContext;
|
|
3107
|
+
react::ComponentDescriptorRegistry::Shared fabricDescriptors;
|
|
3108
|
+
std::unordered_map<int, PeachFabricView> fabricViews;
|
|
3109
|
+
int nextFabricView = 1;
|
|
3110
|
+
std::string fabricNames = ${JSON.stringify(views.map(({ name }) => name).join('\n'))};
|
|
3111
|
+
|
|
3112
|
+
PeachFabricView &fabricView(int tag) {
|
|
3113
|
+
auto found = fabricViews.find(tag);
|
|
3114
|
+
if (found == fabricViews.end()) {
|
|
3115
|
+
std::fprintf(stderr, "no mounted Fabric view %d\\n", tag);
|
|
3116
|
+
std::abort();
|
|
3117
|
+
}
|
|
3118
|
+
return found->second;
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
react::Props::Shared fabricCloneProps(jsi::Runtime &rt, const PeachFabricView &view, const jsi::Value &props) {
|
|
3122
|
+
react::PropsParserContext context{-1, *fabricContext};
|
|
3123
|
+
return view.descriptor->cloneProps(context, view.props, react::RawProps(rt, props));
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
} // namespace
|
|
3127
|
+
|
|
3128
|
+
extern "C" void peachInstallFabricViews(jsi::Runtime &rt) {
|
|
3129
|
+
fabricComponents = [PeachFabricComponents new];
|
|
3130
|
+
RCTComponentViewFactory *factory = [RCTComponentViewFactory currentComponentViewFactory];
|
|
3131
|
+
factory.thirdPartyFabricComponentsProvider = fabricComponents;
|
|
3132
|
+
fabricRegistry = [RCTComponentViewRegistry new];
|
|
3133
|
+
fabricContext = std::make_shared<const react::ContextContainer>();
|
|
3134
|
+
react::ComponentDescriptorParameters parameters{{}, fabricContext, nullptr};
|
|
3135
|
+
fabricDescriptors = [factory createComponentDescriptorRegistryWithParameters:parameters];
|
|
3136
|
+
auto views = jsi::Object(rt);
|
|
3137
|
+
auto method = [&](const char *name, unsigned count, jsi::HostFunctionType body) {
|
|
3138
|
+
views.setProperty(rt, name, jsi::Function::createFromHostFunction(rt, jsi::PropNameID::forAscii(rt, name), count, std::move(body)));
|
|
3139
|
+
};
|
|
3140
|
+
// Create then Insert: the first props, no event emitter or state, and the
|
|
3141
|
+
// layout the view has before the engine measures it
|
|
3142
|
+
method("create", 2, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
|
|
3143
|
+
const auto &descriptor = fabricDescriptors->at(args[0].asString(rt).utf8(rt));
|
|
3144
|
+
int tag = nextFabricView++;
|
|
3145
|
+
auto &view = fabricViews.emplace(tag, PeachFabricView{descriptor.getComponentHandle(), &descriptor, nullptr, {}}).first->second;
|
|
3146
|
+
view.props = fabricCloneProps(rt, view, args[1]);
|
|
3147
|
+
UIView<RCTComponentViewProtocol> *componentView =
|
|
3148
|
+
[fabricRegistry dequeueComponentViewWithComponentHandle:view.handle tag:tag].view;
|
|
3149
|
+
[componentView updateProps:view.props oldProps:nullptr];
|
|
3150
|
+
[componentView updateEventEmitter:nullptr];
|
|
3151
|
+
[componentView updateState:nullptr oldState:nullptr];
|
|
3152
|
+
[componentView updateLayoutMetrics:view.layoutMetrics oldLayoutMetrics:react::EmptyLayoutMetrics];
|
|
3153
|
+
[componentView finalizeUpdates:RNComponentViewUpdateMaskAll];
|
|
3154
|
+
return jsi::Value(tag);
|
|
3155
|
+
});
|
|
3156
|
+
// Update with the props React changed since the last commit
|
|
3157
|
+
method("update", 2, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
|
|
3158
|
+
int tag = static_cast<int>(args[0].asNumber());
|
|
3159
|
+
auto &view = fabricView(tag);
|
|
3160
|
+
auto oldProps = view.props;
|
|
3161
|
+
view.props = fabricCloneProps(rt, view, args[1]);
|
|
3162
|
+
UIView<RCTComponentViewProtocol> *componentView = [fabricRegistry componentViewDescriptorWithTag:tag].view;
|
|
3163
|
+
[componentView updateProps:view.props oldProps:oldProps];
|
|
3164
|
+
[componentView finalizeUpdates:RNComponentViewUpdateMaskProps];
|
|
3165
|
+
return jsi::Value::undefined();
|
|
3166
|
+
});
|
|
3167
|
+
// Update with the size and scale the engine laid the view out at
|
|
3168
|
+
method("layout", 4, [](jsi::Runtime &, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
|
|
3169
|
+
int tag = static_cast<int>(args[0].asNumber());
|
|
3170
|
+
auto &view = fabricView(tag);
|
|
3171
|
+
auto metrics = view.layoutMetrics;
|
|
3172
|
+
metrics.frame = react::Rect{{0, 0}, {static_cast<react::Float>(args[1].asNumber()), static_cast<react::Float>(args[2].asNumber())}};
|
|
3173
|
+
metrics.pointScaleFactor = static_cast<react::Float>(args[3].asNumber());
|
|
3174
|
+
if (metrics == view.layoutMetrics) return jsi::Value::undefined();
|
|
3175
|
+
UIView<RCTComponentViewProtocol> *componentView = [fabricRegistry componentViewDescriptorWithTag:tag].view;
|
|
3176
|
+
[componentView updateLayoutMetrics:metrics oldLayoutMetrics:view.layoutMetrics];
|
|
3177
|
+
view.layoutMetrics = metrics;
|
|
3178
|
+
[componentView finalizeUpdates:RNComponentViewUpdateMaskLayoutMetrics];
|
|
3179
|
+
return jsi::Value::undefined();
|
|
3180
|
+
});
|
|
3181
|
+
// Remove then Delete: the registry recycles the view
|
|
3182
|
+
method("drop", 1, [](jsi::Runtime &, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
|
|
3183
|
+
int tag = static_cast<int>(args[0].asNumber());
|
|
3184
|
+
auto &view = fabricView(tag);
|
|
3185
|
+
RCTComponentViewDescriptor descriptor = [fabricRegistry componentViewDescriptorWithTag:tag];
|
|
3186
|
+
[descriptor.view removeFromSuperview];
|
|
3187
|
+
[fabricRegistry enqueueComponentViewWithComponentHandle:view.handle tag:tag componentViewDescriptor:descriptor];
|
|
3188
|
+
fabricViews.erase(tag);
|
|
3189
|
+
return jsi::Value::undefined();
|
|
3190
|
+
});
|
|
3191
|
+
rt.global().setProperty(rt, "peachFabricViews", std::move(views));
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
extern "C" void *peach_fabric_view_content(int tag) {
|
|
3195
|
+
return (__bridge_retained void *)[fabricRegistry componentViewDescriptorWithTag:tag].view;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
// the component names the host registers as views, newline separated
|
|
3199
|
+
extern "C" __attribute__((export_name("peach_fabric_component_names"))) const char *peachFabricComponentNames() {
|
|
3200
|
+
return fabricNames.c_str();
|
|
3201
|
+
}
|
|
3202
|
+
`
|
|
3203
|
+
}
|
package/src/vite-plugin-one.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { WebSocket, WebSocketServer } from 'ws'
|
|
|
21
21
|
import { resolveAppProject } from '../cli/app-project'
|
|
22
22
|
import { loadRNXAppConfig } from './app-config'
|
|
23
23
|
import { DEFAULT_SOOTSIM_BRIDGE_PORT } from './bridge-constants'
|
|
24
|
-
import {
|
|
24
|
+
import { loadCliRuntime } from './cli-runtime'
|
|
25
25
|
import { matchConfigModule, PEACH_WORKSPACE_MODULE_MARKER } from './config'
|
|
26
26
|
import {
|
|
27
27
|
launchRnxDesktop,
|
|
@@ -164,8 +164,8 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
164
164
|
async generateBundle(_options, bundle) {
|
|
165
165
|
if (options.enabled === false || dev) return
|
|
166
166
|
const versions = readInstalledNativePackageVersions(root)
|
|
167
|
-
const { attachRolldownBundleInventory } =
|
|
168
|
-
|
|
167
|
+
const { attachRolldownBundleInventory } = (await loadCliRuntime())
|
|
168
|
+
.rolldown_bundle_inventory
|
|
169
169
|
for (const output of Object.values(bundle)) {
|
|
170
170
|
if (output.type !== 'chunk') continue
|
|
171
171
|
output.code = await attachRolldownBundleInventory(
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { prepareNativeAppRoot } from './expo-native-workspace'
|
|
2
|
+
import { compiledModuleRequestHandler } from './nitro-bundle'
|
|
3
|
+
import { swiftDistributionRoot } from './swift-distribution'
|
|
4
|
+
import {
|
|
5
|
+
openXcodeProject,
|
|
6
|
+
prepareXcodeSwiftPackages,
|
|
7
|
+
swiftPackageMetadata,
|
|
8
|
+
} from './swift-host'
|
|
9
|
+
import { installedXcodeWorkspace, readXcodeExtensionTargets } from './xcode-project'
|
|
10
|
+
import type { SwiftEntryOptions } from './swiftContract'
|
|
11
|
+
|
|
12
|
+
export const WIDGET_EXTENSION_ROUTE = '/__peach/widget-extension'
|
|
13
|
+
|
|
14
|
+
// the app's WidgetKit extension target, compiled from the installed workspace
|
|
15
|
+
// with the pods its own Podfile target links, as Xcode builds the extension
|
|
16
|
+
// process that draws the app's widgets and live activities.
|
|
17
|
+
export async function compileWidgetExtension(
|
|
18
|
+
appRoot: string,
|
|
19
|
+
origin: string,
|
|
20
|
+
): Promise<{ metadata: SwiftEntryOptions } | null> {
|
|
21
|
+
const projectRoot = await prepareNativeAppRoot(appRoot)
|
|
22
|
+
const workspace = installedXcodeWorkspace(projectRoot)
|
|
23
|
+
if (!workspace) return null
|
|
24
|
+
const extensions = readXcodeExtensionTargets(workspace).filter(({ infoPlist }) => {
|
|
25
|
+
const extension = infoPlist.NSExtension
|
|
26
|
+
return (
|
|
27
|
+
typeof extension === 'object' &&
|
|
28
|
+
extension !== null &&
|
|
29
|
+
'NSExtensionPointIdentifier' in extension &&
|
|
30
|
+
extension.NSExtensionPointIdentifier === 'com.apple.widgetkit-extension'
|
|
31
|
+
)
|
|
32
|
+
})
|
|
33
|
+
if (extensions.length === 0) return null
|
|
34
|
+
if (extensions.length > 1)
|
|
35
|
+
throw new Error(
|
|
36
|
+
`${workspace}: more than one WidgetKit extension (${extensions.map(({ name }) => name).join(', ')}) is unmeasured`,
|
|
37
|
+
)
|
|
38
|
+
const { name } = extensions[0]!
|
|
39
|
+
const moduleRoot = await swiftDistributionRoot()
|
|
40
|
+
await prepareXcodeSwiftPackages(workspace, name, 'Release')
|
|
41
|
+
const root = openXcodeProject(workspace, name, moduleRoot, 'Release')
|
|
42
|
+
return { metadata: await swiftPackageMetadata(root, name, moduleRoot, origin) }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const handleWidgetExtensionRequest = compiledModuleRequestHandler(
|
|
46
|
+
'Widget extension',
|
|
47
|
+
(root, origin) => compileWidgetExtension(root, origin),
|
|
48
|
+
)
|
package/src/xcode-project.ts
CHANGED
|
@@ -225,6 +225,7 @@ export interface XcodeAppTarget extends XcodeModuleTarget {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
const APPLICATION = 'com.apple.product-type.application'
|
|
228
|
+
const APP_EXTENSION = 'com.apple.product-type.app-extension'
|
|
228
229
|
const RESOURCE_BUNDLE = 'com.apple.product-type.bundle'
|
|
229
230
|
// the MACH_O_TYPE each product type builds with when no setting names one, from
|
|
230
231
|
// the product type specifications in Xcode's CoreBuildSystem plugin.
|
|
@@ -642,6 +643,21 @@ interface TargetRef {
|
|
|
642
643
|
target: PlistDict
|
|
643
644
|
}
|
|
644
645
|
|
|
646
|
+
type HeaderPhaseFile = { file: string; visibility: 'Public' | 'Private' | 'Project' }
|
|
647
|
+
|
|
648
|
+
let developerDir: string | undefined
|
|
649
|
+
function selectedDeveloperDir(): string {
|
|
650
|
+
developerDir ??=
|
|
651
|
+
process.platform === 'darwin'
|
|
652
|
+
? // runner-toolchain-platform: darwin
|
|
653
|
+
execFileSync('xcode-select', ['-p'], {
|
|
654
|
+
encoding: 'utf8',
|
|
655
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
656
|
+
}).trim()
|
|
657
|
+
: ''
|
|
658
|
+
return developerDir
|
|
659
|
+
}
|
|
660
|
+
|
|
645
661
|
// the configuration a project builds when nothing names one: xcode's run
|
|
646
662
|
// action builds Debug, else the list's default.
|
|
647
663
|
function defaultConfiguration(project: LoadedProject): string {
|
|
@@ -741,20 +757,12 @@ function targetSettings(
|
|
|
741
757
|
resolving.delete(marker)
|
|
742
758
|
return value
|
|
743
759
|
}
|
|
744
|
-
let developerDir: string | undefined
|
|
745
760
|
// export derived settings too, just as explicit project settings are exported.
|
|
746
761
|
const derivedSettings: Record<string, () => string> = {
|
|
747
762
|
DEVELOPER_DIR: () =>
|
|
748
763
|
options.environment?.DEVELOPER_DIR ??
|
|
749
764
|
process.env.DEVELOPER_DIR ??
|
|
750
|
-
(
|
|
751
|
-
process.platform === 'darwin'
|
|
752
|
-
? // runner-toolchain-platform: darwin
|
|
753
|
-
execFileSync('xcode-select', ['-p'], {
|
|
754
|
-
encoding: 'utf8',
|
|
755
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
756
|
-
}).trim()
|
|
757
|
-
: ''),
|
|
765
|
+
selectedDeveloperDir(),
|
|
758
766
|
PRODUCT_NAME: () => get('TARGET_NAME'),
|
|
759
767
|
PRODUCT_MODULE_NAME: () => applyOperator(get('PRODUCT_NAME'), 'c99extidentifier'),
|
|
760
768
|
EXECUTABLE_NAME: () => get('PRODUCT_NAME'),
|
|
@@ -1582,7 +1590,7 @@ export function readXcodeExtensionTargets(input: string): {
|
|
|
1582
1590
|
}[] {
|
|
1583
1591
|
return workspaceProjects(fs.realpathSync.native(input)).projects.flatMap((project) =>
|
|
1584
1592
|
projectTargets(project).flatMap((ref) => {
|
|
1585
|
-
if (ref.target.productType !==
|
|
1593
|
+
if (ref.target.productType !== APP_EXTENSION) return []
|
|
1586
1594
|
const name = str(ref.target.name) ?? ref.id
|
|
1587
1595
|
const { get, keys, xcconfigs } = targetSettings(
|
|
1588
1596
|
ref,
|
|
@@ -1900,7 +1908,14 @@ export function readXcodeAppTarget(
|
|
|
1900
1908
|
options.installedPods,
|
|
1901
1909
|
)
|
|
1902
1910
|
const allTargets = projects.flatMap(projectTargets)
|
|
1903
|
-
|
|
1911
|
+
// an extension runs as its own process: named, it builds as the compiled unit
|
|
1912
|
+
const appTargets = allTargets.filter(
|
|
1913
|
+
(ref) =>
|
|
1914
|
+
isIosAppTarget(ref, options) ||
|
|
1915
|
+
(targetName !== undefined &&
|
|
1916
|
+
ref.target.name === targetName &&
|
|
1917
|
+
ref.target.productType === APP_EXTENSION),
|
|
1918
|
+
)
|
|
1904
1919
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id)
|
|
1905
1920
|
const container = path.basename(xcodeprojOrWorkspace)
|
|
1906
1921
|
const named = targetName
|
|
@@ -2004,8 +2019,19 @@ export function readXcodeAppTarget(
|
|
|
2004
2019
|
const words = settingList(flags)
|
|
2005
2020
|
const linked = new Set<TargetRef>(linkedTargets(ref).map((link) => link.target))
|
|
2006
2021
|
return words.flatMap((word, index) => {
|
|
2022
|
+
// ld finds `-l<name>` as lib<name>.a or lib<name>.dylib among the built products
|
|
2023
|
+
const library =
|
|
2024
|
+
word.startsWith('-l') && word.length > 2
|
|
2025
|
+
? word.slice(2)
|
|
2026
|
+
: words[index - 1] === '-l'
|
|
2027
|
+
? word
|
|
2028
|
+
: undefined
|
|
2007
2029
|
const target =
|
|
2008
|
-
words[index - 1] === '-framework'
|
|
2030
|
+
words[index - 1] === '-framework'
|
|
2031
|
+
? byProduct.get(`${word}.framework`)
|
|
2032
|
+
: library
|
|
2033
|
+
? (byProduct.get(`lib${library}.a`) ?? byProduct.get(`lib${library}.dylib`))
|
|
2034
|
+
: undefined
|
|
2009
2035
|
if (!target || target === ref || linked.has(target)) return []
|
|
2010
2036
|
linked.add(target)
|
|
2011
2037
|
return [{ target, attributes: [] }]
|
|
@@ -2040,9 +2066,16 @@ export function readXcodeAppTarget(
|
|
|
2040
2066
|
visit(app)
|
|
2041
2067
|
|
|
2042
2068
|
// a target's headers build phase, each header with the visibility it publishes.
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2045
|
-
|
|
2069
|
+
const headerPhases = new Map<string, HeaderPhaseFile[]>()
|
|
2070
|
+
const headerPhase = (ref: TargetRef): HeaderPhaseFile[] => {
|
|
2071
|
+
const key = `${ref.project.xcodeproj}\0${ref.id}`
|
|
2072
|
+
const cached = headerPhases.get(key)
|
|
2073
|
+
if (cached) return cached
|
|
2074
|
+
const files = readHeaderPhase(ref)
|
|
2075
|
+
headerPhases.set(key, files)
|
|
2076
|
+
return files
|
|
2077
|
+
}
|
|
2078
|
+
const readHeaderPhase = (ref: TargetRef): HeaderPhaseFile[] =>
|
|
2046
2079
|
list(ref.target.buildPhases).flatMap((phaseId) => {
|
|
2047
2080
|
const phase = ref.project.object(phaseId)
|
|
2048
2081
|
if (phase?.isa !== 'PBXHeadersBuildPhase') return []
|
|
@@ -2064,6 +2097,24 @@ export function readXcodeAppTarget(
|
|
|
2064
2097
|
]
|
|
2065
2098
|
})
|
|
2066
2099
|
})
|
|
2100
|
+
// every published header of the project's non-framework targets, by product.
|
|
2101
|
+
const projectNonFrameworkHeaders = new Map<LoadedProject, Map<string, string>>()
|
|
2102
|
+
const nonFrameworkHeadersOf = (project: LoadedProject): Map<string, string> => {
|
|
2103
|
+
const cached = projectNonFrameworkHeaders.get(project)
|
|
2104
|
+
if (cached) return cached
|
|
2105
|
+
const headers = new Map<string, string>()
|
|
2106
|
+
for (const other of projectTargets(project)) {
|
|
2107
|
+
if (FRAMEWORK_PRODUCTS.has(str(other.target.productType) ?? '')) continue
|
|
2108
|
+
const otherProduct = productName(other)
|
|
2109
|
+
for (const { file, visibility } of headerPhase(other)) {
|
|
2110
|
+
if (visibility === 'Project') continue
|
|
2111
|
+
const key = `${otherProduct}/${path.basename(file)}`
|
|
2112
|
+
if (!headers.has(key)) headers.set(key, file)
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
projectNonFrameworkHeaders.set(project, headers)
|
|
2116
|
+
return headers
|
|
2117
|
+
}
|
|
2067
2118
|
const productNames = new Map<string, string>()
|
|
2068
2119
|
const productName = (ref: TargetRef) => {
|
|
2069
2120
|
const key = `${ref.project.xcodeproj}\0${ref.id}`
|
|
@@ -2343,16 +2394,7 @@ export function readXcodeAppTarget(
|
|
|
2343
2394
|
const qualified = `${product}/${name}`
|
|
2344
2395
|
if (!ownHeaders.has(qualified)) ownHeaders.set(qualified, file)
|
|
2345
2396
|
}
|
|
2346
|
-
const nonFrameworkHeaders =
|
|
2347
|
-
for (const other of projectTargets(ref.project)) {
|
|
2348
|
-
if (FRAMEWORK_PRODUCTS.has(str(other.target.productType) ?? '')) continue
|
|
2349
|
-
const otherProduct = productName(other)
|
|
2350
|
-
for (const { file, visibility } of headerPhase(other)) {
|
|
2351
|
-
if (visibility === 'Project') continue
|
|
2352
|
-
const key = `${otherProduct}/${path.basename(file)}`
|
|
2353
|
-
if (!nonFrameworkHeaders.has(key)) nonFrameworkHeaders.set(key, file)
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2397
|
+
const nonFrameworkHeaders = nonFrameworkHeadersOf(ref.project)
|
|
2356
2398
|
const wrapper = path.join(settings('BUILT_PRODUCTS_DIR'), `${product}.framework`)
|
|
2357
2399
|
const moduleMap =
|
|
2358
2400
|
(settings('DEFINES_MODULE') === 'YES' || !framework) && settings('MODULEMAP_FILE')
|