peachsim 0.1.2269 → 0.1.2271
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/app-catalog.ts +13 -5
- package/cli/bridge-flow-runner.ts +1 -1
- package/cli/commands/control.ts +10 -1
- package/cli/commands/flow.ts +117 -23
- package/cli/commands/record.ts +4 -1
- package/cli/commands/shell-url.ts +10 -2
- package/cli/commands/upload.ts +49 -39
- package/detox/index.ts +8 -4
- 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 +70 -72
- 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 +8 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +49 -59
- 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 +82 -76
- package/dist-lib/host/fetch-proxy-handler.cjs +6 -6
- 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 +6 -6
- 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 +9 -5
- 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 +6 -6
- package/dist-lib/native-app-identity-project.cjs +3 -3
- package/dist-lib/native-app-identity-project.mjs +3 -3
- 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 +53 -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 +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +102 -84
- package/dist-lib/swift-compile.cjs +23 -12
- package/dist-lib/swift-compile.mjs +23 -12
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +22 -11
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +26 -15
- package/dist-lib/vite.cjs +6 -6
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/layout-engine.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/yoga-layout.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/recordingBridgeContract.d.ts +12 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/ui/hosting-safe-area.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/ui/popover-placement.d.ts +1 -0
- package/java-platform/licenses/android.txt +6 -3
- package/java-platform/licenses/openjdk.txt +5 -4
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/desktop-host-delivery.ts +22 -6
- package/src/expo-pod-prebuilt.ts +29 -3
- package/src/guest-bundle.ts +1 -0
- package/src/kotlin-host.ts +8 -4
- package/src/native-package-slice-build.ts +156 -96
- package/src/nitro-adapter.lock.json +279 -279
- package/src/nitro-superset.lock.json +4 -4
- package/src/package-tree-digest.ts +33 -10
- package/src/swift-distribution.lock.json +12 -11
- package/src/swift-submit.ts +2 -1
- package/src/swift-toolchain.ts +24 -10
- package/src/turbo-compile.ts +5 -1
- package/src/turbo-runtime.lock.json +22 -22
- package/src/turbo-source.ts +4 -32
package/src/expo-pod-prebuilt.ts
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
nativeEntryPrefix,
|
|
31
31
|
nativePackageEntryName,
|
|
32
32
|
} from './native-prebuilt'
|
|
33
|
-
import {
|
|
33
|
+
import { nativePackageTreeDigest } from './package-tree-digest'
|
|
34
34
|
import { swiftNativePin } from './swift-native-pin'
|
|
35
35
|
|
|
36
36
|
export interface ExpoPodPackage {
|
|
@@ -72,7 +72,7 @@ export async function expoPodInputs(
|
|
|
72
72
|
answered: JSON.stringify([...peachAnsweredNativePackages()].sort()),
|
|
73
73
|
name: pod.name,
|
|
74
74
|
version: pod.version,
|
|
75
|
-
tree: await
|
|
75
|
+
tree: await nativePackageTreeDigest(pod.root),
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -151,7 +151,33 @@ export async function prebuiltExpoPods(
|
|
|
151
151
|
),
|
|
152
152
|
)
|
|
153
153
|
const bundled = await lookup(expoAppBundleEntryUrl(bundleKey, 'metadata.json'))
|
|
154
|
-
if (bundled)
|
|
154
|
+
if (bundled) {
|
|
155
|
+
const isCovered = (swiftModule: string) =>
|
|
156
|
+
bundled.namespaces.some(
|
|
157
|
+
(ns) => ns === swiftModule || ns.startsWith(`${swiftModule}.`),
|
|
158
|
+
)
|
|
159
|
+
const remaining = podEntries.filter(({ pod }) => !isCovered(pod.swiftModule))
|
|
160
|
+
if (remaining.length === 0) return bundled
|
|
161
|
+
const extraEntries = await Promise.all(
|
|
162
|
+
remaining.map(async ({ pod, podKey }) =>
|
|
163
|
+
lookup(expoPodEntryUrl(pod.name, podKey, 'metadata.json')),
|
|
164
|
+
),
|
|
165
|
+
)
|
|
166
|
+
const extraHits = extraEntries.filter((entry) => entry !== null)
|
|
167
|
+
if (extraHits.length === 0) return bundled
|
|
168
|
+
const merged = [bundled, ...extraHits]
|
|
169
|
+
const bridgeModules = [
|
|
170
|
+
...new Set(merged.flatMap((entry) => entry.bridgeModules ?? [])),
|
|
171
|
+
]
|
|
172
|
+
return {
|
|
173
|
+
namespaces: merged.flatMap((entry) => entry.namespaces),
|
|
174
|
+
...(merged.some((entry) => entry.bridgeModules !== undefined)
|
|
175
|
+
? { bridgeModules }
|
|
176
|
+
: {}),
|
|
177
|
+
modules: merged.flatMap((entry) => entry.modules),
|
|
178
|
+
failures: [],
|
|
179
|
+
}
|
|
180
|
+
}
|
|
155
181
|
}
|
|
156
182
|
const entries = await Promise.all(
|
|
157
183
|
podEntries.map(async ({ pod, podKey }) =>
|
package/src/guest-bundle.ts
CHANGED
package/src/kotlin-host.ts
CHANGED
|
@@ -142,9 +142,11 @@ function entrySource(ids: string[]): string {
|
|
|
142
142
|
'fun peachSetAndroidDeviceInfo(model: String, release: String, apiLevel: Int, locale: String, timeZone: String, settings: String, properties: String) {',
|
|
143
143
|
' Build.setDevice(model, release, apiLevel)',
|
|
144
144
|
' java.util.Locale.setDefault(java.util.Locale.forLanguageTag(locale))',
|
|
145
|
-
' java.util.TimeZone.setDevice(timeZone)',
|
|
146
145
|
' dev.peach.android.ProcessSettings.configure(settings)',
|
|
147
|
-
' android.
|
|
146
|
+
' // the engine reports the device zone apart; android keeps it in persist.sys.timezone',
|
|
147
|
+
' android.os.SystemProperties.configure(org.json.JSONObject(properties).put("persist.sys.timezone", timeZone).toString())',
|
|
148
|
+
" // a later call is the device's time zone change, which ActivityThread answers with setDefault(null)",
|
|
149
|
+
' if (dalvik.system.RuntimeHooks.getTimeZoneIdSupplier() == null) com.android.internal.os.RuntimeInit.commonInit() else java.util.TimeZone.setDefault(null)',
|
|
148
150
|
'}',
|
|
149
151
|
'',
|
|
150
152
|
'@OptIn(kotlin.js.ExperimentalJsExport::class, kotlinx.coroutines.DelicateCoroutinesApi::class)',
|
|
@@ -762,9 +764,11 @@ export async function expoKotlinArtifact(
|
|
|
762
764
|
'@JsExport fun peachSetAndroidDeviceInfo(model: String, release: String, apiLevel: Int, locale: String, timeZone: String, settings: String, properties: String) {',
|
|
763
765
|
' android.os.Build.setDevice(model, release, apiLevel)',
|
|
764
766
|
' java.util.Locale.setDefault(java.util.Locale.forLanguageTag(locale))',
|
|
765
|
-
' java.util.TimeZone.setDevice(timeZone)',
|
|
766
767
|
' dev.peach.android.ProcessSettings.configure(settings)',
|
|
767
|
-
' android.
|
|
768
|
+
' // the engine reports the device zone apart; android keeps it in persist.sys.timezone',
|
|
769
|
+
' android.os.SystemProperties.configure(org.json.JSONObject(properties).put("persist.sys.timezone", timeZone).toString())',
|
|
770
|
+
" // a later call is the device's time zone change, which ActivityThread answers with setDefault(null)",
|
|
771
|
+
' if (dalvik.system.RuntimeHooks.getTimeZoneIdSupplier() == null) com.android.internal.os.RuntimeInit.commonInit() else java.util.TimeZone.setDefault(null)',
|
|
768
772
|
' PeachExpoRuntime.configureProcessLocale(locale)',
|
|
769
773
|
'}',
|
|
770
774
|
'',
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
peachAnsweredNativePackages,
|
|
9
9
|
withUnansweredNativePackages,
|
|
10
10
|
} from './answeredNativePackages'
|
|
11
|
+
import { prepareNativeAppRoot } from './expo-native-workspace'
|
|
11
12
|
import { expoPodInputs, expoPodPackages } from './expo-pod-prebuilt'
|
|
13
|
+
import { cacheDir } from './home-paths'
|
|
12
14
|
import { isRecord } from './is-record'
|
|
13
15
|
import {
|
|
14
16
|
buildExpoSwiftPackageSlice,
|
|
@@ -23,14 +25,16 @@ import { nativeEntryKey } from './native-prebuilt'
|
|
|
23
25
|
import { selectCompiledNitroProviders } from './nitro-bundle'
|
|
24
26
|
import { prepareNitroCompileInput } from './nitro-compile'
|
|
25
27
|
import { NITRO_VIEWS_TARGET } from './nitro-source'
|
|
26
|
-
import {
|
|
28
|
+
import { nativePackageTreeDigest } from './package-tree-digest'
|
|
27
29
|
import { reactNativeCoreFloor } from './react-native-core'
|
|
28
30
|
import { compilerSourceDigest, compileSwiftProjectUnit } from './swift-compile'
|
|
29
31
|
import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distribution'
|
|
30
32
|
import { swiftNativePin } from './swift-native-pin'
|
|
31
33
|
import { swiftManifestTargets } from './swift-package'
|
|
34
|
+
import { withSwiftRootLock } from './swift-root-lock'
|
|
32
35
|
import { prepareTurboCompileInput } from './turbo-compile'
|
|
33
36
|
import { discoverTurboProviders, TURBO_CORE_TARGET } from './turbo-source'
|
|
37
|
+
import { installedXcodeWorkspace } from './xcode-project'
|
|
34
38
|
import type { NitroBuildConfiguration } from './nitroContract'
|
|
35
39
|
|
|
36
40
|
export interface DetectedNativePackage {
|
|
@@ -65,54 +69,61 @@ function resolveReactNativeRoot(appRoot: string): string {
|
|
|
65
69
|
export async function detectNativePackageKinds(
|
|
66
70
|
appRoot: string,
|
|
67
71
|
packageName?: string,
|
|
68
|
-
opts?: { includeAnswered?: readonly string[] },
|
|
72
|
+
opts?: { includeAnswered?: readonly string[]; kind?: NativePackageSliceKind },
|
|
69
73
|
): Promise<DetectedNativePackage[]> {
|
|
70
74
|
if (opts?.includeAnswered && opts.includeAnswered.length > 0) {
|
|
75
|
+
const nextOpts = opts.kind ? { kind: opts.kind } : undefined
|
|
71
76
|
return withUnansweredNativePackages(opts.includeAnswered, () =>
|
|
72
|
-
detectNativePackageKinds(appRoot, packageName),
|
|
77
|
+
detectNativePackageKinds(appRoot, packageName, nextOpts),
|
|
73
78
|
)
|
|
74
79
|
}
|
|
75
80
|
const realRoot = fs.realpathSync(appRoot)
|
|
76
81
|
const answered = peachAnsweredNativePackages()
|
|
77
82
|
const detected: DetectedNativePackage[] = []
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
if (!opts?.kind || opts.kind === 'expo-swift') {
|
|
85
|
+
for (const pod of await expoPodPackages(realRoot)) {
|
|
86
|
+
detected.push({
|
|
87
|
+
name: pod.name,
|
|
88
|
+
version: pod.version,
|
|
89
|
+
root: fs.realpathSync(pod.root),
|
|
90
|
+
kind: 'expo-swift',
|
|
91
|
+
})
|
|
92
|
+
}
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
const nitroNames = new Set<string>()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
if (!opts?.kind || opts.kind === 'nitro') {
|
|
97
|
+
const nitroSelection = await selectCompiledNitroProviders(realRoot)
|
|
98
|
+
for (const provider of nitroSelection?.providers ?? []) {
|
|
99
|
+
const root = fs.realpathSync(provider.root)
|
|
100
|
+
const meta = readPackageMeta(root)
|
|
101
|
+
const version = meta?.version ?? '0.0.0'
|
|
102
|
+
nitroNames.add(provider.name)
|
|
103
|
+
detected.push({
|
|
104
|
+
name: provider.name,
|
|
105
|
+
version,
|
|
106
|
+
root,
|
|
107
|
+
kind: 'nitro',
|
|
108
|
+
})
|
|
109
|
+
}
|
|
101
110
|
}
|
|
102
111
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
if (!opts?.kind || opts.kind === 'turbomodule') {
|
|
113
|
+
const seenTurbo = new Set<string>()
|
|
114
|
+
for (const provider of await discoverTurboProviders(realRoot)) {
|
|
115
|
+
const root = fs.realpathSync(provider.root)
|
|
116
|
+
const meta = readPackageMeta(root)
|
|
117
|
+
if (!meta || seenTurbo.has(meta.name)) continue
|
|
118
|
+
seenTurbo.add(meta.name)
|
|
119
|
+
if (answered.has(meta.name) || nitroNames.has(meta.name)) continue
|
|
120
|
+
detected.push({
|
|
121
|
+
name: meta.name,
|
|
122
|
+
version: meta.version,
|
|
123
|
+
root,
|
|
124
|
+
kind: 'turbomodule',
|
|
125
|
+
})
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
return detected
|
|
@@ -139,7 +150,7 @@ export async function turboPackageSliceInputs(opts: {
|
|
|
139
150
|
version: opts.packageVersion,
|
|
140
151
|
'react-native': opts.reactNativeVersion,
|
|
141
152
|
'core-mode': opts.coreMode,
|
|
142
|
-
tree: await
|
|
153
|
+
tree: await nativePackageTreeDigest(opts.packageRoot),
|
|
143
154
|
}
|
|
144
155
|
}
|
|
145
156
|
|
|
@@ -161,7 +172,7 @@ export async function nitroPackageSliceInputs(opts: {
|
|
|
161
172
|
'nitro-modules': opts.nitroVersion,
|
|
162
173
|
'react-native': opts.reactNativeVersion,
|
|
163
174
|
configuration: opts.configuration,
|
|
164
|
-
tree: await
|
|
175
|
+
tree: await nativePackageTreeDigest(opts.packageRoot),
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
178
|
|
|
@@ -206,17 +217,38 @@ export async function buildNativePackageSlice(opts: {
|
|
|
206
217
|
}
|
|
207
218
|
|
|
208
219
|
if (kind === 'turbomodule') {
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
let resolvedProjectRoot = projectRoot
|
|
221
|
+
let providers = (
|
|
222
|
+
await discoverTurboProviders(appRoot, resolvedProjectRoot, opts.iosTarget)
|
|
211
223
|
).filter((provider) => readPackageMeta(provider.root)?.name === opts.packageName)
|
|
212
224
|
if (providers.length === 0) return null
|
|
225
|
+
const hasExpoConfig = ['app.json', 'app.config.ts', 'app.config.js'].some((name) =>
|
|
226
|
+
fs.existsSync(path.join(appRoot, name)),
|
|
227
|
+
)
|
|
228
|
+
const hasSwiftSources = providers.some((provider) =>
|
|
229
|
+
fs
|
|
230
|
+
.readdirSync(provider.root, { recursive: true, encoding: 'utf8' })
|
|
231
|
+
.some((file) => file.endsWith('.swift')),
|
|
232
|
+
)
|
|
233
|
+
if (
|
|
234
|
+
!opts.projectRoot &&
|
|
235
|
+
!installedXcodeWorkspace(resolvedProjectRoot) &&
|
|
236
|
+
hasExpoConfig &&
|
|
237
|
+
hasSwiftSources
|
|
238
|
+
) {
|
|
239
|
+
resolvedProjectRoot = await prepareNativeAppRoot(appRoot, undefined, opts.iosTarget)
|
|
240
|
+
providers = (
|
|
241
|
+
await discoverTurboProviders(appRoot, resolvedProjectRoot, opts.iosTarget)
|
|
242
|
+
).filter((provider) => readPackageMeta(provider.root)?.name === opts.packageName)
|
|
243
|
+
if (providers.length === 0) return null
|
|
244
|
+
}
|
|
213
245
|
const reactNativeRoot = resolveReactNativeRoot(appRoot)
|
|
214
246
|
const { input, collection } = await prepareTurboCompileInput({
|
|
215
247
|
appRoot,
|
|
216
248
|
reactNativeRoot,
|
|
217
249
|
providers,
|
|
218
250
|
moduleRoot,
|
|
219
|
-
projectRoot,
|
|
251
|
+
projectRoot: resolvedProjectRoot,
|
|
220
252
|
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
221
253
|
iosDeploymentTargetFallback: reactNativeCoreFloor(reactNativeRoot),
|
|
222
254
|
})
|
|
@@ -314,6 +346,7 @@ export async function buildNativePackageSlice(opts: {
|
|
|
314
346
|
if (!matchedRoot) return null
|
|
315
347
|
const configuration: NitroBuildConfiguration = opts.configuration ?? 'Release'
|
|
316
348
|
const reactNativeRoot = resolveReactNativeRoot(appRoot)
|
|
349
|
+
const iosDeploymentTargetFallback = reactNativeCoreFloor(reactNativeRoot)
|
|
317
350
|
const { input, collection, packagePath } = await prepareNitroCompileInput({
|
|
318
351
|
appRoot,
|
|
319
352
|
packageRoots: [matchedRoot],
|
|
@@ -322,9 +355,8 @@ export async function buildNativePackageSlice(opts: {
|
|
|
322
355
|
projectRoot,
|
|
323
356
|
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
324
357
|
configuration,
|
|
325
|
-
iosDeploymentTargetFallback
|
|
358
|
+
iosDeploymentTargetFallback,
|
|
326
359
|
})
|
|
327
|
-
const workRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-nitro-slice-'))
|
|
328
360
|
try {
|
|
329
361
|
const providerInfo = collection.providers[0]
|
|
330
362
|
if (!providerInfo) return null
|
|
@@ -340,63 +372,91 @@ export async function buildNativePackageSlice(opts: {
|
|
|
340
372
|
const cached = loadNativePackageSlice(providerInfo.name, key, { remote: false })
|
|
341
373
|
if (cached) return cached
|
|
342
374
|
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
buildRoot: compileRoot,
|
|
354
|
-
intermediates: true,
|
|
355
|
-
},
|
|
356
|
-
)
|
|
357
|
-
const packageSwift = input.files['Package.swift'] ?? ''
|
|
358
|
-
const coreTargets = new Set([
|
|
359
|
-
'NitroCore',
|
|
360
|
-
'JsiBridge',
|
|
361
|
-
'NitroModules',
|
|
362
|
-
NITRO_VIEWS_TARGET,
|
|
363
|
-
...Object.keys(input.libraries ?? {}),
|
|
364
|
-
])
|
|
365
|
-
const onlyTargets = new Set(
|
|
366
|
-
swiftManifestTargets(packageSwift)
|
|
367
|
-
.filter((target) => !target.executable && !coreTargets.has(target.name))
|
|
368
|
-
.map((target) => target.name),
|
|
369
|
-
)
|
|
370
|
-
const packed = packCompiledTargetsToSliceDir({
|
|
371
|
-
buildRoot: compileRoot,
|
|
372
|
-
packageSwift,
|
|
373
|
-
toolchainBin: toolchain.toolchainBin,
|
|
374
|
-
stagingDir,
|
|
375
|
-
onlyTargets,
|
|
375
|
+
// share compiled NitroCore/JsiBridge/NitroModules intermediates across slices
|
|
376
|
+
const nitroCoreKey = nativeEntryKey({
|
|
377
|
+
kind: 'nitro-slice-core',
|
|
378
|
+
compiler: compilerSourceDigest,
|
|
379
|
+
'swift-pin': JSON.stringify(swiftNativePin()),
|
|
380
|
+
'nitro-modules': collection.nitro.version,
|
|
381
|
+
'react-native': collection.reactNative.version,
|
|
382
|
+
iosDeploymentTargetFallback,
|
|
383
|
+
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
384
|
+
configuration,
|
|
376
385
|
})
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
386
|
+
const compileRoot = path.join(cacheDir(), 'nitro-slice-build', nitroCoreKey)
|
|
387
|
+
return await withSwiftRootLock(`${compileRoot}.slice-lock`, async () => {
|
|
388
|
+
const lockedCached = loadNativePackageSlice(providerInfo.name, key, {
|
|
389
|
+
remote: false,
|
|
390
|
+
})
|
|
391
|
+
if (lockedCached) return lockedCached
|
|
392
|
+
|
|
393
|
+
fs.mkdirSync(compileRoot, { recursive: true })
|
|
394
|
+
const sourcesDir = path.join(compileRoot, 'Sources')
|
|
395
|
+
if (fs.existsSync(sourcesDir)) {
|
|
396
|
+
for (const entry of fs.readdirSync(sourcesDir)) {
|
|
397
|
+
if (entry.startsWith('NitroPackage_')) {
|
|
398
|
+
fs.rmSync(path.join(sourcesDir, entry), { recursive: true, force: true })
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
const stagingDir = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-nitro-slice-'))
|
|
403
|
+
try {
|
|
404
|
+
const toolchain = swiftModuleToolchain(moduleRoot)
|
|
405
|
+
await compileSwiftProjectUnit(
|
|
406
|
+
{ ...input, optimize: false },
|
|
407
|
+
{
|
|
408
|
+
...toolchain,
|
|
409
|
+
moduleRoot,
|
|
410
|
+
buildRoot: compileRoot,
|
|
411
|
+
intermediates: true,
|
|
412
|
+
},
|
|
413
|
+
)
|
|
414
|
+
const packageSwift = input.files['Package.swift'] ?? ''
|
|
415
|
+
const coreTargets = new Set([
|
|
416
|
+
'NitroCore',
|
|
417
|
+
'JsiBridge',
|
|
418
|
+
'NitroModules',
|
|
419
|
+
NITRO_VIEWS_TARGET,
|
|
420
|
+
...Object.keys(input.libraries ?? {}),
|
|
421
|
+
])
|
|
422
|
+
const onlyTargets = new Set(
|
|
423
|
+
swiftManifestTargets(packageSwift)
|
|
424
|
+
.filter((target) => !target.executable && !coreTargets.has(target.name))
|
|
425
|
+
.map((target) => target.name),
|
|
426
|
+
)
|
|
427
|
+
const packed = packCompiledTargetsToSliceDir({
|
|
428
|
+
buildRoot: compileRoot,
|
|
429
|
+
packageSwift,
|
|
430
|
+
toolchainBin: toolchain.toolchainBin,
|
|
431
|
+
stagingDir,
|
|
432
|
+
onlyTargets,
|
|
433
|
+
})
|
|
434
|
+
const targetNames = packed.targets.map((target) => target.name)
|
|
435
|
+
const manifest: NativePackageSliceManifest = {
|
|
436
|
+
schema: 1,
|
|
437
|
+
kind: 'nitro',
|
|
438
|
+
packageName: providerInfo.name,
|
|
439
|
+
packageVersion: providerInfo.version,
|
|
440
|
+
key,
|
|
441
|
+
runtimePin: swiftNativePin(),
|
|
442
|
+
targets: packed.targets,
|
|
443
|
+
nitro: {
|
|
444
|
+
targetNames,
|
|
445
|
+
hybridObjects: providerInfo.hybridObjects,
|
|
446
|
+
registrations: collection.registrations,
|
|
447
|
+
},
|
|
448
|
+
}
|
|
449
|
+
return finalizeSliceEntry({
|
|
450
|
+
manifest,
|
|
451
|
+
inputs,
|
|
452
|
+
assetFiles: packed.files,
|
|
453
|
+
stagingDir,
|
|
454
|
+
})
|
|
455
|
+
} finally {
|
|
456
|
+
fs.rmSync(stagingDir, { recursive: true, force: true })
|
|
457
|
+
}
|
|
397
458
|
})
|
|
398
459
|
} finally {
|
|
399
460
|
fs.rmSync(packagePath, { recursive: true, force: true })
|
|
400
|
-
fs.rmSync(workRoot, { recursive: true, force: true })
|
|
401
461
|
}
|
|
402
462
|
}
|