peachsim 0.1.2255 → 0.1.2258
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/bridge-flow-runner.ts +41 -0
- package/cli/commands/control.ts +8 -2
- package/cli/commands/flow.ts +9 -0
- package/cli/commands/swift.ts +5 -0
- package/cli/current-sim.ts +23 -15
- package/cli/outbound-endpoints.ts +0 -2
- package/cli/secure-file.ts +8 -2
- 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 +418 -143
- 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 +16 -12
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +359 -116
- 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 +939 -595
- package/dist-lib/host/fetch-proxy-handler.cjs +3607 -1627
- 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 +12611 -11232
- 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 +5 -4
- 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 +9700 -8326
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- 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 +606 -228
- 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 +1192 -797
- package/dist-lib/swift-compile.cjs +334 -99
- package/dist-lib/swift-compile.mjs +334 -99
- 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 +340 -101
- package/dist-lib/vite.cjs +4729 -2900
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +0 -6
- package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/appLifecycleBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/transitions/screen-transition-math.d.ts +6 -0
- package/java-platform/licenses/android.txt +183 -0
- package/java-platform/licenses/arm-optimized-routines.txt +256 -0
- package/java-platform/licenses/fdlibm.txt +72 -0
- package/java-platform/licenses/icu.txt +50 -0
- package/java-platform/licenses/openjdk.txt +395 -0
- package/java-platform/licenses/teavm.txt +182 -0
- package/java-platform/licenses/threeten-backport.txt +29 -0
- package/kotlin/README.md +1 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -1
- package/runtime-companion.json +1 -1
- package/src/expo-autolinking.ts +47 -4
- package/src/expo-native-workspace.ts +4 -1
- package/src/expo-pod-prebuilt.ts +96 -9
- package/src/expo-swift-host.ts +29 -9
- package/src/kotlin-host.ts +3 -2
- package/src/kotlinSdkContract.ts +1 -0
- package/src/native-package-slice-build.ts +386 -0
- package/src/native-package-slice.ts +835 -0
- package/src/native-prebuilt.ts +4 -0
- package/src/native-seam-manifest.ts +0 -8
- package/src/nitro-adapter.lock.json +255 -255
- package/src/nitro-compile.ts +37 -13
- package/src/nitro-superset.lock.json +4 -4
- package/src/swift-distribution.lock.json +11 -11
- package/src/swift-distribution.ts +7 -2
- package/src/swift-link-roots.ts +23 -22
- package/src/swift-wasm-prune.ts +436 -105
- package/src/turbo-compile.ts +22 -7
- package/src/turbo-runtime.lock.json +23 -23
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
// universal native package slice builder supporting Expo Swift, TurboModule,
|
|
2
|
+
// and Nitro packages under the shared `native/pkg/<name>/<key>/` layout.
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import { createRequire } from 'node:module'
|
|
5
|
+
import os from 'node:os'
|
|
6
|
+
import path from 'node:path'
|
|
7
|
+
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
8
|
+
import { expoPodInputs, expoPodPackages } from './expo-pod-prebuilt'
|
|
9
|
+
import { isRecord } from './is-record'
|
|
10
|
+
import {
|
|
11
|
+
buildExpoSwiftPackageSlice,
|
|
12
|
+
finalizeSliceEntry,
|
|
13
|
+
loadNativePackageSlice,
|
|
14
|
+
packCompiledTargetsToSliceDir,
|
|
15
|
+
type LoadedNativePackageSlice,
|
|
16
|
+
type NativePackageSliceKind,
|
|
17
|
+
type NativePackageSliceManifest,
|
|
18
|
+
} from './native-package-slice'
|
|
19
|
+
import { nativeEntryKey } from './native-prebuilt'
|
|
20
|
+
import { selectCompiledNitroProviders } from './nitro-bundle'
|
|
21
|
+
import { prepareNitroCompileInput } from './nitro-compile'
|
|
22
|
+
import { NITRO_VIEWS_TARGET } from './nitro-source'
|
|
23
|
+
import { packageTreeDigest } from './package-tree-digest'
|
|
24
|
+
import { reactNativeCoreFloor } from './react-native-core'
|
|
25
|
+
import { compilerSourceDigest, compileSwiftProjectUnit } from './swift-compile'
|
|
26
|
+
import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distribution'
|
|
27
|
+
import { swiftNativePin } from './swift-native-pin'
|
|
28
|
+
import { swiftManifestTargets } from './swift-package'
|
|
29
|
+
import { prepareTurboCompileInput } from './turbo-compile'
|
|
30
|
+
import { discoverTurboProviders, TURBO_CORE_TARGET } from './turbo-source'
|
|
31
|
+
import type { NitroBuildConfiguration } from './nitroContract'
|
|
32
|
+
|
|
33
|
+
export interface DetectedNativePackage {
|
|
34
|
+
name: string
|
|
35
|
+
version: string
|
|
36
|
+
root: string
|
|
37
|
+
kind: NativePackageSliceKind
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function readPackageMeta(root: string): { name: string; version: string } | null {
|
|
41
|
+
const manifestPath = path.join(root, 'package.json')
|
|
42
|
+
if (!fs.existsSync(manifestPath)) return null
|
|
43
|
+
const parsed: unknown = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
44
|
+
if (
|
|
45
|
+
!isRecord(parsed) ||
|
|
46
|
+
typeof parsed.name !== 'string' ||
|
|
47
|
+
parsed.name.length === 0 ||
|
|
48
|
+
typeof parsed.version !== 'string' ||
|
|
49
|
+
parsed.version.length === 0
|
|
50
|
+
) {
|
|
51
|
+
return null
|
|
52
|
+
}
|
|
53
|
+
return { name: parsed.name, version: parsed.version }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function resolveReactNativeRoot(appRoot: string): string {
|
|
57
|
+
const require = createRequire(path.join(appRoot, 'package.json'))
|
|
58
|
+
return path.dirname(fs.realpathSync(require.resolve('react-native/package.json')))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** detects buildable native packages in an app across Expo Swift, Nitro, and TurboModules. */
|
|
62
|
+
export async function detectNativePackageKinds(
|
|
63
|
+
appRoot: string,
|
|
64
|
+
packageName?: string,
|
|
65
|
+
): Promise<DetectedNativePackage[]> {
|
|
66
|
+
const realRoot = fs.realpathSync(appRoot)
|
|
67
|
+
const answered = peachAnsweredNativePackages()
|
|
68
|
+
const detected: DetectedNativePackage[] = []
|
|
69
|
+
|
|
70
|
+
for (const pod of await expoPodPackages(realRoot)) {
|
|
71
|
+
detected.push({
|
|
72
|
+
name: pod.name,
|
|
73
|
+
version: pod.version,
|
|
74
|
+
root: fs.realpathSync(pod.root),
|
|
75
|
+
kind: 'expo-swift',
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const nitroNames = new Set<string>()
|
|
80
|
+
const nitroSelection = await selectCompiledNitroProviders(realRoot)
|
|
81
|
+
for (const provider of nitroSelection?.providers ?? []) {
|
|
82
|
+
const root = fs.realpathSync(provider.root)
|
|
83
|
+
const meta = readPackageMeta(root)
|
|
84
|
+
const version = meta?.version ?? '0.0.0'
|
|
85
|
+
nitroNames.add(provider.name)
|
|
86
|
+
detected.push({
|
|
87
|
+
name: provider.name,
|
|
88
|
+
version,
|
|
89
|
+
root,
|
|
90
|
+
kind: 'nitro',
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const seenTurbo = new Set<string>()
|
|
95
|
+
for (const provider of await discoverTurboProviders(realRoot)) {
|
|
96
|
+
const root = fs.realpathSync(provider.root)
|
|
97
|
+
const meta = readPackageMeta(root)
|
|
98
|
+
if (!meta || seenTurbo.has(meta.name)) continue
|
|
99
|
+
seenTurbo.add(meta.name)
|
|
100
|
+
if (answered.has(meta.name) || nitroNames.has(meta.name)) continue
|
|
101
|
+
detected.push({
|
|
102
|
+
name: meta.name,
|
|
103
|
+
version: meta.version,
|
|
104
|
+
root,
|
|
105
|
+
kind: 'turbomodule',
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return detected
|
|
110
|
+
.filter((entry) => packageName === undefined || entry.name === packageName)
|
|
111
|
+
.sort((left, right) => {
|
|
112
|
+
const byName = left.name.localeCompare(right.name)
|
|
113
|
+
return byName !== 0 ? byName : left.kind.localeCompare(right.kind)
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** deterministic cache inputs identifying a compiled TurboModule package slice. */
|
|
118
|
+
export async function turboPackageSliceInputs(opts: {
|
|
119
|
+
packageName: string
|
|
120
|
+
packageVersion: string
|
|
121
|
+
packageRoot: string
|
|
122
|
+
reactNativeVersion: string
|
|
123
|
+
coreMode: string
|
|
124
|
+
}): Promise<Record<string, string>> {
|
|
125
|
+
return {
|
|
126
|
+
'slice-kind': 'turbomodule',
|
|
127
|
+
compiler: compilerSourceDigest,
|
|
128
|
+
'swift-pin': JSON.stringify(swiftNativePin()),
|
|
129
|
+
name: opts.packageName,
|
|
130
|
+
version: opts.packageVersion,
|
|
131
|
+
'react-native': opts.reactNativeVersion,
|
|
132
|
+
'core-mode': opts.coreMode,
|
|
133
|
+
tree: await packageTreeDigest(opts.packageRoot),
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** deterministic cache inputs identifying a compiled Nitro package slice. */
|
|
138
|
+
export async function nitroPackageSliceInputs(opts: {
|
|
139
|
+
packageName: string
|
|
140
|
+
packageVersion: string
|
|
141
|
+
packageRoot: string
|
|
142
|
+
nitroVersion: string
|
|
143
|
+
reactNativeVersion: string
|
|
144
|
+
configuration: NitroBuildConfiguration
|
|
145
|
+
}): Promise<Record<string, string>> {
|
|
146
|
+
return {
|
|
147
|
+
'slice-kind': 'nitro',
|
|
148
|
+
compiler: compilerSourceDigest,
|
|
149
|
+
'swift-pin': JSON.stringify(swiftNativePin()),
|
|
150
|
+
name: opts.packageName,
|
|
151
|
+
version: opts.packageVersion,
|
|
152
|
+
'nitro-modules': opts.nitroVersion,
|
|
153
|
+
'react-native': opts.reactNativeVersion,
|
|
154
|
+
configuration: opts.configuration,
|
|
155
|
+
tree: await packageTreeDigest(opts.packageRoot),
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* compiles a single installed Expo Swift, TurboModule, or Nitro package into
|
|
161
|
+
* a reusable `native/pkg/<name>/<key>/` static slice.
|
|
162
|
+
*/
|
|
163
|
+
export async function buildNativePackageSlice(opts: {
|
|
164
|
+
appRoot: string
|
|
165
|
+
packageName: string
|
|
166
|
+
kind?: NativePackageSliceKind
|
|
167
|
+
moduleRoot?: string
|
|
168
|
+
projectRoot?: string
|
|
169
|
+
iosTarget?: string
|
|
170
|
+
configuration?: NitroBuildConfiguration
|
|
171
|
+
}): Promise<LoadedNativePackageSlice | null> {
|
|
172
|
+
const appRoot = fs.realpathSync(opts.appRoot)
|
|
173
|
+
const projectRoot = opts.projectRoot ? fs.realpathSync(opts.projectRoot) : appRoot
|
|
174
|
+
const moduleRoot = opts.moduleRoot ?? (await swiftDistributionRoot())
|
|
175
|
+
const kind =
|
|
176
|
+
opts.kind ?? (await detectNativePackageKinds(appRoot, opts.packageName))[0]?.kind
|
|
177
|
+
if (!kind) return null
|
|
178
|
+
|
|
179
|
+
if (kind === 'expo-swift') {
|
|
180
|
+
const pod = (await expoPodPackages(appRoot)).find(
|
|
181
|
+
(candidate) => candidate.name === opts.packageName,
|
|
182
|
+
)
|
|
183
|
+
if (!pod) return null
|
|
184
|
+
return buildExpoSwiftPackageSlice({
|
|
185
|
+
appRoot,
|
|
186
|
+
pod,
|
|
187
|
+
podInputs: await expoPodInputs(pod),
|
|
188
|
+
moduleRoot,
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (kind === 'turbomodule') {
|
|
193
|
+
const providers = (
|
|
194
|
+
await discoverTurboProviders(appRoot, projectRoot, opts.iosTarget)
|
|
195
|
+
).filter((provider) => readPackageMeta(provider.root)?.name === opts.packageName)
|
|
196
|
+
if (providers.length === 0) return null
|
|
197
|
+
const reactNativeRoot = resolveReactNativeRoot(appRoot)
|
|
198
|
+
const { input, collection } = await prepareTurboCompileInput({
|
|
199
|
+
appRoot,
|
|
200
|
+
reactNativeRoot,
|
|
201
|
+
providers,
|
|
202
|
+
moduleRoot,
|
|
203
|
+
projectRoot,
|
|
204
|
+
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
205
|
+
iosDeploymentTargetFallback: reactNativeCoreFloor(reactNativeRoot),
|
|
206
|
+
})
|
|
207
|
+
const providerInfo =
|
|
208
|
+
collection.providers.find((provider) => provider.name === opts.packageName) ??
|
|
209
|
+
collection.providers[0]
|
|
210
|
+
if (!providerInfo) return null
|
|
211
|
+
|
|
212
|
+
const inputs = await turboPackageSliceInputs({
|
|
213
|
+
packageName: providerInfo.name,
|
|
214
|
+
packageVersion: providerInfo.version,
|
|
215
|
+
packageRoot: providerInfo.root,
|
|
216
|
+
reactNativeVersion: collection.reactNative.version,
|
|
217
|
+
coreMode: collection.coreMode,
|
|
218
|
+
})
|
|
219
|
+
const key = nativeEntryKey(inputs)
|
|
220
|
+
const cached = loadNativePackageSlice(providerInfo.name, key, { remote: false })
|
|
221
|
+
if (cached) return cached
|
|
222
|
+
|
|
223
|
+
const workRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-turbo-slice-'))
|
|
224
|
+
const compileRoot = path.join(workRoot, 'compile')
|
|
225
|
+
const stagingDir = path.join(workRoot, 'staging')
|
|
226
|
+
fs.mkdirSync(compileRoot, { recursive: true })
|
|
227
|
+
fs.mkdirSync(stagingDir, { recursive: true })
|
|
228
|
+
try {
|
|
229
|
+
const toolchain = swiftModuleToolchain(moduleRoot)
|
|
230
|
+
await compileSwiftProjectUnit(
|
|
231
|
+
{ ...input, optimize: false },
|
|
232
|
+
{
|
|
233
|
+
...toolchain,
|
|
234
|
+
moduleRoot,
|
|
235
|
+
buildRoot: compileRoot,
|
|
236
|
+
intermediates: true,
|
|
237
|
+
},
|
|
238
|
+
)
|
|
239
|
+
const packageSwift = input.files['Package.swift'] ?? ''
|
|
240
|
+
const coreTargets = new Set([
|
|
241
|
+
TURBO_CORE_TARGET,
|
|
242
|
+
'TurboFmt',
|
|
243
|
+
...collection.rendererSwiftTargets,
|
|
244
|
+
...Object.keys(input.libraries ?? {}),
|
|
245
|
+
])
|
|
246
|
+
const onlyTargets = new Set(
|
|
247
|
+
swiftManifestTargets(packageSwift)
|
|
248
|
+
.filter((target) => !target.executable && !coreTargets.has(target.name))
|
|
249
|
+
.map((target) => target.name),
|
|
250
|
+
)
|
|
251
|
+
const packed = packCompiledTargetsToSliceDir({
|
|
252
|
+
buildRoot: compileRoot,
|
|
253
|
+
packageSwift,
|
|
254
|
+
toolchainBin: toolchain.toolchainBin,
|
|
255
|
+
stagingDir,
|
|
256
|
+
onlyTargets,
|
|
257
|
+
})
|
|
258
|
+
const targetNames = packed.targets.map((target) => target.name)
|
|
259
|
+
const headerFiles: Record<string, string> = {}
|
|
260
|
+
for (const [file, source] of Object.entries(collection.files)) {
|
|
261
|
+
if (
|
|
262
|
+
/\.(?:h|hpp)$/.test(file) &&
|
|
263
|
+
targetNames.some((targetName) => file.startsWith(`Sources/${targetName}/`))
|
|
264
|
+
) {
|
|
265
|
+
headerFiles[file] = source
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const manifest: NativePackageSliceManifest = {
|
|
269
|
+
schema: 1,
|
|
270
|
+
kind: 'turbomodule',
|
|
271
|
+
packageName: providerInfo.name,
|
|
272
|
+
packageVersion: providerInfo.version,
|
|
273
|
+
key,
|
|
274
|
+
runtimePin: swiftNativePin(),
|
|
275
|
+
targets: packed.targets,
|
|
276
|
+
turbo: {
|
|
277
|
+
coreMode: collection.coreMode,
|
|
278
|
+
targetNames,
|
|
279
|
+
headerFiles,
|
|
280
|
+
},
|
|
281
|
+
}
|
|
282
|
+
return finalizeSliceEntry({
|
|
283
|
+
manifest,
|
|
284
|
+
inputs,
|
|
285
|
+
assetFiles: packed.files,
|
|
286
|
+
stagingDir,
|
|
287
|
+
})
|
|
288
|
+
} finally {
|
|
289
|
+
fs.rmSync(workRoot, { recursive: true, force: true })
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const selection = await selectCompiledNitroProviders(appRoot)
|
|
294
|
+
if (!selection) return null
|
|
295
|
+
const matchedRoot = selection.packageRoots.find(
|
|
296
|
+
(root) => readPackageMeta(root)?.name === opts.packageName,
|
|
297
|
+
)
|
|
298
|
+
if (!matchedRoot) return null
|
|
299
|
+
const configuration: NitroBuildConfiguration = opts.configuration ?? 'Release'
|
|
300
|
+
const reactNativeRoot = resolveReactNativeRoot(appRoot)
|
|
301
|
+
const { input, collection, packagePath } = await prepareNitroCompileInput({
|
|
302
|
+
appRoot,
|
|
303
|
+
packageRoots: [matchedRoot],
|
|
304
|
+
answers: selection.answers,
|
|
305
|
+
moduleRoot,
|
|
306
|
+
projectRoot,
|
|
307
|
+
...(opts.iosTarget ? { iosTarget: opts.iosTarget } : {}),
|
|
308
|
+
configuration,
|
|
309
|
+
iosDeploymentTargetFallback: reactNativeCoreFloor(reactNativeRoot),
|
|
310
|
+
})
|
|
311
|
+
const workRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-nitro-slice-'))
|
|
312
|
+
try {
|
|
313
|
+
const providerInfo = collection.providers[0]
|
|
314
|
+
if (!providerInfo) return null
|
|
315
|
+
const inputs = await nitroPackageSliceInputs({
|
|
316
|
+
packageName: providerInfo.name,
|
|
317
|
+
packageVersion: providerInfo.version,
|
|
318
|
+
packageRoot: providerInfo.root,
|
|
319
|
+
nitroVersion: collection.nitro.version,
|
|
320
|
+
reactNativeVersion: collection.reactNative.version,
|
|
321
|
+
configuration,
|
|
322
|
+
})
|
|
323
|
+
const key = nativeEntryKey(inputs)
|
|
324
|
+
const cached = loadNativePackageSlice(providerInfo.name, key, { remote: false })
|
|
325
|
+
if (cached) return cached
|
|
326
|
+
|
|
327
|
+
const compileRoot = path.join(workRoot, 'compile')
|
|
328
|
+
const stagingDir = path.join(workRoot, 'staging')
|
|
329
|
+
fs.mkdirSync(compileRoot, { recursive: true })
|
|
330
|
+
fs.mkdirSync(stagingDir, { recursive: true })
|
|
331
|
+
const toolchain = swiftModuleToolchain(moduleRoot)
|
|
332
|
+
await compileSwiftProjectUnit(
|
|
333
|
+
{ ...input, optimize: false },
|
|
334
|
+
{
|
|
335
|
+
...toolchain,
|
|
336
|
+
moduleRoot,
|
|
337
|
+
buildRoot: compileRoot,
|
|
338
|
+
intermediates: true,
|
|
339
|
+
},
|
|
340
|
+
)
|
|
341
|
+
const packageSwift = input.files['Package.swift'] ?? ''
|
|
342
|
+
const coreTargets = new Set([
|
|
343
|
+
'NitroCore',
|
|
344
|
+
'JsiBridge',
|
|
345
|
+
'NitroModules',
|
|
346
|
+
NITRO_VIEWS_TARGET,
|
|
347
|
+
...Object.keys(input.libraries ?? {}),
|
|
348
|
+
])
|
|
349
|
+
const onlyTargets = new Set(
|
|
350
|
+
swiftManifestTargets(packageSwift)
|
|
351
|
+
.filter((target) => !target.executable && !coreTargets.has(target.name))
|
|
352
|
+
.map((target) => target.name),
|
|
353
|
+
)
|
|
354
|
+
const packed = packCompiledTargetsToSliceDir({
|
|
355
|
+
buildRoot: compileRoot,
|
|
356
|
+
packageSwift,
|
|
357
|
+
toolchainBin: toolchain.toolchainBin,
|
|
358
|
+
stagingDir,
|
|
359
|
+
onlyTargets,
|
|
360
|
+
})
|
|
361
|
+
const targetNames = packed.targets.map((target) => target.name)
|
|
362
|
+
const manifest: NativePackageSliceManifest = {
|
|
363
|
+
schema: 1,
|
|
364
|
+
kind: 'nitro',
|
|
365
|
+
packageName: providerInfo.name,
|
|
366
|
+
packageVersion: providerInfo.version,
|
|
367
|
+
key,
|
|
368
|
+
runtimePin: swiftNativePin(),
|
|
369
|
+
targets: packed.targets,
|
|
370
|
+
nitro: {
|
|
371
|
+
targetNames,
|
|
372
|
+
hybridObjects: providerInfo.hybridObjects,
|
|
373
|
+
registrations: collection.registrations,
|
|
374
|
+
},
|
|
375
|
+
}
|
|
376
|
+
return finalizeSliceEntry({
|
|
377
|
+
manifest,
|
|
378
|
+
inputs,
|
|
379
|
+
assetFiles: packed.files,
|
|
380
|
+
stagingDir,
|
|
381
|
+
})
|
|
382
|
+
} finally {
|
|
383
|
+
fs.rmSync(packagePath, { recursive: true, force: true })
|
|
384
|
+
fs.rmSync(workRoot, { recursive: true, force: true })
|
|
385
|
+
}
|
|
386
|
+
}
|