peachsim 0.1.1716 → 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/README.md +21 -3
- package/cli/app-bundle-resources.ts +2 -1
- package/cli/app-fonts.ts +4 -4
- package/cli/app-splash.ts +4 -4
- package/cli/app-stubs.ts +17 -0
- package/cli/command-registry.ts +1 -0
- package/cli/commands/control.ts +83 -822
- package/cli/commands/coverage-swift.ts +112 -4
- package/cli/commands/daemon.ts +8 -0
- package/cli/commands/detox.ts +3 -0
- package/cli/commands/doctor.ts +19 -2
- package/cli/commands/inspect/actions.ts +74 -14
- package/cli/commands/inspect/core.ts +5 -1
- package/cli/commands/inspect/settling.ts +5 -2
- package/cli/commands/inspect/wait-ready.ts +6 -0
- package/cli/commands/inspect.ts +48 -45
- package/cli/commands/kotlin.ts +12 -2
- package/cli/commands/package.ts +760 -0
- package/cli/commands/serve.ts +6 -0
- package/cli/commands/shell-url.ts +838 -0
- package/cli/commands/swift.ts +42 -102
- package/cli/commands/test.ts +20 -0
- package/cli/commands/upload.ts +1 -1
- package/cli/device-option.ts +1 -1
- package/cli/main.ts +13 -1
- package/cli/native-input.ts +199 -0
- package/cli/outbound-endpoints.ts +26 -1
- package/cli/packaged-app-launcher.ts +95 -0
- package/cli/scene-video.ts +36 -12
- package/detox/index.ts +196 -24
- 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 +39889 -31873
- 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 +195 -63
- package/dist-lib/dev-bundle-resolution.cjs +14 -13
- package/dist-lib/expo-swift-bundle.cjs +18507 -11835
- package/dist-lib/expo-swift-metadata.cjs +4 -1
- package/dist-lib/expo-swift-metadata.mjs +3 -1
- package/dist-lib/home-paths.cjs +27 -3
- package/dist-lib/host/bridge-host.cjs +28373 -24090
- package/dist-lib/host/fetch-proxy-handler.cjs +235 -225
- 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 +915 -399
- 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 +335 -47
- package/dist-lib/menu.cjs +13 -1
- package/dist-lib/menu.mjs +13 -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 +918 -411
- package/dist-lib/native-app-identity-project.cjs +703 -283
- package/dist-lib/native-app-identity-project.mjs +500 -87
- package/dist-lib/native-app-identity.cjs +13 -2
- package/dist-lib/native-app-identity.mjs +13 -2
- 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 +28 -23
- package/dist-lib/public-origins-lib.json +418 -224
- package/dist-lib/react-native-host-modules.cjs +35 -2
- package/dist-lib/react-native-host-modules.mjs +35 -2
- package/dist-lib/reap-browser.cjs +12 -4
- package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
- package/dist-lib/sdk.cjs +17 -7
- package/dist-lib/sdk.mjs +16 -7
- package/dist-lib/skills.cjs +44825 -29141
- package/dist-lib/swift-compile.cjs +616 -400
- package/dist-lib/swift-compile.mjs +528 -315
- 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 +105 -17
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +4660 -2252
- package/dist-lib/vite.cjs +248 -234
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
- 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 +9 -6
- 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 +11 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -12
- 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/engine/types.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
- 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 +5 -0
- package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +36 -2
- package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
- 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/scripts/dev-server-scanner.ts +12 -25
- 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/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +711 -46
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
- package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
- package/sdk/ios/usr/include/module.modulemap +1 -0
- package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
- package/sdk/ios/usr/include/os/signpost.h +414 -0
- package/sdk/ios/usr/include/os.modulemap +10 -0
- package/sdk/ios/usr/include/sys/cdefs.h +5 -0
- package/sdk/ios/usr/include/sys/ioccom.h +99 -0
- package/sdk/ios/usr/include/sys/syslog.h +236 -0
- package/sdk/ios/usr/include/syslog.h +24 -0
- package/sdk/ios/wasm/include/errno.h +4 -20
- package/sdk/ios/wasm/include/fcntl.h +4 -2
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/setjmp.h +57 -0
- package/sdk/ios/wasm/include/stdio.h +24 -0
- package/sdk/ios/wasm/include/stdlib.h +32 -7
- package/sdk/ios/wasm/include/sys/file.h +7 -0
- package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
- package/sdk/ios/wasm/include/sys/resource.h +2 -2
- package/sdk/ios/wasm/include/sys/syscall.h +9 -0
- package/sdk/ios/wasm/include/sys/time.h +10 -0
- package/sdk/ios/wasm/include/unistd.h +12 -3
- package/sdk/native-hashes.json +4 -3
- package/skills/contrast/SKILL.md +2 -1
- 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 +7 -4
- package/skills/peach-visual/SKILL.md +0 -1
- package/src/admitted-mac-build.ts +3 -0
- package/src/android-app-identity.ts +18 -0
- package/src/android-autolinking.ts +1 -0
- package/src/android-bridge-packages.ts +279 -0
- package/src/android-root-module.ts +9 -9
- package/src/appPackageContract.ts +83 -0
- package/src/bridge-contract.ts +50 -0
- package/src/bundle-channel.mjs +41 -6
- package/src/cli-runtime.ts +9 -5
- package/src/dev-bundle-resolution.ts +7 -27
- package/src/dom-source-reference.ts +15 -0
- package/src/expo-discovery-cache.ts +134 -26
- package/src/expo-kotlin-host.ts +97 -26
- package/src/expo-manifest-body.ts +33 -0
- package/src/expo-native-workspace.ts +158 -38
- package/src/expo-swift-host.ts +350 -75
- package/src/expo-swift-ready.ts +5 -1
- package/src/expoKotlinContract.ts +12 -2
- package/src/expoSwiftContract.ts +10 -0
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +41 -2
- package/src/host/app-package-handler.ts +47 -0
- package/src/host/bridge-host.ts +8 -0
- package/src/host/fetch-proxy-handler.ts +10 -0
- package/src/host/staged-host-files.ts +18 -0
- package/src/index.ts +3 -0
- package/src/kotlin-host.ts +225 -48
- package/src/kotlin-instance-source.ts +126 -0
- package/src/kotlinSdkContract.ts +2 -1
- package/src/menu.ts +14 -0
- package/src/native-app-identity-project.ts +7 -2
- package/src/native-app-identity.ts +11 -0
- package/src/native-firebase-config.ts +24 -1
- package/src/native-prebuilt.ts +154 -0
- package/src/nitro-adapter.lock.json +270 -270
- package/src/nitro-adapter.ts +56 -50
- package/src/nitro-bundle.ts +92 -74
- package/src/nitro-compile.ts +45 -14
- package/src/nitro-dependencies.ts +63 -46
- package/src/nitro-source.ts +64 -26
- package/src/nitroAdapterContract.ts +146 -98
- package/src/nitroContract.ts +71 -21
- package/src/react-native-bridge-modules.ts +70 -42
- package/src/react-native-host-modules.ts +34 -1
- package/src/reactNativeConfigurationContract.ts +14 -0
- package/src/reap-browser.ts +15 -3
- package/src/sdk.ts +5 -0
- package/src/settingsContract.ts +38 -1
- package/src/sim-client.ts +4 -1
- package/src/storageSnapshotContract.ts +32 -81
- package/src/swift-compile.ts +268 -89
- package/src/swift-coverage/indexdump.ts +22 -6
- package/src/swift-coverage/indexing.ts +4 -4
- package/src/swift-coverage/provenance.ts +1 -0
- package/src/swift-coverage/sdk.ts +104 -20
- package/src/swift-coverage/types.ts +34 -0
- package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
- package/src/swift-coverage/xcode-assets.ts +89 -131
- package/src/swift-coverage/xcode.ts +10 -2
- package/src/swift-cxx-reachable.ts +2 -1
- package/src/swift-distribution.lock.json +20 -16
- package/src/swift-host.ts +98 -22
- package/src/swift-icu.ts +1 -1
- package/src/swift-link-roots.ts +118 -0
- package/src/swift-objc-compile.ts +144 -22
- package/src/swift-objc-import.ts +6 -0
- package/src/swift-objc-standin.ts +2 -14
- package/src/swift-package-manifest.ts +14 -6
- package/src/swift-packages.ts +75 -11
- package/src/swift-pdf-raster.ts +1 -0
- package/src/swift-root-lock.ts +17 -1
- package/src/swift-source-pods.ts +2 -10
- package/src/swift-standin-emit.ts +597 -57
- package/src/swift-standins.ts +599 -56
- package/src/swift-submit.ts +7 -1
- package/src/swift-toolchain.ts +140 -17
- package/src/turbo-bundle.ts +81 -0
- package/src/turbo-codegen-intake.ts +91 -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 +17 -12
- package/src/vite-plugin.ts +28 -15
- package/src/xcode-project.ts +223 -22
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// prepare Expo's own CocoaPods workspace in a private cache on the Mac.
|
|
2
|
-
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { execFile, execFileSync } from 'node:child_process'
|
|
3
3
|
import { createHash } from 'node:crypto'
|
|
4
4
|
import fs from 'node:fs'
|
|
5
5
|
import { createRequire } from 'node:module'
|
|
6
6
|
import path from 'node:path'
|
|
7
|
+
import { promisify } from 'node:util'
|
|
7
8
|
import { cacheDir } from './home-paths'
|
|
8
9
|
import { withSwiftRootLock, type SwiftRootLease } from './swift-root-lock'
|
|
9
10
|
import { findWorkspaceRoot } from './workspace-root'
|
|
@@ -17,42 +18,71 @@ const isolatedGitEnv = {
|
|
|
17
18
|
// CocoaPods refuses a non UTF-8 locale, so even its version probe names one.
|
|
18
19
|
const utf8Env = { ...process.env, LANG: 'en_US.UTF-8', LC_ALL: 'en_US.UTF-8' }
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
// eas build archives a repository without its gitignored paths, so the prepare
|
|
22
|
+
// neither copies nor hashes them: files a dev server generates into an ignored
|
|
23
|
+
// directory never invalidate the prepared workspace.
|
|
24
|
+
async function workspaceExclusion(root: string) {
|
|
25
|
+
const listed = await promisify(execFile)(
|
|
26
|
+
'git',
|
|
27
|
+
['ls-files', '-z', '--others', '--ignored', '--exclude-standard', '--directory'],
|
|
28
|
+
{
|
|
29
|
+
cwd: root,
|
|
30
|
+
encoding: 'utf8',
|
|
31
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
32
|
+
env: { ...process.env, ...isolatedGitEnv },
|
|
33
|
+
},
|
|
34
|
+
).catch(() => ({ stdout: '' }))
|
|
35
|
+
const ignored = new Set(
|
|
36
|
+
listed.stdout
|
|
37
|
+
.split('\0')
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.map((entry) => entry.replace(/\/$/, '')),
|
|
27
40
|
)
|
|
41
|
+
return (relative: string) => {
|
|
42
|
+
const parts = relative.split(path.sep)
|
|
43
|
+
return (
|
|
44
|
+
ignored.has(parts.join('/')) ||
|
|
45
|
+
parts.includes('node_modules') ||
|
|
46
|
+
parts.includes('.git') ||
|
|
47
|
+
parts.includes('.expo') ||
|
|
48
|
+
(parts.includes('ios') && (parts.includes('Pods') || parts.includes('build')))
|
|
49
|
+
)
|
|
50
|
+
}
|
|
28
51
|
}
|
|
29
52
|
|
|
30
53
|
// every file the native prepare can read, plus the toolchain that reads it.
|
|
31
54
|
// node_modules stays out: the js install rebuilds it from the hashed lockfiles,
|
|
32
|
-
// and the discovery cache keys the live native inventory separately.
|
|
33
|
-
|
|
55
|
+
// and the discovery cache keys the live native inventory separately. the walk
|
|
56
|
+
// yields so the bridge that runs it keeps answering its other requests.
|
|
57
|
+
export async function hashExpoWorkspace(
|
|
34
58
|
app: string,
|
|
35
59
|
signal?: AbortSignal,
|
|
36
|
-
): {
|
|
60
|
+
): Promise<{
|
|
61
|
+
root: string
|
|
62
|
+
appRelative: string
|
|
63
|
+
hash: string
|
|
64
|
+
excluded: (relative: string) => boolean
|
|
65
|
+
}> {
|
|
37
66
|
const root = findWorkspaceRoot(app)
|
|
67
|
+
const excluded = await workspaceExclusion(root)
|
|
38
68
|
const appRelative = path.relative(root, app)
|
|
39
69
|
const manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
|
|
40
70
|
const hash = createHash('sha256')
|
|
41
|
-
const walk = (directory: string) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
71
|
+
const walk = async (directory: string) => {
|
|
72
|
+
const entries = await fs.promises.readdir(directory, { withFileTypes: true })
|
|
73
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
45
74
|
signal?.throwIfAborted()
|
|
46
75
|
const file = path.join(directory, entry.name)
|
|
47
76
|
const relative = path.relative(root, file)
|
|
48
|
-
if (
|
|
77
|
+
if (excluded(relative)) continue
|
|
49
78
|
hash.update(`${relative}\0`)
|
|
50
|
-
if (entry.isSymbolicLink())
|
|
51
|
-
|
|
52
|
-
else if (entry.
|
|
79
|
+
if (entry.isSymbolicLink())
|
|
80
|
+
hash.update(`link\0${await fs.promises.readlink(file)}\0`)
|
|
81
|
+
else if (entry.isDirectory()) await walk(file)
|
|
82
|
+
else if (entry.isFile()) hash.update(await fs.promises.readFile(file))
|
|
53
83
|
}
|
|
54
84
|
}
|
|
55
|
-
walk(root)
|
|
85
|
+
await walk(root)
|
|
56
86
|
let podVersion: string
|
|
57
87
|
try {
|
|
58
88
|
podVersion = execFileSync('pod', ['--version'], { encoding: 'utf8', env: utf8Env })
|
|
@@ -68,7 +98,55 @@ export function hashExpoWorkspace(
|
|
|
68
98
|
packageManager: manifest.packageManager,
|
|
69
99
|
}),
|
|
70
100
|
)
|
|
71
|
-
return { root, appRelative, hash: hash.digest('hex') }
|
|
101
|
+
return { root, appRelative, hash: hash.digest('hex'), excluded }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// each prepared workspace copies the app's repository with its installed
|
|
105
|
+
// dependencies and pods, often many gigabytes, and every source edit hashes to
|
|
106
|
+
// a new one. a prepare keeps the workspace it returns plus the newest other
|
|
107
|
+
// complete ones and retires the rest; a workspace used within the grace window
|
|
108
|
+
// always stays. a retired tree leaves the address space by rename before it is
|
|
109
|
+
// deleted, so a racing prepare sees a miss and rebuilds.
|
|
110
|
+
const KEPT_WORKSPACES = 2
|
|
111
|
+
const WORKSPACE_GRACE_MS = 3_600_000
|
|
112
|
+
// a prepare that died leaves an incomplete tree only a retry of its own hash
|
|
113
|
+
// would replace; no prepare runs for a day.
|
|
114
|
+
const ABANDONED_WORKSPACE_MS = 24 * 3_600_000
|
|
115
|
+
const RETIRED_PREFIX = '.retired-'
|
|
116
|
+
|
|
117
|
+
function pruneExpoNativeWorkspaces(parent: string, keep: string) {
|
|
118
|
+
const retire = (directory: string, used: number) => {
|
|
119
|
+
const retired = path.join(
|
|
120
|
+
parent,
|
|
121
|
+
`${RETIRED_PREFIX}${process.pid}-${path.basename(directory)}`,
|
|
122
|
+
)
|
|
123
|
+
// a workspace renewed since the scan is in use again.
|
|
124
|
+
if (fs.statSync(directory, { throwIfNoEntry: false })?.mtimeMs !== used) return
|
|
125
|
+
try {
|
|
126
|
+
fs.renameSync(directory, retired)
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return
|
|
129
|
+
throw error
|
|
130
|
+
}
|
|
131
|
+
fs.rmSync(retired, { recursive: true, force: true })
|
|
132
|
+
}
|
|
133
|
+
const complete: { directory: string; used: number }[] = []
|
|
134
|
+
for (const name of fs.readdirSync(parent)) {
|
|
135
|
+
const directory = path.join(parent, name)
|
|
136
|
+
if (name.startsWith(RETIRED_PREFIX)) {
|
|
137
|
+
fs.rmSync(directory, { recursive: true, force: true })
|
|
138
|
+
continue
|
|
139
|
+
}
|
|
140
|
+
const used = fs.statSync(directory, { throwIfNoEntry: false })?.mtimeMs
|
|
141
|
+
if (directory === keep || used === undefined) continue
|
|
142
|
+
if (fs.existsSync(path.join(directory, '.peach-complete')))
|
|
143
|
+
complete.push({ directory, used })
|
|
144
|
+
else if (Date.now() - used > ABANDONED_WORKSPACE_MS) retire(directory, used)
|
|
145
|
+
}
|
|
146
|
+
for (const { directory, used } of complete
|
|
147
|
+
.sort((a, b) => b.used - a.used)
|
|
148
|
+
.slice(KEPT_WORKSPACES - 1))
|
|
149
|
+
if (Date.now() - used > WORKSPACE_GRACE_MS) retire(directory, used)
|
|
72
150
|
}
|
|
73
151
|
|
|
74
152
|
export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSignal) {
|
|
@@ -79,7 +157,7 @@ export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSign
|
|
|
79
157
|
console.error(
|
|
80
158
|
`[expo-native-workspace ${Math.round(performance.now() - started)}ms] ${message}`,
|
|
81
159
|
)
|
|
82
|
-
const { root, appRelative, hash } = hashExpoWorkspace(app, signal)
|
|
160
|
+
const { root, appRelative, hash, excluded } = await hashExpoWorkspace(app, signal)
|
|
83
161
|
const manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
|
|
84
162
|
const appManifest = JSON.parse(fs.readFileSync(path.join(app, 'package.json'), 'utf8'))
|
|
85
163
|
const work = path.join(cacheDir(), 'expo-native-workspaces', hash)
|
|
@@ -97,19 +175,39 @@ export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSign
|
|
|
97
175
|
fs.mkdirSync(path.dirname(work), { recursive: true })
|
|
98
176
|
fs.cpSync(root, partial, {
|
|
99
177
|
recursive: true,
|
|
100
|
-
filter: (source) => !
|
|
178
|
+
filter: (source) => !excluded(path.relative(root, source)),
|
|
101
179
|
})
|
|
102
180
|
fs.renameSync(partial, work)
|
|
103
|
-
// a lifecycle script that installs git hooks needs a repository, and the copy gets its own
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
181
|
+
// a lifecycle script that installs git hooks needs a repository, and the copy gets its own.
|
|
182
|
+
// an app config may read HEAD, so the repository carries one empty commit
|
|
183
|
+
for (const args of [
|
|
184
|
+
['init', '--quiet'],
|
|
185
|
+
[
|
|
186
|
+
'-c',
|
|
187
|
+
'user.name=peach',
|
|
188
|
+
'-c',
|
|
189
|
+
'user.email=peach@localhost',
|
|
190
|
+
'commit',
|
|
191
|
+
'--quiet',
|
|
192
|
+
'--allow-empty',
|
|
193
|
+
'--no-verify',
|
|
194
|
+
'-m',
|
|
195
|
+
'prepared workspace',
|
|
196
|
+
],
|
|
197
|
+
])
|
|
198
|
+
execFileSync('git', args, {
|
|
199
|
+
cwd: work,
|
|
200
|
+
env: { ...process.env, ...isolatedGitEnv },
|
|
201
|
+
// these take milliseconds; a wedged volume must fail loud, never hang discovery
|
|
202
|
+
timeout: 60_000,
|
|
203
|
+
})
|
|
110
204
|
report('copied workspace')
|
|
111
|
-
const run = (
|
|
112
|
-
|
|
205
|
+
const run = (
|
|
206
|
+
command: string,
|
|
207
|
+
args: string[],
|
|
208
|
+
cwd: string,
|
|
209
|
+
env: Record<string, string> = {},
|
|
210
|
+
) => runAdmitted(lease, command, args, cwd, env, signal)
|
|
113
211
|
const manager =
|
|
114
212
|
typeof manifest.packageManager === 'string' ? manifest.packageManager : 'npm'
|
|
115
213
|
const nodeVersion =
|
|
@@ -142,18 +240,38 @@ export async function prepareExpoNativeWorkspace(app: string, signal?: AbortSign
|
|
|
142
240
|
}
|
|
143
241
|
await execute(install, work)
|
|
144
242
|
report('installed js dependencies')
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
)
|
|
243
|
+
const appRequire = createRequire(path.join(preparedApp, 'package.json'))
|
|
244
|
+
// an Expo-free One app declares its iOS project (deployment target
|
|
245
|
+
// included) in native.app, which only its own prebuild reads
|
|
246
|
+
const declares = (name: string) =>
|
|
247
|
+
['dependencies', 'devDependencies'].some((field) =>
|
|
248
|
+
Object.hasOwn(appManifest[field] ?? {}, name),
|
|
249
|
+
)
|
|
250
|
+
const prebuild = declares('expo')
|
|
251
|
+
? [appRequire.resolve('expo/bin/cli'), 'prebuild']
|
|
252
|
+
: [
|
|
253
|
+
path.join(path.dirname(appRequire.resolve('one/package.json')), 'run.mjs'),
|
|
254
|
+
'prebuild',
|
|
255
|
+
]
|
|
148
256
|
await execute(
|
|
149
|
-
['node',
|
|
257
|
+
['node', ...prebuild, '--platform', 'ios', '--no-install'],
|
|
150
258
|
preparedApp,
|
|
151
259
|
)
|
|
152
|
-
report('
|
|
153
|
-
|
|
260
|
+
report('prebuild done')
|
|
261
|
+
// react-native-skia leaves Dawn to react-native-webgpu whenever that package
|
|
262
|
+
// is installed, but autolinking links it only into apps that declare it
|
|
263
|
+
await run(
|
|
264
|
+
'pod',
|
|
265
|
+
['install'],
|
|
266
|
+
path.join(preparedApp, 'ios'),
|
|
267
|
+
declares('react-native-webgpu') ? {} : { RNSKIA_VENDOR_DAWN: '1' },
|
|
268
|
+
)
|
|
154
269
|
report('pod install done')
|
|
155
270
|
fs.writeFileSync(marker, 'complete\n')
|
|
156
271
|
}
|
|
272
|
+
const now = new Date()
|
|
273
|
+
fs.utimesSync(work, now, now)
|
|
274
|
+
pruneExpoNativeWorkspaces(path.dirname(work), work)
|
|
157
275
|
const ios = path.join(preparedApp, 'ios')
|
|
158
276
|
const workspaces = fs
|
|
159
277
|
.readdirSync(ios)
|
|
@@ -171,6 +289,7 @@ async function runAdmitted(
|
|
|
171
289
|
command: string,
|
|
172
290
|
args: string[],
|
|
173
291
|
cwd: string,
|
|
292
|
+
extraEnv: Record<string, string>,
|
|
174
293
|
signal?: AbortSignal,
|
|
175
294
|
) {
|
|
176
295
|
signal?.throwIfAborted()
|
|
@@ -185,6 +304,7 @@ async function runAdmitted(
|
|
|
185
304
|
EXPO_NO_TELEMETRY: '1',
|
|
186
305
|
LANG: 'en_US.UTF-8',
|
|
187
306
|
LC_ALL: 'en_US.UTF-8',
|
|
307
|
+
...extraEnv,
|
|
188
308
|
},
|
|
189
309
|
signal,
|
|
190
310
|
},
|