peachsim 0.1.2159 → 0.1.2173
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/README.md +7 -1
- package/cli/app-catalog.ts +22 -15
- package/cli/bridge-flow-runner.ts +8 -7
- package/cli/commands/cleanup.ts +4 -2
- package/cli/commands/control.ts +2 -1
- package/cli/commands/kotlin.ts +2 -2
- package/cli/commands/package.ts +22 -7
- package/cli/commands/shell-url.ts +4 -2
- package/cli/native-input.ts +1 -1
- package/cli/outbound-endpoints.ts +13 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +2 -3
- package/dist-lib/auth/shared-session.cjs +2 -3
- 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 +3653 -3310
- 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 +6 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +4226 -8528
- package/dist-lib/expo-swift-metadata.cjs +5 -1
- package/dist-lib/expo-swift-metadata.mjs +5 -1
- package/dist-lib/home-paths.cjs +2 -3
- package/dist-lib/host/bridge-host.cjs +4568 -4255
- package/dist-lib/host/fetch-proxy-handler.cjs +35 -15
- 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 +195 -155
- 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 +12 -7
- 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 +42 -16
- package/dist-lib/native-app-identity-project.cjs +10 -5
- package/dist-lib/native-app-identity-project.mjs +10 -5
- package/dist-lib/native-app-identity.cjs +9 -1
- package/dist-lib/native-app-identity.mjs +9 -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 +2 -3
- 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 +99 -78
- 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 +4 -2
- 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 +5762 -5118
- package/dist-lib/swift-compile.cjs +22 -11
- package/dist-lib/swift-compile.mjs +22 -11
- 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 +27 -13
- package/dist-lib/vite.cjs +119 -85
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +9 -1
- package/dist-types/packages/peach-engine/src/render-worker/ui-frame-clock.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/worklet-sab.d.ts +1 -6
- package/kotlin/README.md +5 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -1
- package/runtime-companion.json +1 -1
- package/src/answeredNativePackages.ts +1 -5
- package/src/disk-cleanup.ts +44 -1
- package/src/expo-native-compiler-digest.ts +2 -0
- package/src/expo-native-workspace.ts +61 -16
- package/src/expo-swift-host.ts +64 -53
- package/src/expoSwiftContract.ts +6 -0
- package/src/home-activity.ts +124 -0
- package/src/home-paths.ts +1 -2
- package/src/installed-native-build-options.ts +27 -3
- package/src/kotlin-app.ts +156 -31
- package/src/kotlin-compose-bom.ts +64 -0
- package/src/kotlin-host.ts +12 -3
- package/src/kotlin-version-catalog.ts +77 -0
- package/src/native-app-identity-project.ts +3 -0
- package/src/native-app-identity.ts +15 -0
- package/src/native-git.ts +12 -0
- package/src/native-prebuilt.ts +11 -2
- package/src/nitro-compile.ts +12 -4
- package/src/one-native-app-catalog.ts +59 -0
- package/src/one-sdk-bundle.ts +3 -3
- package/src/one-sdk-preparation.ts +53 -8
- package/src/react-native-core-digest.ts +24 -0
- package/src/react-native-core.ts +239 -0
- package/src/reap-browser.ts +3 -1
- package/src/swift-compile.ts +6 -5
- package/src/swift-packages.ts +2 -0
- package/src/swift-wasm-prune.ts +20 -2
- package/src/turbo-bundle.ts +15 -2
- package/src/turbo-compile.ts +32 -6
- package/src/turbo-source.ts +29 -9
- package/src/vite-plugin-one.ts +8 -5
- package/src/one-native-app-accent.ts +0 -32
package/src/swift-compile.ts
CHANGED
|
@@ -7147,11 +7147,12 @@ function compileSwiftProjectOnce(
|
|
|
7147
7147
|
]),
|
|
7148
7148
|
]
|
|
7149
7149
|
const linked = builtArtifact(layout)
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7150
|
+
// every link is deferred: a build stopped after the linker wrapper wrote
|
|
7151
|
+
// its 8-byte placeholder would otherwise leave swiftpm seeing a fresh,
|
|
7152
|
+
// empty executable and skipping the link on the next build.
|
|
7153
|
+
rmSync(path.join(root, '.peach-link.rsp'), { force: true })
|
|
7154
|
+
if (existsSync(linked) && statSync(linked).size <= 8)
|
|
7155
|
+
rmSync(linked, { force: true })
|
|
7155
7156
|
report('compiling and linking Swift modules')
|
|
7156
7157
|
try {
|
|
7157
7158
|
// clang consumes the real emitted headers after swift finishes.
|
package/src/swift-packages.ts
CHANGED
|
@@ -16,6 +16,7 @@ import path from 'node:path'
|
|
|
16
16
|
import { setTimeout as sleep } from 'node:timers/promises'
|
|
17
17
|
import { promisify } from 'node:util'
|
|
18
18
|
import { cacheDir } from './home-paths'
|
|
19
|
+
import { requireNativeGit } from './native-git'
|
|
19
20
|
import { tryAcquireNumberedLock } from './numbered-lock'
|
|
20
21
|
import { preparedSwiftCheckouts, preparedSwiftPin } from './prepared-xcode-phases'
|
|
21
22
|
import {
|
|
@@ -319,6 +320,7 @@ async function fetchCheckout(
|
|
|
319
320
|
): Promise<void> {
|
|
320
321
|
const dir = path.join(checkouts, identity)
|
|
321
322
|
if (preparedSwiftPin(checkouts, identity, pin.location, pin.revision)) return
|
|
323
|
+
requireNativeGit()
|
|
322
324
|
const key = checkoutKey(dir, pin)
|
|
323
325
|
const git: Git = async (cwd, ...args) =>
|
|
324
326
|
(
|
package/src/swift-wasm-prune.ts
CHANGED
|
@@ -1088,7 +1088,25 @@ export function pruneSwiftWasmLink(
|
|
|
1088
1088
|
const rspPath = path.join(directory, '.peach-link.rsp')
|
|
1089
1089
|
if (!fs.existsSync(rspPath)) return
|
|
1090
1090
|
const origRsp = fs.readFileSync(rspPath, 'utf8')
|
|
1091
|
-
const tokens = Array.from(
|
|
1091
|
+
const tokens = Array.from(
|
|
1092
|
+
origRsp.matchAll(/"([^"]+)"|(\S+)/g),
|
|
1093
|
+
(m) => m[1] ?? m[2]!,
|
|
1094
|
+
).flatMap((token) => {
|
|
1095
|
+
const target = /^lib(\w+)-[a-f0-9]{64}\.a$/.exec(path.basename(token))?.[1]
|
|
1096
|
+
if (
|
|
1097
|
+
!target ||
|
|
1098
|
+
!staticClangTargets.includes(target) ||
|
|
1099
|
+
path.basename(path.dirname(token)) !== '.peach-libraries'
|
|
1100
|
+
)
|
|
1101
|
+
return [token]
|
|
1102
|
+
const objects = path.join(directory, '.peach-native-libraries', `${target}.build`)
|
|
1103
|
+
fs.mkdirSync(objects, { recursive: true })
|
|
1104
|
+
return readArMembers(fs.readFileSync(token)).map((member, index) => {
|
|
1105
|
+
const file = path.join(objects, `${index}-${path.basename(member.name)}`)
|
|
1106
|
+
fs.writeFileSync(file, member.bytes)
|
|
1107
|
+
return file
|
|
1108
|
+
})
|
|
1109
|
+
})
|
|
1092
1110
|
if (!tokens.includes('--start-lib')) return
|
|
1093
1111
|
|
|
1094
1112
|
const sdkFlag = tokens.find(
|
|
@@ -1163,7 +1181,7 @@ export function pruneSwiftWasmLink(
|
|
|
1163
1181
|
if (t.endsWith('/swiftrt.o')) {
|
|
1164
1182
|
swiftrtOrigPath = t
|
|
1165
1183
|
} else if (
|
|
1166
|
-
|
|
1184
|
+
!t.endsWith('.swift.o') &&
|
|
1167
1185
|
staticClangTargets.some((name) => t.includes(`/${name}.build/`))
|
|
1168
1186
|
) {
|
|
1169
1187
|
// CocoaPods links a pod as a static archive under -ObjC, which loads
|
package/src/turbo-bundle.ts
CHANGED
|
@@ -49,6 +49,9 @@ export async function compileTurboApp(
|
|
|
49
49
|
origin: string,
|
|
50
50
|
moduleRoot?: string,
|
|
51
51
|
iosTarget?: string,
|
|
52
|
+
prepareReactNativeCore?: Parameters<
|
|
53
|
+
typeof compileTurboModule
|
|
54
|
+
>[0]['prepareReactNativeCore'],
|
|
52
55
|
): Promise<{ metadata: TurboCompiledModule; artifact: SwiftArtifact | null } | null> {
|
|
53
56
|
// a standard Expo app's published build needs no prepared workspace
|
|
54
57
|
const prebuilt = moduleRoot ? null : await prebuiltExpoNative(appRoot, iosTarget)
|
|
@@ -92,7 +95,7 @@ export async function compileTurboApp(
|
|
|
92
95
|
const { artifact, collection } = await compileTurboModule({
|
|
93
96
|
appRoot,
|
|
94
97
|
reactNativeRoot: path.dirname(
|
|
95
|
-
createRequire(path.join(
|
|
98
|
+
createRequire(path.join(projectRoot, 'package.json')).resolve(
|
|
96
99
|
'react-native/package.json',
|
|
97
100
|
),
|
|
98
101
|
),
|
|
@@ -101,6 +104,7 @@ export async function compileTurboApp(
|
|
|
101
104
|
projectRoot,
|
|
102
105
|
iosTarget,
|
|
103
106
|
installedPods: installed?.pods,
|
|
107
|
+
prepareReactNativeCore,
|
|
104
108
|
})
|
|
105
109
|
return {
|
|
106
110
|
artifact,
|
|
@@ -119,8 +123,17 @@ export async function compileTurboApp(
|
|
|
119
123
|
export async function buildTurboBundle(
|
|
120
124
|
appRoot: string,
|
|
121
125
|
moduleRoot?: string,
|
|
126
|
+
prepareReactNativeCore?: Parameters<
|
|
127
|
+
typeof compileTurboModule
|
|
128
|
+
>[0]['prepareReactNativeCore'],
|
|
122
129
|
): Promise<{ metadata: TurboCompiledModule; assets: CompiledModuleAsset[] } | null> {
|
|
123
|
-
const compiled = await compileTurboApp(
|
|
130
|
+
const compiled = await compileTurboApp(
|
|
131
|
+
appRoot,
|
|
132
|
+
'',
|
|
133
|
+
moduleRoot,
|
|
134
|
+
undefined,
|
|
135
|
+
prepareReactNativeCore,
|
|
136
|
+
)
|
|
124
137
|
if (!compiled) return null
|
|
125
138
|
return {
|
|
126
139
|
metadata: compiled.metadata,
|
package/src/turbo-compile.ts
CHANGED
|
@@ -5,6 +5,7 @@ import os from 'node:os'
|
|
|
5
5
|
import path from 'node:path'
|
|
6
6
|
import { readIosAppTarget } from './native-app-identity-project'
|
|
7
7
|
import { resolveAdapterArchive, type AdapterArchive } from './nitro-adapter'
|
|
8
|
+
import { linkReactNativeCore, prebuiltReactNativeCore } from './react-native-core'
|
|
8
9
|
import {
|
|
9
10
|
missingSwiftModules,
|
|
10
11
|
swiftAvailableModules,
|
|
@@ -102,13 +103,24 @@ export function collectTurboCompileInput(
|
|
|
102
103
|
dependencyTargets = dependencyTargets.filter(
|
|
103
104
|
(_, index) => !providerNames.has(parsedTargets[index]!.name),
|
|
104
105
|
)
|
|
105
|
-
const entry = 'Sources/PeachTurboApp/main.swift'
|
|
106
106
|
const swift = Object.keys(files).some((file) => file.endsWith('.swift'))
|
|
107
|
+
const entry = `Sources/PeachTurboApp/main.${swift ? 'swift' : 'cpp'}`
|
|
107
108
|
const targetNames = targets.map(({ name }) => name)
|
|
108
|
-
files[entry] =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
files[entry] = swift
|
|
110
|
+
? '@_spi(Peach) import PeachFoundation\n' +
|
|
111
|
+
targetNames.map((target) => `import ${target}\n`).join('') +
|
|
112
|
+
`PeachHostDriver.installExecutor()\n${collection.loads.map(({ symbol }) => `${symbol}()\n`).join('')}${runtime ? 'peachTurboInitialize()\n' : ''}`
|
|
113
|
+
: [
|
|
114
|
+
'extern "C" void peachTurboInitialize();',
|
|
115
|
+
...collection.loads.map(({ symbol }) => `extern "C" void ${symbol}();`),
|
|
116
|
+
'int main(int argc, char **argv) {',
|
|
117
|
+
'(void)argc; (void)argv;',
|
|
118
|
+
...collection.loads.map(({ symbol }) => `${symbol}();`),
|
|
119
|
+
...(runtime ? ['peachTurboInitialize();'] : []),
|
|
120
|
+
'return 0;',
|
|
121
|
+
'}',
|
|
122
|
+
'',
|
|
123
|
+
].join('\n')
|
|
112
124
|
files['Package.swift'] = [
|
|
113
125
|
'// swift-tools-version: 6.2',
|
|
114
126
|
'import PackageDescription',
|
|
@@ -167,7 +179,7 @@ export function collectTurboCompileInput(
|
|
|
167
179
|
libraries: {
|
|
168
180
|
...dependencies?.libraries,
|
|
169
181
|
...collection.libraries,
|
|
170
|
-
...(runtime ? {
|
|
182
|
+
...(runtime ? { PeachTurboApp: runtime.base64 } : {}),
|
|
171
183
|
},
|
|
172
184
|
optimize: true,
|
|
173
185
|
staticClangTargets: targets.map((target) => target.name),
|
|
@@ -199,6 +211,10 @@ export async function compileTurboModule(options: {
|
|
|
199
211
|
moduleRoot: string
|
|
200
212
|
projectRoot: string
|
|
201
213
|
iosTarget?: string
|
|
214
|
+
prepareReactNativeCore?: (
|
|
215
|
+
mode: TurboSourceCollection['coreMode'],
|
|
216
|
+
moduleRoot: string,
|
|
217
|
+
) => Promise<void>
|
|
202
218
|
/** the installed workspace's pods; without them the podspecs' literal source membership applies. */
|
|
203
219
|
installedPods?: ReadonlyMap<string, TurboInstalledPod>
|
|
204
220
|
}): Promise<{ artifact: SwiftArtifact; collection: TurboSourceCollection }> {
|
|
@@ -397,6 +413,16 @@ export async function compileTurboModule(options: {
|
|
|
397
413
|
throw new Error(
|
|
398
414
|
`TurboModule compilation needs the app's Xcode project to declare an iOS deployment target: ${options.projectRoot}`,
|
|
399
415
|
)
|
|
416
|
+
await options.prepareReactNativeCore?.(collection.coreMode, options.moduleRoot)
|
|
417
|
+
linkReactNativeCore(
|
|
418
|
+
collection,
|
|
419
|
+
prebuiltReactNativeCore(
|
|
420
|
+
options.reactNativeRoot,
|
|
421
|
+
options.moduleRoot,
|
|
422
|
+
collection.coreMode,
|
|
423
|
+
),
|
|
424
|
+
options.moduleRoot,
|
|
425
|
+
)
|
|
400
426
|
const input = collectTurboCompileInput(
|
|
401
427
|
collection,
|
|
402
428
|
await resolveAdapterArchive(
|
package/src/turbo-source.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
runInstalledTurboCodegen,
|
|
51
51
|
} from './turbo-codegen-intake'
|
|
52
52
|
import { installedXcodeWorkspace } from './xcode-project'
|
|
53
|
+
import type { ReactNativeCoreMode } from './react-native-core'
|
|
53
54
|
import type { SwiftCompileInput } from './swift-compile'
|
|
54
55
|
import type { SwiftPackageTarget } from './swift-package'
|
|
55
56
|
import type { SwiftNativeHeaderMap } from './swiftContract'
|
|
@@ -88,6 +89,7 @@ export interface TurboInstalledPod extends TurboInstalledSources {
|
|
|
88
89
|
/** source fragments for the common Swift host. the caller owns the executable,
|
|
89
90
|
* which runs every `loads` symbol and then `peachTurboInitialize`. */
|
|
90
91
|
export interface TurboSourceCollection {
|
|
92
|
+
coreMode: ReactNativeCoreMode
|
|
91
93
|
files: SwiftCompileInput['files']
|
|
92
94
|
libraries?: SwiftCompileInput['libraries']
|
|
93
95
|
binaryModules?: SwiftCompileInput['binaryModules']
|
|
@@ -955,6 +957,7 @@ function registers(root: string, files: Iterable<string>, objc = true): boolean
|
|
|
955
957
|
|
|
956
958
|
export async function turboProviderCandidates(appRoot: string) {
|
|
957
959
|
const candidates: { provider: TurboProvider; fabric: boolean; expo: boolean }[] = []
|
|
960
|
+
const answered = peachAnsweredNativePackages()
|
|
958
961
|
const autolinked = await iosAutolinkedDependencies(appRoot)
|
|
959
962
|
// the React Native autolinker leaves out Expo modules, whose Objective-C
|
|
960
963
|
// can still register with React Native
|
|
@@ -963,7 +966,7 @@ export async function turboProviderCandidates(appRoot: string) {
|
|
|
963
966
|
)
|
|
964
967
|
for (const { name, root, podspecPath } of [...autolinked, ...expoPods]) {
|
|
965
968
|
// a package peach-compat answers keeps its answer, Fabric views included.
|
|
966
|
-
if (
|
|
969
|
+
if (answered.has(name)) continue
|
|
967
970
|
// a pod can register Nitro objects and Fabric components independently.
|
|
968
971
|
const fabric = fabricComponents(root)
|
|
969
972
|
if (!podspecPath) continue
|
|
@@ -1091,8 +1094,15 @@ export async function collectTurboSources(options: {
|
|
|
1091
1094
|
projectRoot: string
|
|
1092
1095
|
/** link React's native implementations into an existing Swift host. */
|
|
1093
1096
|
reactNativeProvider?: true
|
|
1097
|
+
reactNativeCore?: true
|
|
1098
|
+
/** build shared core with the TurboModule host's dispatch contract. */
|
|
1099
|
+
turboDispatch?: true
|
|
1094
1100
|
}): Promise<TurboSourceCollection> {
|
|
1095
|
-
if (
|
|
1101
|
+
if (
|
|
1102
|
+
options.providers.length === 0 &&
|
|
1103
|
+
!options.reactNativeProvider &&
|
|
1104
|
+
!options.reactNativeCore
|
|
1105
|
+
)
|
|
1096
1106
|
throw new Error('TurboModule compilation needs at least one provider')
|
|
1097
1107
|
const reactNative = packageInfo(options.reactNativeRoot)
|
|
1098
1108
|
if (reactNative.name !== 'react-native')
|
|
@@ -1100,9 +1110,12 @@ export async function collectTurboSources(options: {
|
|
|
1100
1110
|
const providers = options.providers
|
|
1101
1111
|
.map((provider) => ({ ...provider, info: packageInfo(provider.root) }))
|
|
1102
1112
|
.sort((a, b) => a.info.name.localeCompare(b.info.name))
|
|
1103
|
-
const installedHeaderPods = (
|
|
1104
|
-
|
|
1105
|
-
|
|
1113
|
+
const installedHeaderPods = (
|
|
1114
|
+
options.reactNativeProvider || options.reactNativeCore
|
|
1115
|
+
? []
|
|
1116
|
+
: await installedTurboHeaderPods(options.appRoot)
|
|
1117
|
+
).map((provider) =>
|
|
1118
|
+
readPod(provider, options.appRoot, options.installedPods?.get(provider.name)),
|
|
1106
1119
|
)
|
|
1107
1120
|
let codegen: string | null = null
|
|
1108
1121
|
let moduleProviders = false
|
|
@@ -1146,6 +1159,7 @@ export async function collectTurboSources(options: {
|
|
|
1146
1159
|
cxxDefines: defines,
|
|
1147
1160
|
})
|
|
1148
1161
|
const result: TurboSourceCollection = {
|
|
1162
|
+
coreMode: 'turbo-cxx',
|
|
1149
1163
|
files: {},
|
|
1150
1164
|
targets: [target(TURBO_CORE_TARGET, [])],
|
|
1151
1165
|
loads: [],
|
|
@@ -1191,7 +1205,12 @@ export async function collectTurboSources(options: {
|
|
|
1191
1205
|
relative: string,
|
|
1192
1206
|
compiled = true,
|
|
1193
1207
|
) => {
|
|
1194
|
-
|
|
1208
|
+
// swiftpm infers an executable from a main filename even in a library target.
|
|
1209
|
+
const staged = relative.replace(
|
|
1210
|
+
/(^|\/)main(\.(?:c|cc|cpp|cxx|m|mm))$/,
|
|
1211
|
+
'$1main.library$2',
|
|
1212
|
+
)
|
|
1213
|
+
const key = `${targetPath(targetName)}/upstream/${label}/${staged}`
|
|
1195
1214
|
if (UNIT.test(relative) || OBJC.test(relative))
|
|
1196
1215
|
(compiled ? compiledSources : textualSources).add(key)
|
|
1197
1216
|
if (Object.hasOwn(result.files, key)) return key
|
|
@@ -2162,7 +2181,7 @@ export async function collectTurboSources(options: {
|
|
|
2162
2181
|
'#ifdef __cplusplus',
|
|
2163
2182
|
'extern "C" {',
|
|
2164
2183
|
'#endif',
|
|
2165
|
-
...(!options.reactNativeProvider
|
|
2184
|
+
...(!options.reactNativeProvider || options.turboDispatch
|
|
2166
2185
|
? ['void peachTurboDispatchAsync(dispatch_block_t block);']
|
|
2167
2186
|
: []),
|
|
2168
2187
|
'CFBundleRef CFBundleGetMainBundle(void);',
|
|
@@ -2171,7 +2190,7 @@ export async function collectTurboSources(options: {
|
|
|
2171
2190
|
'#ifdef __cplusplus',
|
|
2172
2191
|
'}',
|
|
2173
2192
|
'#endif',
|
|
2174
|
-
...(!options.reactNativeProvider
|
|
2193
|
+
...(!options.reactNativeProvider || options.turboDispatch
|
|
2175
2194
|
? [
|
|
2176
2195
|
'static inline void _peach_dispatch_async(dispatch_queue_t _Nullable q, dispatch_block_t _Nonnull b) { (void)q; peachTurboDispatchAsync(b); }',
|
|
2177
2196
|
'static inline void _peach_dispatch_after(dispatch_time_t w, dispatch_queue_t _Nullable q, dispatch_block_t _Nonnull b) { (void)q; dispatch_block_t copied = [b copy]; dispatch_after(w, dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{ peachTurboDispatchAsync(copied); }); }',
|
|
@@ -2322,8 +2341,9 @@ export async function collectTurboSources(options: {
|
|
|
2322
2341
|
}
|
|
2323
2342
|
}
|
|
2324
2343
|
const hostName = objc ? 'PeachTurboHost.mm' : 'PeachTurboHost.cpp'
|
|
2344
|
+
result.coreMode = objc ? 'turbo' : fabric ? 'expo' : 'turbo-cxx'
|
|
2325
2345
|
const host = `${core}/${hostName}`
|
|
2326
|
-
if (!options.reactNativeProvider) {
|
|
2346
|
+
if (!options.reactNativeProvider && !options.reactNativeCore) {
|
|
2327
2347
|
add(
|
|
2328
2348
|
host,
|
|
2329
2349
|
objc
|
package/src/vite-plugin-one.ts
CHANGED
|
@@ -32,9 +32,9 @@ import { handleReplacementModuleRequest } from './host/replacement-module-handle
|
|
|
32
32
|
import { forwardRolldownBundleResponse } from './host/rolldown-bundle-forward'
|
|
33
33
|
import { readInstalledNativePackageVersions } from './installed-package-versions'
|
|
34
34
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} from './one-native-app-
|
|
35
|
+
ONE_NATIVE_APP_CATALOG_ROUTE,
|
|
36
|
+
readOneNativeAppCatalog,
|
|
37
|
+
} from './one-native-app-catalog'
|
|
38
38
|
import { configuredOneWidget } from './one-widget-metadata'
|
|
39
39
|
import {
|
|
40
40
|
isRootRuntimeAssetPath,
|
|
@@ -510,11 +510,14 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
510
510
|
}
|
|
511
511
|
|
|
512
512
|
server.middlewares.use((req, res, next) => {
|
|
513
|
-
if ((req.url ?? '').split('?')[0] !==
|
|
513
|
+
if ((req.url ?? '').split('?')[0] !== ONE_NATIVE_APP_CATALOG_ROUTE) return next()
|
|
514
514
|
res.setHeader('content-type', 'application/json')
|
|
515
515
|
res.end(
|
|
516
516
|
JSON.stringify(
|
|
517
|
-
|
|
517
|
+
readOneNativeAppCatalog(
|
|
518
|
+
Reflect.get(globalThis, '__vxrnNativeEntryConfig'),
|
|
519
|
+
server.config.root,
|
|
520
|
+
),
|
|
518
521
|
),
|
|
519
522
|
)
|
|
520
523
|
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// the AccentColor asset `one prebuild` writes from `native.app.ios.accentColor`.
|
|
2
|
-
// a One app with no ios/ on disk declares it only in the config its dev server
|
|
3
|
-
// evaluated, so the plugin in that server reports it and the cli stamps it into
|
|
4
|
-
// the page's app catalog the way it stamps a checked-in AccentColor.colorset.
|
|
5
|
-
|
|
6
|
-
import { isRecord } from './is-record'
|
|
7
|
-
|
|
8
|
-
export const ONE_NATIVE_APP_ACCENT_ROUTE = '/__peach/native-app-accent'
|
|
9
|
-
|
|
10
|
-
const HEX_COLOR = /^#[\da-f]{6}$/i
|
|
11
|
-
|
|
12
|
-
export interface OneNativeAppAccent {
|
|
13
|
-
light: string
|
|
14
|
-
dark: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function parseOneNativeAppAccent(value: unknown): OneNativeAppAccent | null {
|
|
18
|
-
if (!isRecord(value) || typeof value.light !== 'string') return null
|
|
19
|
-
if (!HEX_COLOR.test(value.light)) return null
|
|
20
|
-
const dark =
|
|
21
|
-
typeof value.dark === 'string' && HEX_COLOR.test(value.dark)
|
|
22
|
-
? value.dark
|
|
23
|
-
: value.light
|
|
24
|
-
return { light: value.light, dark }
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// the native entry config One's dev server holds on globalThis
|
|
28
|
-
export function readOneNativeAppAccent(entryConfig: unknown): OneNativeAppAccent | null {
|
|
29
|
-
const app = isRecord(entryConfig) ? entryConfig.app : undefined
|
|
30
|
-
const ios = isRecord(app) ? app.ios : undefined
|
|
31
|
-
return isRecord(ios) ? parseOneNativeAppAccent(ios.accentColor) : null
|
|
32
|
-
}
|