peachsim 0.1.1728 → 0.1.1738
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/coverage-swift.ts +112 -4
- package/cli/commands/package.ts +11 -1
- package/cli/commands/shell-url.ts +4 -0
- package/cli/scene-video.ts +24 -7
- package/detox/index.ts +9 -1
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +5 -2
- package/dist-lib/auth/shared-session.cjs +5 -2
- 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 +3592 -1918
- 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 +13 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +1329 -1022
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +2 -2
- package/dist-lib/home-paths.cjs +7 -2
- package/dist-lib/host/bridge-host.cjs +3773 -2149
- package/dist-lib/host/fetch-proxy-handler.cjs +16 -5
- 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 +97 -68
- 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 +209 -32
- package/dist-lib/menu.cjs +7 -1
- package/dist-lib/menu.mjs +7 -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 +93 -65
- package/dist-lib/native-app-identity-project.cjs +37 -31
- package/dist-lib/native-app-identity-project.mjs +37 -31
- 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/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +5 -2
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +23 -23
- package/dist-lib/public-origins-lib.json +79 -53
- package/dist-lib/react-native-host-modules.cjs +5 -2
- package/dist-lib/react-native-host-modules.mjs +5 -2
- 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 +4486 -2789
- package/dist-lib/swift-compile.cjs +53 -60
- package/dist-lib/swift-compile.mjs +52 -60
- 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 +17 -17
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +1056 -870
- package/dist-lib/vite.cjs +20 -8
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +7 -2
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +13 -1
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/README.md +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +636 -37
- package/sdk/ios/usr/include/os/signpost.h +414 -0
- package/sdk/ios/usr/include/os.modulemap +5 -0
- package/sdk/ios/wasm/include/errno.h +4 -20
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/setjmp.h +57 -0
- package/sdk/ios/wasm/include/sys/resource.h +2 -2
- package/sdk/native-hashes.json +3 -3
- package/skills/peach-debug/SKILL.md +0 -1
- package/skills/peach-perf/SKILL.md +0 -1
- package/skills/peach-setup/SKILL.md +0 -1
- package/skills/peach-test/SKILL.md +0 -1
- package/skills/peach-visual/SKILL.md +0 -1
- package/src/android-autolinking.ts +1 -0
- package/src/android-bridge-packages.ts +279 -0
- package/src/appPackageContract.ts +2 -0
- package/src/bundle-channel.mjs +20 -2
- package/src/cli-runtime.ts +9 -5
- package/src/expo-discovery-cache.ts +7 -3
- package/src/expo-kotlin-host.ts +97 -26
- package/src/expo-native-workspace.ts +135 -40
- package/src/expo-swift-host.ts +93 -20
- package/src/expo-swift-ready.ts +5 -1
- package/src/expoKotlinContract.ts +12 -2
- package/src/expoSwiftContract.ts +9 -2
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +6 -1
- package/src/host/bridge-host.ts +5 -0
- package/src/host/fetch-proxy-handler.ts +10 -0
- package/src/kotlin-host.ts +204 -30
- package/src/kotlinSdkContract.ts +2 -1
- package/src/menu.ts +7 -0
- package/src/native-prebuilt.ts +154 -0
- package/src/nitro-adapter.lock.json +251 -251
- package/src/nitro-adapter.ts +56 -50
- package/src/nitro-bundle.ts +84 -74
- package/src/nitro-compile.ts +10 -5
- package/src/nitro-dependencies.ts +43 -28
- package/src/nitro-source.ts +60 -26
- package/src/nitroAdapterContract.ts +146 -98
- package/src/nitroContract.ts +64 -21
- package/src/react-native-bridge-modules.ts +2 -0
- package/src/react-native-host-modules.ts +4 -1
- package/src/settingsContract.ts +11 -0
- package/src/storageSnapshotContract.ts +29 -81
- package/src/swift-compile.ts +49 -50
- package/src/swift-coverage/indexdump.ts +22 -6
- package/src/swift-coverage/indexing.ts +4 -4
- package/src/swift-coverage/sdk.ts +104 -20
- package/src/swift-coverage/types.ts +34 -0
- package/src/swift-coverage/xcode.ts +9 -1
- package/src/swift-distribution.lock.json +15 -12
- package/src/swift-host.ts +3 -0
- package/src/swift-standin-emit.ts +6 -1
- package/src/swift-standins.ts +172 -10
- package/src/swift-submit.ts +5 -1
- package/src/swift-toolchain.ts +16 -16
- package/src/turbo-bundle.ts +81 -0
- package/src/turbo-compile.ts +120 -0
- package/src/turbo-runtime.lock.json +69 -0
- package/src/turbo-source.ts +754 -0
- package/src/vite-plugin-one.ts +4 -3
|
@@ -198,11 +198,19 @@ export function swiftXcodeSourceInput(request: SwiftXcodeSourceInput) {
|
|
|
198
198
|
realpathSync(join(dirname(dirname(projectFile)), str(owner.projectDirPath) ?? '')),
|
|
199
199
|
join,
|
|
200
200
|
)
|
|
201
|
-
// package products are resolved from the project's linked products below
|
|
201
|
+
// package products are resolved from the project's linked products below;
|
|
202
|
+
// an embedded product (a watch app, an extension) is copied in, never imported
|
|
202
203
|
const dependencyNames = list(target.dependencies).flatMap((id) => {
|
|
203
204
|
const dependency = objects[id]
|
|
204
205
|
if (isDict(dependency) && str(dependency.productRef)) return []
|
|
205
206
|
const named = isDict(dependency) ? objects[str(dependency.target) ?? ''] : undefined
|
|
207
|
+
if (
|
|
208
|
+
isDict(named) &&
|
|
209
|
+
!/^com\.apple\.product-type\.(?:framework|library)/.test(
|
|
210
|
+
str(named.productType) ?? '',
|
|
211
|
+
)
|
|
212
|
+
)
|
|
213
|
+
return []
|
|
206
214
|
return [
|
|
207
215
|
(isDict(named) && str(named.name)) ||
|
|
208
216
|
(isDict(dependency) && str(dependency.name)) ||
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
3
|
-
"release": "swift-6.4.0-RELEASE-custom-
|
|
4
|
-
"wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-
|
|
5
|
-
"wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-
|
|
6
|
-
"wasmSdkChecksum": "
|
|
7
|
-
"source": "
|
|
2
|
+
"id": "c1636d7b2e11fc76",
|
|
3
|
+
"release": "swift-6.4.0-RELEASE-custom-81b2c791c27276bf",
|
|
4
|
+
"wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-b26c1c1d",
|
|
5
|
+
"wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-b26c1c1d.artifactbundle.tar.gz",
|
|
6
|
+
"wasmSdkChecksum": "d3bec118d62c1015e0a2b30e0f09b8fab25613d0ac98e0dee31e68c5521bc747",
|
|
7
|
+
"source": "94f583e01ad78e91cc0908a829b83ab756ac6a12",
|
|
8
8
|
"targets": [
|
|
9
9
|
"ImagePlayground",
|
|
10
10
|
"QuickLookThumbnailing",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"GeoToolbox",
|
|
16
16
|
"DataDetection",
|
|
17
17
|
"Accessibility",
|
|
18
|
+
"Accounts",
|
|
18
19
|
"Contacts",
|
|
19
20
|
"CoreML",
|
|
20
21
|
"EventKit",
|
|
@@ -154,6 +155,7 @@
|
|
|
154
155
|
"FoundationModels",
|
|
155
156
|
"CoreTransferable",
|
|
156
157
|
"AudioToolbox",
|
|
158
|
+
"MediaToolbox",
|
|
157
159
|
"CoreAudioTypes",
|
|
158
160
|
"AudioUnit",
|
|
159
161
|
"Intents",
|
|
@@ -179,6 +181,7 @@
|
|
|
179
181
|
"deviceModel": ["string"],
|
|
180
182
|
"systemName": ["string"],
|
|
181
183
|
"systemVersion": ["string"],
|
|
184
|
+
"screenMetrics": ["array"],
|
|
182
185
|
"colorScheme": ["string:light", "string:dark"],
|
|
183
186
|
"semanticColors": ["object"],
|
|
184
187
|
"imageAssets": ["object"],
|
|
@@ -203,16 +206,16 @@
|
|
|
203
206
|
},
|
|
204
207
|
"hosts": {
|
|
205
208
|
"darwin-arm64": {
|
|
206
|
-
"sha256": "
|
|
207
|
-
"size":
|
|
209
|
+
"sha256": "80c62efc0a94a3cd8e6aa69c5fc4e6af3f2ceae1287623709e28dc9ae3a0761c",
|
|
210
|
+
"size": 89408081
|
|
208
211
|
},
|
|
209
212
|
"linux-x64": {
|
|
210
|
-
"sha256": "
|
|
211
|
-
"size":
|
|
213
|
+
"sha256": "373b6d83663204d3a5e185367695b0e93e60d4d7f501277fc5644e2928039c2a",
|
|
214
|
+
"size": 92125337
|
|
212
215
|
},
|
|
213
216
|
"linux-arm64": {
|
|
214
|
-
"sha256": "
|
|
215
|
-
"size":
|
|
217
|
+
"sha256": "86297691a209a83adda674d397ec26d5284e7c283c30f60b4dcd13329ded7b94",
|
|
218
|
+
"size": 91619555
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
}
|
package/src/swift-host.ts
CHANGED
|
@@ -656,6 +656,9 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
|
|
|
656
656
|
}
|
|
657
657
|
targetAssetSymbols(app, XCODE_APP_DIR)
|
|
658
658
|
for (const framework of app.frameworks) {
|
|
659
|
+
// a framework target that only links products compiles nothing, so it has
|
|
660
|
+
// no module, directory or bundle contents for swiftpm to take as a target
|
|
661
|
+
if (framework.allSources.length === 0 && framework.resources.length === 0) continue
|
|
659
662
|
const dir = path.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName)
|
|
660
663
|
resourceBundles.push({
|
|
661
664
|
target: framework.moduleName,
|
|
@@ -72,6 +72,8 @@ export type StandinOptions = {
|
|
|
72
72
|
trapped?: ReadonlySet<string>
|
|
73
73
|
/** paths the graph says override but the compiler finds nothing to override */
|
|
74
74
|
plain?: ReadonlySet<string>
|
|
75
|
+
/** paths whose type the guest cannot represent in objective-c: emitted without @objc */
|
|
76
|
+
unobjc?: ReadonlySet<string>
|
|
75
77
|
/** paths the compiler says must be marked override */
|
|
76
78
|
forcedOverride?: ReadonlySet<string>
|
|
77
79
|
/** operator token → prefix, infix, or postfix, from the swiftinterface */
|
|
@@ -853,11 +855,14 @@ export function emitSwiftStandin(
|
|
|
853
855
|
const { 1: spelledAttrs, 2: rest } = LEADING_ATTRS.exec(text(member))!
|
|
854
856
|
// a property wrapper is the module's own type; the property it wraps
|
|
855
857
|
// becomes computed here, which a wrapper cannot annotate
|
|
856
|
-
const
|
|
858
|
+
const wrapped = member.kind.identifier.includes('property')
|
|
857
859
|
? spelledAttrs!.replace(/@(\w+)(?:\([^)]*\))?\s*/g, (attr, name: string) =>
|
|
858
860
|
typeByPath.has(name) ? '' : attr,
|
|
859
861
|
)
|
|
860
862
|
: spelledAttrs!
|
|
863
|
+
const attrs = options.unobjc?.has(path)
|
|
864
|
+
? wrapped.replace(/@objc(?:\([^)]*\))?\s*/g, '')
|
|
865
|
+
: wrapped
|
|
861
866
|
const modifiers =
|
|
862
867
|
/^((?:(?:required|final|override|convenience|unowned(?:\(\w+\))?|weak|lazy|nonisolated|mutating|nonmutating) )*)(.*)$/s.exec(
|
|
863
868
|
rest!,
|
package/src/swift-standins.ts
CHANGED
|
@@ -15,10 +15,12 @@ import fs from 'node:fs'
|
|
|
15
15
|
import path from 'node:path'
|
|
16
16
|
import { cacheDir as peachCacheDir, swiftPackageCacheOptions } from './home-paths'
|
|
17
17
|
import { isRecord } from './is-record'
|
|
18
|
+
import { fetchNativeEntry, nativeEntryKey } from './native-prebuilt'
|
|
18
19
|
import { outputLockStdio } from './output-lock-stdio'
|
|
19
20
|
import { parsePlistSource } from './plist'
|
|
20
21
|
import {
|
|
21
22
|
FOUNDATION_IMPLICIT_MODULES,
|
|
23
|
+
foundationOwnerOf,
|
|
22
24
|
swiftDistributionAt,
|
|
23
25
|
swiftImportNames,
|
|
24
26
|
swiftMacroPlugins,
|
|
@@ -51,6 +53,7 @@ import {
|
|
|
51
53
|
emitSwiftStandin,
|
|
52
54
|
isSwiftDeclaration,
|
|
53
55
|
objcProtocolsInSwiftSignatures,
|
|
56
|
+
type SymbolFragment,
|
|
54
57
|
type SymbolGraph,
|
|
55
58
|
type SwiftStandinBehaviors,
|
|
56
59
|
type StandinBehavior,
|
|
@@ -557,7 +560,12 @@ export function swiftInterfaceForWasm(text: string, cFlags: readonly string[]):
|
|
|
557
560
|
const interop = /\s-enable-objc-interop\b/.test(targeted)
|
|
558
561
|
? targeted
|
|
559
562
|
: `${targeted} -enable-objc-interop`
|
|
560
|
-
|
|
563
|
+
// raw modules skip the object wrap the toolset's -mllvm sjlj pair aborts in.
|
|
564
|
+
const xcc = [...cFlags, '-Xclang', '-fmodule-format=raw'].flatMap((flag) => [
|
|
565
|
+
'-Xcc',
|
|
566
|
+
flag,
|
|
567
|
+
])
|
|
568
|
+
return `${interop} ${xcc.join(' ')}`
|
|
561
569
|
})
|
|
562
570
|
return retargeted
|
|
563
571
|
.split('\n')
|
|
@@ -589,15 +597,22 @@ function swiftStandin(
|
|
|
589
597
|
const wasm = wasmFlags(toolchain, imports)
|
|
590
598
|
const out = path.join(work, 'graphs')
|
|
591
599
|
fs.mkdirSync(out, { recursive: true })
|
|
592
|
-
// symbolgraph-extract rejects -Xfrontend. the
|
|
600
|
+
// symbolgraph-extract rejects -Xfrontend and -Xllvm. the interop switch is its own flag.
|
|
593
601
|
const symbolgraphWasm: string[] = ['-enable-objc-interop']
|
|
594
602
|
for (let index = 0; index < wasm.length; index++) {
|
|
595
603
|
if (wasm[index] === '-Xfrontend' && wasm[index + 1] === '-enable-objc-interop') {
|
|
596
604
|
index += 1
|
|
597
605
|
continue
|
|
598
606
|
}
|
|
607
|
+
if (wasm[index] === '-Xllvm') {
|
|
608
|
+
index += 1
|
|
609
|
+
continue
|
|
610
|
+
}
|
|
599
611
|
symbolgraphWasm.push(wasm[index]!)
|
|
600
612
|
}
|
|
613
|
+
// no -Xllvm either, so the -mllvm half of the toolset's sjlj pair never reaches the
|
|
614
|
+
// backend that wraps each clang module as an object; raw modules skip it.
|
|
615
|
+
symbolgraphWasm.push('-Xcc', '-Xclang', '-Xcc', '-fmodule-format=raw')
|
|
601
616
|
exec(path.join(toolchain.toolchainBin, 'swift-symbolgraph-extract'), [
|
|
602
617
|
'-module-name',
|
|
603
618
|
surface.module,
|
|
@@ -667,6 +682,7 @@ function placeholderStandin(
|
|
|
667
682
|
surface.module,
|
|
668
683
|
...surface.flags,
|
|
669
684
|
...wasm,
|
|
685
|
+
...WASM_EH_FLAGS,
|
|
670
686
|
'-enable-library-evolution',
|
|
671
687
|
'-emit-module-path',
|
|
672
688
|
path.join(work, 'interface', `${surface.module}.swiftmodule`),
|
|
@@ -791,13 +807,46 @@ function mixedStandin(
|
|
|
791
807
|
}
|
|
792
808
|
}
|
|
793
809
|
const provided = new Set(swiftPeachModules(toolchain.moduleRoot))
|
|
794
|
-
const
|
|
810
|
+
const owners = new Set<string>()
|
|
811
|
+
const graphs = view.graphs.map((graph) => {
|
|
812
|
+
const own = new Set(graph.symbols.map((symbol) => symbol.identifier.precise))
|
|
813
|
+
// darwin's Foundation names these bare; the guest keeps them in their owning
|
|
814
|
+
// modules, and the sdk headers declare the networking types and NSErrorPointer
|
|
815
|
+
// a second time, which makes the bare name ambiguous
|
|
816
|
+
const qualify = (fragment: SymbolFragment) => {
|
|
817
|
+
const owner =
|
|
818
|
+
fragment.kind === 'typeIdentifier' &&
|
|
819
|
+
fragment.preciseIdentifier !== undefined &&
|
|
820
|
+
!own.has(fragment.preciseIdentifier)
|
|
821
|
+
? foundationOwnerOf(fragment.spelling)
|
|
822
|
+
: undefined
|
|
823
|
+
if (
|
|
824
|
+
owner === undefined ||
|
|
825
|
+
(owner !== 'FoundationNetworking' && fragment.spelling !== 'NSErrorPointer')
|
|
826
|
+
)
|
|
827
|
+
return fragment
|
|
828
|
+
owners.add(owner)
|
|
829
|
+
return { ...fragment, spelling: `${owner}.${fragment.spelling}` }
|
|
830
|
+
}
|
|
831
|
+
return {
|
|
832
|
+
...graph,
|
|
833
|
+
symbols: graph.symbols.map((symbol) => ({
|
|
834
|
+
...symbol,
|
|
835
|
+
declarationFragments: symbol.declarationFragments?.map(qualify),
|
|
836
|
+
functionSignature: symbol.functionSignature && {
|
|
837
|
+
...symbol.functionSignature,
|
|
838
|
+
returns: symbol.functionSignature.returns?.map(qualify),
|
|
839
|
+
},
|
|
840
|
+
})),
|
|
841
|
+
}
|
|
842
|
+
})
|
|
843
|
+
const imports = [...new Set([...swiftImportNames(interfaceText), ...owners])].filter(
|
|
795
844
|
(module) =>
|
|
796
845
|
module !== surface.module && (provided.has(module) || siblings.has(module)),
|
|
797
846
|
)
|
|
798
847
|
return graphStandin(
|
|
799
848
|
surface.module,
|
|
800
|
-
|
|
849
|
+
graphs,
|
|
801
850
|
values,
|
|
802
851
|
wasmFlags(toolchain, imports),
|
|
803
852
|
binary,
|
|
@@ -904,6 +953,11 @@ function nativeProtocolProperties(
|
|
|
904
953
|
return properties
|
|
905
954
|
}
|
|
906
955
|
|
|
956
|
+
// the sdk toolset passes this to every swiftc compile; raw swiftc does not read the toolset,
|
|
957
|
+
// and emitting a module aborts without it when the source reaches the wasm exception model.
|
|
958
|
+
// swift-symbolgraph-extract has no -Xllvm.
|
|
959
|
+
const WASM_EH_FLAGS = ['-Xllvm', '-wasm-enable-eh']
|
|
960
|
+
|
|
907
961
|
// the wasm target, sdk and peach module search paths a stand-in compiles with.
|
|
908
962
|
function wasmFlags(toolchain: Toolchain, imports: string[]): string[] {
|
|
909
963
|
const { sysroot, resources, cFlags } = swiftSdkPaths(
|
|
@@ -925,6 +979,10 @@ function wasmFlags(toolchain: Toolchain, imports: string[]): string[] {
|
|
|
925
979
|
// symbolgraph caller translates it.
|
|
926
980
|
'-Xfrontend',
|
|
927
981
|
'-enable-objc-interop',
|
|
982
|
+
// the toolset's -Xcc -mllvm -wasm-enable-sjlj lets libc's setjmp import,
|
|
983
|
+
// and the module build aborts unless its -Xllvm half is passed with it.
|
|
984
|
+
'-Xllvm',
|
|
985
|
+
'-wasm-enable-sjlj',
|
|
928
986
|
// the intake's darwin/usr/include declares `os` with its explicit
|
|
929
987
|
// submodules (os.log), so a vendor interface naming one resolves as the
|
|
930
988
|
// ios sdk resolves it; a second `os` map on the path is a redefinition.
|
|
@@ -964,6 +1022,8 @@ function objcStandin(
|
|
|
964
1022
|
)
|
|
965
1023
|
}
|
|
966
1024
|
|
|
1025
|
+
const OBJC_UNREPRESENTABLE =
|
|
1026
|
+
"cannot be marked '@objc' because its type cannot be represented in Objective-C"
|
|
967
1027
|
const INERT_VALUE =
|
|
968
1028
|
/missing argument|cannot be constructed|has no member 'init'|no exact matches in call to initializer|cannot convert return expression|does not conform to '|extra argument|takes no arguments|could not be inferred|cannot infer/
|
|
969
1029
|
|
|
@@ -1028,6 +1088,7 @@ function graphStandin(
|
|
|
1028
1088
|
}
|
|
1029
1089
|
const omit = new Map<string, string>()
|
|
1030
1090
|
const plain = new Set<string>()
|
|
1091
|
+
const unobjc = new Set<string>()
|
|
1031
1092
|
const trapped = new Set<string>()
|
|
1032
1093
|
const file = path.join(work, `${module}.swift`)
|
|
1033
1094
|
// a source target whose implementation compiles keeps inert bodies, and a
|
|
@@ -1045,6 +1106,7 @@ function graphStandin(
|
|
|
1045
1106
|
behavior,
|
|
1046
1107
|
omit,
|
|
1047
1108
|
plain,
|
|
1109
|
+
unobjc,
|
|
1048
1110
|
trapped,
|
|
1049
1111
|
inert,
|
|
1050
1112
|
imports: [...(placeholder?.peachImports ?? []), ...imports],
|
|
@@ -1077,6 +1139,7 @@ function graphStandin(
|
|
|
1077
1139
|
'-module-name',
|
|
1078
1140
|
module,
|
|
1079
1141
|
...wasm,
|
|
1142
|
+
...WASM_EH_FLAGS,
|
|
1080
1143
|
'-emit-module-path',
|
|
1081
1144
|
path.join(work, `${module}.swiftmodule`),
|
|
1082
1145
|
file,
|
|
@@ -1090,10 +1153,16 @@ function graphStandin(
|
|
|
1090
1153
|
files: { [`${module}.swift`]: source },
|
|
1091
1154
|
...(imports.length ? { dependencies: imports } : {}),
|
|
1092
1155
|
}
|
|
1093
|
-
const before = omit.size + plain.size + trapped.size
|
|
1156
|
+
const before = omit.size + plain.size + unobjc.size + trapped.size
|
|
1094
1157
|
const elsewhere: string[] = []
|
|
1095
1158
|
for (const match of check.stderr.matchAll(/^(\S+?):(\d+):\d+: error: (.*)$/gm)) {
|
|
1096
1159
|
const owner = match[1] === file ? owners[Number(match[2]) - 1] : undefined
|
|
1160
|
+
// the guest's protocol for an objc type is a swift protocol, so the
|
|
1161
|
+
// declaration that names it cannot be objc-visible
|
|
1162
|
+
if (owner && match[3]!.includes(OBJC_UNREPRESENTABLE)) {
|
|
1163
|
+
unobjc.add(owner)
|
|
1164
|
+
continue
|
|
1165
|
+
}
|
|
1097
1166
|
if (owner && swiftPaths.has(owner))
|
|
1098
1167
|
throw new Error(
|
|
1099
1168
|
`Swift declaration ${module}.${owner} does not typecheck: ${match[3]}`,
|
|
@@ -1110,7 +1179,7 @@ function graphStandin(
|
|
|
1110
1179
|
else if (owner) omit.set(owner, `rejected by swiftc: ${match[3]}`)
|
|
1111
1180
|
else elsewhere.push(match[3]!)
|
|
1112
1181
|
}
|
|
1113
|
-
if (omit.size + plain.size + trapped.size === before)
|
|
1182
|
+
if (omit.size + plain.size + unobjc.size + trapped.size === before)
|
|
1114
1183
|
throw new Error(
|
|
1115
1184
|
`its generated source does not typecheck: ${elsewhere.slice(0, 3).join('; ') || check.stderr.trim().slice(0, 400)}`,
|
|
1116
1185
|
)
|
|
@@ -1528,7 +1597,7 @@ function cxxStandin(
|
|
|
1528
1597
|
}
|
|
1529
1598
|
}
|
|
1530
1599
|
|
|
1531
|
-
const RUST_TARGET = 'wasm32-wasip1'
|
|
1600
|
+
export const RUST_TARGET = 'wasm32-wasip1'
|
|
1532
1601
|
// directories a crate search never enters: build output and installed deps
|
|
1533
1602
|
const UNSEARCHED = new Set([
|
|
1534
1603
|
'node_modules',
|
|
@@ -1541,7 +1610,7 @@ const UNSEARCHED = new Set([
|
|
|
1541
1610
|
|
|
1542
1611
|
// the crate whose static library is `lib<name>.a`: its `[lib] name`, or its
|
|
1543
1612
|
// package name with dashes as underscores, as cargo names the library.
|
|
1544
|
-
function crateFor(root: string, name: string): string | null {
|
|
1613
|
+
export function crateFor(root: string, name: string): string | null {
|
|
1545
1614
|
const walk = (dir: string, depth: number): string | null => {
|
|
1546
1615
|
const manifest = path.join(dir, 'Cargo.toml')
|
|
1547
1616
|
if (fs.existsSync(manifest)) {
|
|
@@ -1599,12 +1668,92 @@ function simulatorLibraryName(dir: string): string | undefined {
|
|
|
1599
1668
|
.find((name): name is string => typeof name === 'string' && /^lib.+\.a$/.test(name))
|
|
1600
1669
|
}
|
|
1601
1670
|
|
|
1671
|
+
/**
|
|
1672
|
+
* the Rust toolchain the registry's `rust` entries are built with. a host looks
|
|
1673
|
+
* entries up under this release whatever cargo it has, so a host with no wasm
|
|
1674
|
+
* target links the archive the publisher built.
|
|
1675
|
+
*/
|
|
1676
|
+
export const RUST_TOOLCHAIN = '1.94.0'
|
|
1677
|
+
|
|
1678
|
+
// the directories a crate's build reads: the workspace that owns its Cargo.lock
|
|
1679
|
+
// plus every path dependency that lies outside it.
|
|
1680
|
+
function crateSourceRoots(manifest: string): string[] {
|
|
1681
|
+
let workspace = path.dirname(manifest)
|
|
1682
|
+
while (!fs.existsSync(path.join(workspace, 'Cargo.lock'))) {
|
|
1683
|
+
const parent = path.dirname(workspace)
|
|
1684
|
+
if (parent === workspace)
|
|
1685
|
+
throw new Error(`${manifest} has no Cargo.lock; the build runs --locked`)
|
|
1686
|
+
workspace = parent
|
|
1687
|
+
}
|
|
1688
|
+
const roots = [workspace]
|
|
1689
|
+
const inside = (dir: string) =>
|
|
1690
|
+
roots.some((root) => !path.relative(root, dir).startsWith('..'))
|
|
1691
|
+
const manifests = (dir: string): string[] =>
|
|
1692
|
+
fs
|
|
1693
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
1694
|
+
.flatMap((entry) =>
|
|
1695
|
+
entry.isDirectory() && !UNSEARCHED.has(entry.name)
|
|
1696
|
+
? manifests(path.join(dir, entry.name))
|
|
1697
|
+
: entry.name === 'Cargo.toml'
|
|
1698
|
+
? [path.join(dir, entry.name)]
|
|
1699
|
+
: [],
|
|
1700
|
+
)
|
|
1701
|
+
for (let scanned = 0; scanned < roots.length; scanned++)
|
|
1702
|
+
for (const file of manifests(roots[scanned])) {
|
|
1703
|
+
const text = fs.readFileSync(file, 'utf8')
|
|
1704
|
+
for (const match of text.matchAll(/\bpath\s*=\s*"([^"]+)"/g)) {
|
|
1705
|
+
const dir = path.resolve(path.dirname(file), match[1])
|
|
1706
|
+
if (!inside(dir)) roots.push(dir)
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
return roots
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
// a digest of every file under the roots a crate builds from, build output and
|
|
1713
|
+
// installed dependencies aside.
|
|
1714
|
+
function crateSourceDigest(manifest: string): string {
|
|
1715
|
+
const hash = createHash('sha256')
|
|
1716
|
+
const walk = (dir: string, root: string) => {
|
|
1717
|
+
for (const entry of fs
|
|
1718
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
1719
|
+
.sort((left, right) => (left.name < right.name ? -1 : 1))) {
|
|
1720
|
+
const full = path.join(dir, entry.name)
|
|
1721
|
+
if (entry.isDirectory()) {
|
|
1722
|
+
if (!UNSEARCHED.has(entry.name)) walk(full, root)
|
|
1723
|
+
} else if (entry.isFile()) {
|
|
1724
|
+
hash.update(`${path.relative(root, full)}\0`)
|
|
1725
|
+
hash.update(fs.readFileSync(full))
|
|
1726
|
+
hash.update('\0')
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
for (const root of crateSourceRoots(manifest)) {
|
|
1731
|
+
hash.update(`root\0`)
|
|
1732
|
+
walk(root, root)
|
|
1733
|
+
}
|
|
1734
|
+
return hash.digest('hex')
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
/** the registry entry a crate's static library lives under. */
|
|
1738
|
+
export function rustCrateEntry(manifest: string, library: string) {
|
|
1739
|
+
const inputs = {
|
|
1740
|
+
crate: library,
|
|
1741
|
+
source: crateSourceDigest(manifest),
|
|
1742
|
+
target: RUST_TARGET,
|
|
1743
|
+
build: 'release locked',
|
|
1744
|
+
rust: RUST_TOOLCHAIN,
|
|
1745
|
+
rustflags: process.env.RUSTFLAGS ?? '',
|
|
1746
|
+
}
|
|
1747
|
+
return { name: library, inputs, key: nativeEntryKey(inputs) }
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1602
1750
|
/**
|
|
1603
1751
|
* the WebAssembly static library a c stand-in links in place of its traps,
|
|
1604
1752
|
* or null when it has none. a build the developer supplies in the
|
|
1605
1753
|
* xcframework (`wasm32-wasip1/lib<name>.a`) wins; otherwise the crate under
|
|
1606
|
-
* `searchRoot` that builds the slice's library
|
|
1607
|
-
*
|
|
1754
|
+
* `searchRoot` that builds the slice's library comes from the registry when
|
|
1755
|
+
* it holds that crate's source and toolchain, else compiles with the
|
|
1756
|
+
* developer's own cargo. peach ships no rust compiler.
|
|
1608
1757
|
*/
|
|
1609
1758
|
export function standinLibrary(
|
|
1610
1759
|
binary: SwiftPackageBinary,
|
|
@@ -1627,6 +1776,18 @@ export function standinLibrary(
|
|
|
1627
1776
|
if (!library) return null
|
|
1628
1777
|
const manifest = crateFor(searchRoot, library.slice('lib'.length, -'.a'.length))
|
|
1629
1778
|
if (!manifest) return null
|
|
1779
|
+
const entry = rustCrateEntry(manifest, library)
|
|
1780
|
+
const prebuilt = fetchNativeEntry('rust', entry.name, entry.key)
|
|
1781
|
+
if (prebuilt) return path.join(prebuilt, library)
|
|
1782
|
+
return buildRustCrate(manifest, library, searchRoot)
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/** compiles a crate for the wasm target with the environment's cargo. */
|
|
1786
|
+
export function buildRustCrate(
|
|
1787
|
+
manifest: string,
|
|
1788
|
+
library: string,
|
|
1789
|
+
searchRoot: string,
|
|
1790
|
+
): string {
|
|
1630
1791
|
const result = spawnSync(
|
|
1631
1792
|
// runner-toolchain-platform: darwin
|
|
1632
1793
|
'cargo',
|
|
@@ -2359,6 +2520,7 @@ export function swiftStandins(
|
|
|
2359
2520
|
'-module-name',
|
|
2360
2521
|
standin.module,
|
|
2361
2522
|
...wasmFlags(generatedToolchain, swiftImportNames(source)),
|
|
2523
|
+
...WASM_EH_FLAGS,
|
|
2362
2524
|
'-emit-module-path',
|
|
2363
2525
|
path.join(modules, `${standin.module}.swiftmodule`),
|
|
2364
2526
|
file,
|
package/src/swift-submit.ts
CHANGED
|
@@ -121,7 +121,11 @@ export const MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024
|
|
|
121
121
|
// 51: PDFKit asks the PDF host for one page's glyph spans on demand.
|
|
122
122
|
// 52: the PDFKit inspection reply reports a password-locked document as
|
|
123
123
|
// `{ok: true, locked: true}`, distinct from bytes the parser rejects.
|
|
124
|
-
|
|
124
|
+
// 53: block-backed IMP signature keys can carry compiler-emitted invoke roles.
|
|
125
|
+
// 54: `rnx.draw_text` lays attributed runs out and answers premultiplied rgba.
|
|
126
|
+
// 55: NSInvocation calls IMPs of any encoding through host-minted callers
|
|
127
|
+
// (`peach.imp_caller_mint`).
|
|
128
|
+
export const SWIFT_HOST_ABI = 55
|
|
125
129
|
|
|
126
130
|
export interface SwiftImageUpload {
|
|
127
131
|
/** the raster file picked for the asset (has the extension). */
|
package/src/swift-toolchain.ts
CHANGED
|
@@ -49,27 +49,27 @@ export function swiftSdkOptions(): string[] {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// host archives include the official driver/runtime and the qualified patched frontend.
|
|
52
|
-
export const SWIFT_HOST_COMPILER_RELEASE = 'swift-6.4.0-RELEASE-custom-
|
|
53
|
-
export const SWIFT_HOST_COMPILER_ID = '
|
|
52
|
+
export const SWIFT_HOST_COMPILER_RELEASE = 'swift-6.4.0-RELEASE-custom-81b2c791c27276bf'
|
|
53
|
+
export const SWIFT_HOST_COMPILER_ID = '81b2c791c27276bf'
|
|
54
54
|
// retain qualification for the published distribution while source builds advance.
|
|
55
55
|
const compilerArchives: Record<
|
|
56
56
|
string,
|
|
57
57
|
{ identity: string; hosts: Record<string, { checksum: string; manifest: string }> }
|
|
58
58
|
> = {
|
|
59
|
-
'swift-6.4.0-RELEASE-custom-
|
|
60
|
-
identity: '
|
|
59
|
+
'swift-6.4.0-RELEASE-custom-0b2d0a9011c88e66': {
|
|
60
|
+
identity: '0b2d0a9011c88e66',
|
|
61
61
|
hosts: {
|
|
62
62
|
'darwin-arm64': {
|
|
63
|
-
checksum: '
|
|
64
|
-
manifest: '
|
|
63
|
+
checksum: 'dc6a494227297ea657e8e5f7c5b4a861cb5e142bdbcfcb028ace2aeb19db90cc',
|
|
64
|
+
manifest: 'd8e9eee0fb9b847f1e9350525d6c68606df46101745f553332309ed026b3c26a',
|
|
65
65
|
},
|
|
66
66
|
'linux-x64': {
|
|
67
|
-
checksum: '
|
|
68
|
-
manifest: '
|
|
67
|
+
checksum: '85c04b4496aea1657c21a47f448e01d6ccc1c7920d130a566db37fb8350a7be2',
|
|
68
|
+
manifest: '8451659e74235ad53b700c1afbe293512197900eb98cb1f79e36df2f5c85d511',
|
|
69
69
|
},
|
|
70
70
|
'linux-arm64': {
|
|
71
|
-
checksum: '
|
|
72
|
-
manifest: '
|
|
71
|
+
checksum: '196606ed62c5c926d18e6ef0769cb1ab21c9943f9084070ddf14a7bc696768b8',
|
|
72
|
+
manifest: '85fb8d5b6527bd75003a6dbd25b68b22540665cf9df9b13f41f82e5d8acdbf1d',
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
75
|
},
|
|
@@ -77,16 +77,16 @@ const compilerArchives: Record<
|
|
|
77
77
|
identity: SWIFT_HOST_COMPILER_ID,
|
|
78
78
|
hosts: {
|
|
79
79
|
'darwin-arm64': {
|
|
80
|
-
checksum: '
|
|
81
|
-
manifest: '
|
|
80
|
+
checksum: 'bc51b83d9e2e01c9873875326544734486d3ff3a868d650379c304045e8838d3',
|
|
81
|
+
manifest: 'a26eb9cb4fbd1dbd7faac20cced1ec5e67745bd358aa1180cc4abc1a0d21d6e6',
|
|
82
82
|
},
|
|
83
83
|
'linux-x64': {
|
|
84
|
-
checksum: '
|
|
85
|
-
manifest: '
|
|
84
|
+
checksum: 'ea63bbdecae14ff8e9e3f535b521fedc65d51b31521c5d10cc332cb91882d058',
|
|
85
|
+
manifest: 'b22b321ce3eb3fe044fa2122484a15c061f262c45d88a05b3fbace0a5bf038b6',
|
|
86
86
|
},
|
|
87
87
|
'linux-arm64': {
|
|
88
|
-
checksum: '
|
|
89
|
-
manifest: '
|
|
88
|
+
checksum: '3eef4ed57830908515d8def2882e312f7cabeea57ccda5b2a7585401ef98cc48',
|
|
89
|
+
manifest: 'cfab342b8090fa83a697a391a7563cba14b771c24f07e1f8e19977f913ac88be',
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
},
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
|
|
4
|
+
import { prepareExpoNativeWorkspace } from './expo-native-workspace'
|
|
5
|
+
import { readIosAppTarget } from './native-app-identity-project'
|
|
6
|
+
import {
|
|
7
|
+
compiledModuleAssets,
|
|
8
|
+
compiledModuleRequestHandler,
|
|
9
|
+
type CompiledModuleAsset,
|
|
10
|
+
} from './nitro-bundle'
|
|
11
|
+
import { SWIFT_ENDPOINT_ENV, swiftDistributionRoot } from './swift-distribution'
|
|
12
|
+
import { icuUrl, type SwiftArtifact } from './swift-host'
|
|
13
|
+
import { compileTurboModule } from './turbo-compile'
|
|
14
|
+
import { discoverTurboProviders } from './turbo-source'
|
|
15
|
+
import type { TurboCompiledModule } from './nitroContract'
|
|
16
|
+
|
|
17
|
+
export const TURBO_ROUTE = '/__peach/turbo'
|
|
18
|
+
|
|
19
|
+
const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
|
|
20
|
+
|
|
21
|
+
// every installed iOS pod that registers a C++ TurboModule compiles from its
|
|
22
|
+
// original source into one executable, with the same compiler and asset
|
|
23
|
+
// addresses as local native loads. package javascript is carried verbatim by
|
|
24
|
+
// its bundler. a package Peach answers itself (a seam resolves before the
|
|
25
|
+
// original module) is not compiled. asset urls are relative to `origin`.
|
|
26
|
+
export async function compileTurboApp(
|
|
27
|
+
appRoot: string,
|
|
28
|
+
origin: string,
|
|
29
|
+
moduleRoot?: string,
|
|
30
|
+
): Promise<{ metadata: TurboCompiledModule; artifact: SwiftArtifact } | null> {
|
|
31
|
+
const providers = (await discoverTurboProviders(appRoot)).filter(
|
|
32
|
+
({ name }) => !answeredPackages.has(name),
|
|
33
|
+
)
|
|
34
|
+
if (providers.length === 0) return null
|
|
35
|
+
// the runtime archive is built against the published distribution, as the
|
|
36
|
+
// Nitro adapter is
|
|
37
|
+
const module = moduleRoot ?? (await swiftDistributionRoot())
|
|
38
|
+
if (!module)
|
|
39
|
+
throw new Error(
|
|
40
|
+
`TurboModule compilation needs ${SWIFT_ENDPOINT_ENV} for the Swift distribution`,
|
|
41
|
+
)
|
|
42
|
+
const projectRoot = readIosAppTarget(appRoot)
|
|
43
|
+
? appRoot
|
|
44
|
+
: (await prepareExpoNativeWorkspace(appRoot)).app
|
|
45
|
+
const { artifact, collection } = await compileTurboModule({
|
|
46
|
+
appRoot,
|
|
47
|
+
reactNativeRoot: path.dirname(
|
|
48
|
+
createRequire(path.join(appRoot, 'package.json')).resolve(
|
|
49
|
+
'react-native/package.json',
|
|
50
|
+
),
|
|
51
|
+
),
|
|
52
|
+
providers,
|
|
53
|
+
moduleRoot: module,
|
|
54
|
+
projectRoot,
|
|
55
|
+
})
|
|
56
|
+
return {
|
|
57
|
+
artifact,
|
|
58
|
+
metadata: {
|
|
59
|
+
platform: 'ios',
|
|
60
|
+
packages: collection.providers.map(({ name, version }) => ({ name, version })),
|
|
61
|
+
url: `${origin}/__peach/swift/${artifact.hash}.wasm`,
|
|
62
|
+
hash: artifact.hash,
|
|
63
|
+
icuUrl: icuUrl(origin, artifact),
|
|
64
|
+
bundleFiles: artifact.package.bundleFiles.files,
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function buildTurboBundle(
|
|
70
|
+
appRoot: string,
|
|
71
|
+
moduleRoot?: string,
|
|
72
|
+
): Promise<{ metadata: TurboCompiledModule; assets: CompiledModuleAsset[] } | null> {
|
|
73
|
+
const compiled = await compileTurboApp(appRoot, '', moduleRoot)
|
|
74
|
+
if (!compiled) return null
|
|
75
|
+
return { metadata: compiled.metadata, assets: compiledModuleAssets(compiled.artifact) }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const handleTurboRequest = compiledModuleRequestHandler(
|
|
79
|
+
'TurboModule',
|
|
80
|
+
compileTurboApp,
|
|
81
|
+
)
|