peachsim 0.1.2257 → 0.1.2259
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/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 +32 -17
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +10 -6
- 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 +32 -17
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- 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 +3 -3
- 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 +3 -3
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +1 -1
- 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 +34 -19
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- 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 +7 -3
- package/dist-lib/vite.cjs +3 -3
- 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/java-platform/licenses/openjdk.txt +8 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/src/expo-native-workspace.ts +4 -1
- package/src/native-package-slice-build.ts +386 -0
- package/src/native-package-slice.ts +36 -11
- package/src/nitro-compile.ts +37 -13
- package/src/swift-distribution.ts +7 -2
- package/src/turbo-compile.ts +22 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2259 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2259 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2259 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2259 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2259 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -28245,7 +28245,11 @@ async function swiftDistributionRoot(signal) {
|
|
|
28245
28245
|
const endpoint = swiftEndpoint();
|
|
28246
28246
|
const lock = swiftNativePin().distribution;
|
|
28247
28247
|
await installSwiftToolchain(lock.release, lock, signal);
|
|
28248
|
-
const dir = import_node_path36.default.join(
|
|
28248
|
+
const dir = import_node_path36.default.join(
|
|
28249
|
+
swiftCacheDir(),
|
|
28250
|
+
"swift-distributions",
|
|
28251
|
+
`${lock.id}-${host2}-${lock.hosts[host2].sha256}`
|
|
28252
|
+
);
|
|
28249
28253
|
let pending = installs.get(dir);
|
|
28250
28254
|
if (pending?.controller.signal.aborted) pending = void 0;
|
|
28251
28255
|
if (!pending) {
|
|
@@ -32410,7 +32414,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
|
|
|
32410
32414
|
return hash.digest("hex");
|
|
32411
32415
|
}
|
|
32412
32416
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
32413
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
32417
|
+
var STANDIN_SOURCE_DIGEST = true ? "6a3e08e780371135330124e5f94797a59a8e181f890d0c3dab1f0fd155525e35" : standinSourceDigest();
|
|
32414
32418
|
|
|
32415
32419
|
// src/swift-standins.ts
|
|
32416
32420
|
var import_node_child_process31 = require("node:child_process");
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2259 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -3097,7 +3097,7 @@ var STANDIN_SOURCE_DIGEST;
|
|
|
3097
3097
|
var init_swift_standin_digest = __esm({
|
|
3098
3098
|
"src/swift-standin-digest.ts"() {
|
|
3099
3099
|
"use strict";
|
|
3100
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
3100
|
+
STANDIN_SOURCE_DIGEST = true ? "6a3e08e780371135330124e5f94797a59a8e181f890d0c3dab1f0fd155525e35" : standinSourceDigest();
|
|
3101
3101
|
}
|
|
3102
3102
|
});
|
|
3103
3103
|
|
|
@@ -5274,7 +5274,7 @@ var init_react_native_core = __esm({
|
|
|
5274
5274
|
init_swift_distribution();
|
|
5275
5275
|
init_swift_package();
|
|
5276
5276
|
init_swiftContract();
|
|
5277
|
-
recipe = true ? "
|
|
5277
|
+
recipe = true ? "6b67c6a71d4bea968d2b12089709b9f559c04bdd32fd1b13d97069d439205d8e" : reactNativeCoreDigest2(__sootsim_import_meta_dirname);
|
|
5278
5278
|
}
|
|
5279
5279
|
});
|
|
5280
5280
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2259 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -290,12 +290,6 @@ export declare class SootSimNode {
|
|
|
290
290
|
frame: SootSimLayout;
|
|
291
291
|
} | null;
|
|
292
292
|
_maintainVisibleContentPositionAnchorFromMutation: boolean;
|
|
293
|
-
_contentChildrenExtent: {
|
|
294
|
-
treeVersion: number;
|
|
295
|
-
layoutResultVersion: number;
|
|
296
|
-
width: number;
|
|
297
|
-
height: number;
|
|
298
|
-
} | null;
|
|
299
293
|
__scroll?: SootSimScrollRuntime;
|
|
300
294
|
private _zoomScaleValue?;
|
|
301
295
|
private _refreshHoldingValue?;
|
|
@@ -35,6 +35,14 @@ Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
|
|
35
35
|
Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
|
36
36
|
Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
|
37
37
|
|
|
38
|
+
The overlay's java/util/concurrent executor, future, latch, blocking queue and thread pool
|
|
39
|
+
files, and kotlin/Sources/java/lang/Thread.kt in the Kotlin SDK, port Android's
|
|
40
|
+
java/util/concurrent and java/lang/Thread.java (ojluni, android17-release). The
|
|
41
|
+
java.util.concurrent originals carry this notice: Written by Doug Lea with assistance from
|
|
42
|
+
members of JCP JSR-166 Expert Group and released to the public domain, as explained at
|
|
43
|
+
http://creativecommons.org/publicdomain/zero/1.0/
|
|
44
|
+
Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
|
|
45
|
+
|
|
38
46
|
This code is free software; you can redistribute it and/or modify it
|
|
39
47
|
under the terms of the GNU General Public License version 2 only, as
|
|
40
48
|
published by the Free Software Foundation. Oracle designates these
|
package/kotlin/sdk.tar.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -660,7 +660,10 @@ async function copyInstalledWorkspace(
|
|
|
660
660
|
return []
|
|
661
661
|
}
|
|
662
662
|
fs.mkdirSync(path.join(destination, relative))
|
|
663
|
-
return fs
|
|
663
|
+
return fs
|
|
664
|
+
.readdirSync(source)
|
|
665
|
+
.filter((name) => name !== '.cache')
|
|
666
|
+
.map((name) => path.join(relative, name))
|
|
664
667
|
})
|
|
665
668
|
const clone = async (): Promise<void> => {
|
|
666
669
|
const relative = entries.pop()
|
|
@@ -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
|
+
}
|
|
@@ -238,25 +238,50 @@ export function packCompiledTargetsToSliceDir(opts: {
|
|
|
238
238
|
(opts.excludeExecutable === false || !target.executable) &&
|
|
239
239
|
(!opts.onlyTargets || opts.onlyTargets.has(target.name)),
|
|
240
240
|
)
|
|
241
|
+
const emittedFile = path.join(opts.buildRoot, 'Package.swift')
|
|
242
|
+
const emittedTargets = fs.existsSync(emittedFile)
|
|
243
|
+
? swiftManifestTargets(fs.readFileSync(emittedFile, 'utf8')).filter(
|
|
244
|
+
(product) => opts.excludeExecutable === false || !product.executable,
|
|
245
|
+
)
|
|
246
|
+
: null
|
|
241
247
|
const membersRoot = path.join(opts.stagingDir, '.members')
|
|
242
248
|
fs.mkdirSync(membersRoot, { recursive: true })
|
|
243
249
|
const targets: NativePackageSliceTarget[] = []
|
|
244
250
|
const files: string[] = []
|
|
245
251
|
try {
|
|
246
252
|
for (const target of manifestTargets) {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
253
|
+
const productNames = emittedTargets
|
|
254
|
+
? [
|
|
255
|
+
...new Set(
|
|
256
|
+
emittedTargets
|
|
257
|
+
.filter(
|
|
258
|
+
(product) =>
|
|
259
|
+
product.name === target.name || product.path === target.path,
|
|
260
|
+
)
|
|
261
|
+
.map((product) => product.name),
|
|
262
|
+
),
|
|
263
|
+
]
|
|
264
|
+
: [target.name]
|
|
265
|
+
if (productNames.length === 0) productNames.push(target.name)
|
|
266
|
+
const objectEntries: { productName: string; file: string }[] = []
|
|
267
|
+
for (const productName of productNames) {
|
|
268
|
+
const targetBuild = path.join(products, `${productName}.build`)
|
|
269
|
+
if (!fs.existsSync(targetBuild)) continue
|
|
270
|
+
for (const file of fs
|
|
271
|
+
.readdirSync(targetBuild, { recursive: true, encoding: 'utf8' })
|
|
272
|
+
.filter((entry) => entry.endsWith('.o'))
|
|
273
|
+
.sort()) {
|
|
274
|
+
objectEntries.push({ productName, file: path.join(targetBuild, file) })
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (objectEntries.length === 0) continue
|
|
256
278
|
const targetMembers = path.join(membersRoot, target.name)
|
|
257
279
|
fs.mkdirSync(targetMembers, { recursive: true })
|
|
258
|
-
const stripped =
|
|
259
|
-
const out = path.join(
|
|
280
|
+
const stripped = objectEntries.map(({ productName, file }, index) => {
|
|
281
|
+
const out = path.join(
|
|
282
|
+
targetMembers,
|
|
283
|
+
`${index}-${productName}-${path.basename(file)}`,
|
|
284
|
+
)
|
|
260
285
|
execFileSync(path.join(opts.toolchainBin, 'llvm-objcopy'), [
|
|
261
286
|
'--strip-debug',
|
|
262
287
|
file,
|