peachsim 0.1.1716 → 0.1.1728
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 +82 -822
- 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 +750 -0
- package/cli/commands/serve.ts +6 -0
- package/cli/commands/shell-url.ts +834 -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 +13 -6
- package/detox/index.ts +187 -23
- 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 +38000 -31658
- 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 +184 -60
- package/dist-lib/dev-bundle-resolution.cjs +14 -13
- package/dist-lib/expo-swift-bundle.cjs +18199 -11834
- package/dist-lib/expo-swift-metadata.cjs +4 -1
- package/dist-lib/expo-swift-metadata.mjs +3 -1
- package/dist-lib/home-paths.cjs +21 -2
- package/dist-lib/host/bridge-host.cjs +26509 -23850
- package/dist-lib/host/fetch-proxy-handler.cjs +221 -222
- 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 +876 -389
- 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 +127 -16
- 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 +883 -404
- package/dist-lib/native-app-identity-project.cjs +694 -280
- package/dist-lib/native-app-identity-project.mjs +490 -83
- 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 +1 -1
- 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 +392 -224
- package/dist-lib/react-native-host-modules.cjs +32 -2
- package/dist-lib/react-native-host-modules.mjs +32 -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 +61838 -47851
- package/dist-lib/swift-compile.cjs +583 -360
- package/dist-lib/swift-compile.mjs +496 -275
- 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 +4453 -2231
- package/dist-lib/vite.cjs +230 -228
- 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/image-loader.d.ts +7 -5
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -11
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -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/shell-protocol.d.ts +4 -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 +23 -1
- 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/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +12 -25
- 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 +2 -0
- 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.h +75 -9
- 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.modulemap +5 -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/fcntl.h +4 -2
- 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/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 +1 -0
- package/skills/contrast/SKILL.md +2 -1
- package/skills/peach-test/SKILL.md +7 -3
- package/src/admitted-mac-build.ts +3 -0
- package/src/android-app-identity.ts +18 -0
- package/src/android-root-module.ts +9 -9
- package/src/appPackageContract.ts +81 -0
- package/src/bridge-contract.ts +50 -0
- package/src/bundle-channel.mjs +21 -4
- package/src/dev-bundle-resolution.ts +7 -27
- package/src/dom-source-reference.ts +15 -0
- package/src/expo-discovery-cache.ts +127 -23
- package/src/expo-manifest-body.ts +33 -0
- package/src/expo-native-workspace.ts +38 -13
- package/src/expo-swift-host.ts +264 -62
- package/src/expoSwiftContract.ts +3 -0
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +35 -1
- package/src/host/app-package-handler.ts +47 -0
- package/src/host/bridge-host.ts +3 -0
- package/src/host/staged-host-files.ts +18 -0
- package/src/index.ts +3 -0
- package/src/kotlin-host.ts +21 -18
- package/src/kotlin-instance-source.ts +126 -0
- package/src/menu.ts +7 -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/nitro-adapter.lock.json +268 -268
- package/src/nitro-bundle.ts +8 -0
- package/src/nitro-compile.ts +35 -9
- package/src/nitro-dependencies.ts +21 -19
- package/src/nitro-source.ts +4 -0
- package/src/nitroContract.ts +7 -0
- package/src/react-native-bridge-modules.ts +68 -42
- package/src/react-native-host-modules.ts +31 -1
- package/src/reactNativeConfigurationContract.ts +14 -0
- package/src/reap-browser.ts +15 -3
- package/src/sdk.ts +5 -0
- package/src/settingsContract.ts +27 -1
- package/src/sim-client.ts +4 -1
- package/src/storageSnapshotContract.ts +3 -0
- package/src/swift-compile.ts +221 -41
- package/src/swift-coverage/provenance.ts +1 -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 +1 -1
- package/src/swift-cxx-reachable.ts +2 -1
- package/src/swift-distribution.lock.json +14 -13
- package/src/swift-host.ts +95 -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 +592 -57
- package/src/swift-standins.ts +430 -49
- package/src/swift-submit.ts +3 -1
- package/src/swift-toolchain.ts +140 -17
- package/src/turbo-codegen-intake.ts +91 -0
- package/src/vite-plugin-one.ts +13 -9
- package/src/vite-plugin.ts +28 -15
- package/src/xcode-project.ts +223 -22
package/src/swift-submit.ts
CHANGED
|
@@ -119,7 +119,9 @@ export const MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024
|
|
|
119
119
|
// 49: synchronous PDFKit document inspection uses the shared PDF parser host.
|
|
120
120
|
// 50: the PDFKit inspection reply carries each page rotation and crop box.
|
|
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
|
+
// `{ok: true, locked: true}`, distinct from bytes the parser rejects.
|
|
124
|
+
export const SWIFT_HOST_ABI = 52
|
|
123
125
|
|
|
124
126
|
export interface SwiftImageUpload {
|
|
125
127
|
/** the raster file picked for the asset (has the extension). */
|
package/src/swift-toolchain.ts
CHANGED
|
@@ -49,35 +49,157 @@ 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 = '
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
export const SWIFT_HOST_COMPILER_RELEASE = 'swift-6.4.0-RELEASE-custom-0b2d0a9011c88e66'
|
|
53
|
+
export const SWIFT_HOST_COMPILER_ID = '0b2d0a9011c88e66'
|
|
54
|
+
// retain qualification for the published distribution while source builds advance.
|
|
55
|
+
const compilerArchives: Record<
|
|
56
|
+
string,
|
|
57
|
+
{ identity: string; hosts: Record<string, { checksum: string; manifest: string }> }
|
|
58
|
+
> = {
|
|
59
|
+
'swift-6.4.0-RELEASE-custom-ecd2ad9d3fe59329': {
|
|
60
|
+
identity: 'ecd2ad9d3fe59329',
|
|
61
|
+
hosts: {
|
|
62
|
+
'darwin-arm64': {
|
|
63
|
+
checksum: 'ab42a13b34e410ca09737420d1ee1d6af417eec039ab44f9a60502bdb5c76506',
|
|
64
|
+
manifest: '8a93b6b1e6ff577f6dacd81a511d415ca3b396698f9b0c4abc35a4ca807e9d1a',
|
|
65
|
+
},
|
|
66
|
+
'linux-x64': {
|
|
67
|
+
checksum: 'b174baa2c578fb32f09c79590d65d03951b04cdec52101b23a46c0b274249fc3',
|
|
68
|
+
manifest: '330e6cbae5890111c22a58e645049a971eff30334c3f240c650fcfedfeab4ef6',
|
|
69
|
+
},
|
|
70
|
+
'linux-arm64': {
|
|
71
|
+
checksum: '25f722334dd9d79391cb2e47301165e9ef98dd9a8036927652f3c5db3c56b2ae',
|
|
72
|
+
manifest: '94e5667febf26f8a4ee8c5456f83f62d17453e503d261a4c46d2b80f872470ab',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
58
75
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
[SWIFT_HOST_COMPILER_RELEASE]: {
|
|
77
|
+
identity: SWIFT_HOST_COMPILER_ID,
|
|
78
|
+
hosts: {
|
|
79
|
+
'darwin-arm64': {
|
|
80
|
+
checksum: 'dc6a494227297ea657e8e5f7c5b4a861cb5e142bdbcfcb028ace2aeb19db90cc',
|
|
81
|
+
manifest: 'd8e9eee0fb9b847f1e9350525d6c68606df46101745f553332309ed026b3c26a',
|
|
82
|
+
},
|
|
83
|
+
'linux-x64': {
|
|
84
|
+
checksum: '85c04b4496aea1657c21a47f448e01d6ccc1c7920d130a566db37fb8350a7be2',
|
|
85
|
+
manifest: '8451659e74235ad53b700c1afbe293512197900eb98cb1f79e36df2f5c85d511',
|
|
86
|
+
},
|
|
87
|
+
'linux-arm64': {
|
|
88
|
+
checksum: '196606ed62c5c926d18e6ef0769cb1ab21c9943f9084070ddf14a7bc696768b8',
|
|
89
|
+
manifest: '85fb8d5b6527bd75003a6dbd25b68b22540665cf9df9b13f41f82e5d8acdbf1d',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ICU-free libxml2.so.2 the CLI installs into its own toolchain when the host
|
|
96
|
+
// libxml2 moved past the .so.2 soname (Ubuntu 25.04+). built from pinned
|
|
97
|
+
// libxml2-2.9.14 without icu, python or lzma; a rebuild ships under a new
|
|
98
|
+
// versioned prefix, never by replacing these immutable bytes.
|
|
99
|
+
const linuxRuntimeLibs: Record<string, { url: string; checksum: string }> = {
|
|
100
|
+
x64: {
|
|
101
|
+
url: 'https://r2.sootsim.com/swift-linux-runtime/libxml2-2.9.14/x64/libxml2.so.2',
|
|
102
|
+
checksum: 'ae1982f7614096bdbd42301e7acc5f74be2aca295eb603cc81ad55d00ddde763',
|
|
62
103
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
104
|
+
arm64: {
|
|
105
|
+
url: 'https://r2.sootsim.com/swift-linux-runtime/libxml2-2.9.14/arm64/libxml2.so.2',
|
|
106
|
+
checksum: '70acdc2a54328159fdff4ec39f5e75bda7b8301af60698b88d8fa99766252b4b',
|
|
66
107
|
},
|
|
67
108
|
}
|
|
68
109
|
|
|
110
|
+
/** the pinned runtime library blob for a Linux architecture. */
|
|
111
|
+
export function swiftLinuxRuntimeLib(arch: string = process.arch): {
|
|
112
|
+
url: string
|
|
113
|
+
checksum: string
|
|
114
|
+
} {
|
|
115
|
+
const lib = linuxRuntimeLibs[arch]
|
|
116
|
+
if (!lib) throw new Error(`unsupported Swift Linux runtime host ${arch}`)
|
|
117
|
+
return { ...lib }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface SwiftLinuxRuntimePlan {
|
|
121
|
+
url: string
|
|
122
|
+
checksum: string
|
|
123
|
+
/** <root>/usr/lib/libxml2.so.2, reached from both toolchain RUNPATH legs. */
|
|
124
|
+
dest: string
|
|
125
|
+
/** <root>/usr/lib/swift/linux/libxml2.so.2 symlink to dest. */
|
|
126
|
+
link: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* pure decision: the runtime library install plan, or null when the
|
|
131
|
+
* toolchain is out of scope. the install is unconditional on supported
|
|
132
|
+
* Linux hosts: no distro probe, one bundled path. callers pass observed
|
|
133
|
+
* values so the policy stays testable without a Linux host or network.
|
|
134
|
+
*/
|
|
135
|
+
export function swiftLinuxRuntimePlan(options: {
|
|
136
|
+
platform: NodeJS.Platform
|
|
137
|
+
arch: string
|
|
138
|
+
release: string
|
|
139
|
+
root: string
|
|
140
|
+
ownedRoot: string
|
|
141
|
+
}): SwiftLinuxRuntimePlan | null {
|
|
142
|
+
if (options.platform !== 'linux') return null
|
|
143
|
+
if (!options.release.includes('-custom-')) return null
|
|
144
|
+
if (path.resolve(options.root) !== path.resolve(options.ownedRoot)) return null
|
|
145
|
+
const { url, checksum } = swiftLinuxRuntimeLib(options.arch)
|
|
146
|
+
return {
|
|
147
|
+
url,
|
|
148
|
+
checksum,
|
|
149
|
+
dest: path.join(options.root, 'usr/lib/libxml2.so.2'),
|
|
150
|
+
link: path.join(options.root, 'usr/lib/swift/linux/libxml2.so.2'),
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* install the pinned libxml2.so.2 into a Peach-owned Linux toolchain.
|
|
156
|
+
* no-op on other platforms, upstream toolchains, elsewhere-owned trees
|
|
157
|
+
* and missing roots; an existing matching library is kept and relinked.
|
|
158
|
+
*/
|
|
159
|
+
export function ensureSwiftLinuxRuntime(release: string): void {
|
|
160
|
+
if (process.platform !== 'linux' || !release.includes('-custom-')) return
|
|
161
|
+
const root = path.resolve(swiftToolchainBin(release), '../..')
|
|
162
|
+
if (!fs.existsSync(root)) return
|
|
163
|
+
const plan = swiftLinuxRuntimePlan({
|
|
164
|
+
platform: process.platform,
|
|
165
|
+
arch: process.arch,
|
|
166
|
+
release,
|
|
167
|
+
root,
|
|
168
|
+
ownedRoot: path.join(peachHome(), 'swift', 'toolchains', release),
|
|
169
|
+
})
|
|
170
|
+
if (!plan) return
|
|
171
|
+
fs.mkdirSync(path.dirname(plan.dest), { recursive: true })
|
|
172
|
+
fs.mkdirSync(path.dirname(plan.link), { recursive: true })
|
|
173
|
+
if (!fs.existsSync(plan.dest) || swiftFileChecksum(plan.dest) !== plan.checksum) {
|
|
174
|
+
process.stderr.write(`peach: installing Linux runtime libxml2.so.2 into ${root}…\n`)
|
|
175
|
+
const download = `${plan.dest}.${process.pid}.tmp`
|
|
176
|
+
try {
|
|
177
|
+
execFileSync('curl', ['-fsSL', '--show-error', plan.url, '-o', download], {
|
|
178
|
+
stdio: 'inherit',
|
|
179
|
+
})
|
|
180
|
+
if (swiftFileChecksum(download) !== plan.checksum)
|
|
181
|
+
throw new Error('declared Linux runtime checksum mismatch')
|
|
182
|
+
fs.renameSync(download, plan.dest)
|
|
183
|
+
} finally {
|
|
184
|
+
fs.rmSync(download, { force: true })
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
fs.rmSync(plan.link, { force: true })
|
|
188
|
+
fs.symlinkSync('../../libxml2.so.2', plan.link)
|
|
189
|
+
}
|
|
190
|
+
|
|
69
191
|
export function swiftHostCompilerArchive(
|
|
70
192
|
release: string,
|
|
71
193
|
host = `${process.platform}-${process.arch}`,
|
|
72
194
|
) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const archive =
|
|
195
|
+
const compiler = compilerArchives[release]
|
|
196
|
+
if (!compiler) throw new Error(`unqualified host compiler ${release}`)
|
|
197
|
+
const archive = compiler.hosts[host]
|
|
76
198
|
if (!archive) throw new Error(`unsupported Swift compiler host ${host}`)
|
|
77
199
|
return {
|
|
78
200
|
...archive,
|
|
79
|
-
identity:
|
|
80
|
-
url: `https://r2.sootsim.com/swift-host-compiler/${
|
|
201
|
+
identity: compiler.identity,
|
|
202
|
+
url: `https://r2.sootsim.com/swift-host-compiler/${compiler.identity}/${release}-${host}.tar.gz`,
|
|
81
203
|
}
|
|
82
204
|
}
|
|
83
205
|
|
|
@@ -463,6 +585,7 @@ function installSwiftSdkArchive(swift: string, sdk: SwiftWasmSdk, archive: strin
|
|
|
463
585
|
/** verify the compiler and install a declared SDK under the shared store lock. */
|
|
464
586
|
export function installSwiftWasmSdk(release: string, sdk: SwiftWasmSdk): void {
|
|
465
587
|
validateSwiftSdkIdentity(sdk)
|
|
588
|
+
ensureSwiftLinuxRuntime(release)
|
|
466
589
|
try {
|
|
467
590
|
swiftToolchain(release, sdk)
|
|
468
591
|
return
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// the native source an installed app's React Native codegen produces, from the
|
|
2
|
+
// app's own installed react-native. `pod install` runs exactly this script
|
|
3
|
+
// (react_native_pods.rb, codegen_utils.rb), so its output is the real
|
|
4
|
+
// ReactCodegen pod: each library's Spec headers and bindings, the module
|
|
5
|
+
// provider table naming every codegen TurboModule's class, and the podspecs.
|
|
6
|
+
// nothing here reimplements codegen, and nothing under the app is written.
|
|
7
|
+
import { execFile } from 'node:child_process'
|
|
8
|
+
import { createHash } from 'node:crypto'
|
|
9
|
+
import fs from 'node:fs'
|
|
10
|
+
import { createRequire } from 'node:module'
|
|
11
|
+
import path from 'node:path'
|
|
12
|
+
import { promisify } from 'node:util'
|
|
13
|
+
import { isRecord } from './is-record'
|
|
14
|
+
|
|
15
|
+
const run = promisify(execFile)
|
|
16
|
+
|
|
17
|
+
export interface TurboCodegenIntake {
|
|
18
|
+
reactNativeVersion: string
|
|
19
|
+
// <outDir>/build/generated/ios, where CocoaPods finds the generated pods
|
|
20
|
+
generatedRoot: string
|
|
21
|
+
// sha256 of each generated file, keyed by posix path under generatedRoot
|
|
22
|
+
files: Record<string, string>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// sha256 of every file under a directory, keyed by posix relative path
|
|
26
|
+
export function hashTree(root: string): Record<string, string> {
|
|
27
|
+
const hashes: Record<string, string> = {}
|
|
28
|
+
for (const entry of fs.readdirSync(root, { recursive: true, withFileTypes: true })) {
|
|
29
|
+
if (!entry.isFile()) continue
|
|
30
|
+
const file = path.join(entry.parentPath, entry.name)
|
|
31
|
+
hashes[path.relative(root, file).split(path.sep).join('/')] = createHash('sha256')
|
|
32
|
+
.update(fs.readFileSync(file))
|
|
33
|
+
.digest('hex')
|
|
34
|
+
}
|
|
35
|
+
return Object.fromEntries(Object.entries(hashes).sort(([a], [b]) => (a < b ? -1 : 1)))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// the real path of a target that may not exist yet: its nearest existing
|
|
39
|
+
// ancestor resolved, then the missing tail
|
|
40
|
+
function realTarget(target: string): string {
|
|
41
|
+
const resolved = path.resolve(target)
|
|
42
|
+
if (fs.existsSync(resolved)) return fs.realpathSync(resolved)
|
|
43
|
+
return path.join(realTarget(path.dirname(resolved)), path.basename(resolved))
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* runs the app's installed react-native codegen for iOS into outDir, which the
|
|
48
|
+
* caller owns as scratch: it must be new or empty and outside the app, and
|
|
49
|
+
* nothing is ever deleted. it throws with the script's own output when the app
|
|
50
|
+
* has no react-native or the script fails.
|
|
51
|
+
*/
|
|
52
|
+
export async function runInstalledTurboCodegen(
|
|
53
|
+
appRoot: string,
|
|
54
|
+
outDir: string,
|
|
55
|
+
signal?: AbortSignal,
|
|
56
|
+
): Promise<TurboCodegenIntake> {
|
|
57
|
+
const manifestPath = createRequire(path.join(appRoot, 'package.json')).resolve(
|
|
58
|
+
'react-native/package.json',
|
|
59
|
+
)
|
|
60
|
+
const manifest: unknown = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
61
|
+
if (!isRecord(manifest) || typeof manifest.version !== 'string')
|
|
62
|
+
throw new Error(`${manifestPath}: no version`)
|
|
63
|
+
// RCT_SCRIPT_OUTPUT_DIR would move the output out from under outDir
|
|
64
|
+
const env = { ...process.env }
|
|
65
|
+
delete env.RCT_SCRIPT_OUTPUT_DIR
|
|
66
|
+
const app = fs.realpathSync(appRoot)
|
|
67
|
+
const out = realTarget(outDir)
|
|
68
|
+
if (out === app || out.startsWith(app + path.sep))
|
|
69
|
+
throw new Error(`${outDir}: codegen output must be outside the app ${appRoot}`)
|
|
70
|
+
if (fs.existsSync(out) && fs.readdirSync(out).length > 0)
|
|
71
|
+
throw new Error(`${outDir}: codegen output directory must be new or empty`)
|
|
72
|
+
await run(
|
|
73
|
+
'node',
|
|
74
|
+
[
|
|
75
|
+
path.join(path.dirname(manifestPath), 'scripts/generate-codegen-artifacts.js'),
|
|
76
|
+
'-p',
|
|
77
|
+
appRoot,
|
|
78
|
+
'-o',
|
|
79
|
+
outDir,
|
|
80
|
+
'-t',
|
|
81
|
+
'ios',
|
|
82
|
+
],
|
|
83
|
+
{ env, signal },
|
|
84
|
+
)
|
|
85
|
+
const generatedRoot = path.join(outDir, 'build/generated/ios')
|
|
86
|
+
return {
|
|
87
|
+
reactNativeVersion: manifest.version,
|
|
88
|
+
generatedRoot,
|
|
89
|
+
files: hashTree(generatedRoot),
|
|
90
|
+
}
|
|
91
|
+
}
|
package/src/vite-plugin-one.ts
CHANGED
|
@@ -47,6 +47,11 @@ import type { PeachPluginOptions } from './vite'
|
|
|
47
47
|
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
48
48
|
import type { Plugin } from 'vite'
|
|
49
49
|
|
|
50
|
+
function requestAuthority(req: IncomingMessage): string | undefined {
|
|
51
|
+
const authority = req.headers[':authority']
|
|
52
|
+
return req.headers.host ?? (typeof authority === 'string' ? authority : undefined)
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
// a shell on another origin reads only the response headers it is told about
|
|
51
56
|
function exposeHeader(res: ServerResponse, name: string) {
|
|
52
57
|
const exposed = res.getHeader('access-control-expose-headers')
|
|
@@ -151,7 +156,6 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
151
156
|
address.address === '::' || address.address === '0.0.0.0'
|
|
152
157
|
? '127.0.0.1'
|
|
153
158
|
: address.address
|
|
154
|
-
const authority = req.headers[':authority']
|
|
155
159
|
const options: https.RequestOptions = {
|
|
156
160
|
host: loopback,
|
|
157
161
|
port: address.port,
|
|
@@ -161,8 +165,7 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
161
165
|
...Object.fromEntries(
|
|
162
166
|
Object.entries(req.headers).filter(([key]) => !key.startsWith(':')),
|
|
163
167
|
),
|
|
164
|
-
host:
|
|
165
|
-
req.headers.host ?? (typeof authority === 'string' ? authority : undefined),
|
|
168
|
+
host: requestAuthority(req),
|
|
166
169
|
'accept-encoding': 'identity',
|
|
167
170
|
[BUNDLE_SOURCE_REQUEST_HEADER]: '1',
|
|
168
171
|
},
|
|
@@ -194,7 +197,7 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
194
197
|
? https.request(options, respond)
|
|
195
198
|
: http.request(options, respond)
|
|
196
199
|
upstreamReq.once('error', next)
|
|
197
|
-
|
|
200
|
+
res.once('close', () => {
|
|
198
201
|
if (!res.writableFinished) upstreamReq.destroy()
|
|
199
202
|
})
|
|
200
203
|
upstreamReq.end()
|
|
@@ -288,7 +291,7 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
288
291
|
const requestOrigin = (req: IncomingMessage): string =>
|
|
289
292
|
new URL(
|
|
290
293
|
req.url || '/',
|
|
291
|
-
`${server.config.server.https ? 'https' : 'http'}://${req
|
|
294
|
+
`${server.config.server.https ? 'https' : 'http'}://${requestAuthority(req)}`,
|
|
292
295
|
).origin
|
|
293
296
|
const sendSwiftChange = (change: object) => {
|
|
294
297
|
const message = JSON.stringify(change)
|
|
@@ -464,8 +467,9 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
464
467
|
lock && isDaemonLockfileFresh(lock) && lock.bridgePort > 0
|
|
465
468
|
? lock.bridgePort
|
|
466
469
|
: DEFAULT_SOOTSIM_BRIDGE_PORT
|
|
467
|
-
// inject the bridge port + a default bundle
|
|
468
|
-
//
|
|
470
|
+
// inject the bridge port + a default bundle for guest app launches.
|
|
471
|
+
// embedded demo apps select shell content instead of a guest bundle.
|
|
472
|
+
// preserve explicit bundles and the existing query.
|
|
469
473
|
// preserving the query is essential: `peach open` stamps the open URL
|
|
470
474
|
// with `inspectOpen=<token>` and matches the registered sim by that
|
|
471
475
|
// token (waitForSimMatch). the old code forced `?bundle=` only and
|
|
@@ -474,7 +478,7 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
474
478
|
const inject =
|
|
475
479
|
`<script>(function(){var u=new URL(location.href);` +
|
|
476
480
|
`var b=${JSON.stringify(bundleForOrigin(origin))};` +
|
|
477
|
-
`if(!u.searchParams.has('bundle'))u.searchParams.set('bundle',b);` +
|
|
481
|
+
`if(!u.searchParams.has('bundle')&&!u.searchParams.get('demoApp')?.trim())u.searchParams.set('bundle',b);` +
|
|
478
482
|
`window.__sootsimBridgePort=${bridgePort};` +
|
|
479
483
|
`window.__peachPageServingAuthority='contributor';` +
|
|
480
484
|
`history.replaceState(null,'','${prefix}/'+u.search)})()</script>`
|
|
@@ -558,7 +562,7 @@ export function peachPlugin(options: PeachPluginOptions = {}): Plugin {
|
|
|
558
562
|
if (serveBrowserProxyRoute(req, res)) return
|
|
559
563
|
const url = req.url || ''
|
|
560
564
|
const pathname = url.split('?')[0]
|
|
561
|
-
const runtimeRoot = resolveRuntimeRootForRequestHost(req
|
|
565
|
+
const runtimeRoot = resolveRuntimeRootForRequestHost(requestAuthority(req))
|
|
562
566
|
|
|
563
567
|
if (!runtimeRoot) {
|
|
564
568
|
if (
|
package/src/vite-plugin.ts
CHANGED
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
assertPeachPortEnvironment,
|
|
50
50
|
resolveSootsimBridgePort,
|
|
51
51
|
} from './bridge-constants.ts'
|
|
52
|
+
import { DOM_SOURCE_ROOT, domSourceFilename } from './dom-source-reference.ts'
|
|
52
53
|
import { isRecord } from './is-record.ts'
|
|
53
54
|
import {
|
|
54
55
|
SHELL_BRIDGE_IDENTITY_PATH,
|
|
@@ -2465,6 +2466,7 @@ export function expoDomComponentsPlugin(
|
|
|
2465
2466
|
const domHashMap = new Map<string, string>()
|
|
2466
2467
|
const domWebModuleIds = new Set<string>()
|
|
2467
2468
|
const deliveredSources = new Map<string, string>()
|
|
2469
|
+
const portableDomReferencePrefix = `${pathToFileURL(DOM_SOURCE_ROOT).href}/`
|
|
2468
2470
|
let sourcesLoaded = false
|
|
2469
2471
|
|
|
2470
2472
|
function loadDeliveredSources() {
|
|
@@ -2478,7 +2480,10 @@ export function expoDomComponentsPlugin(
|
|
|
2478
2480
|
}
|
|
2479
2481
|
const localUrl = pathToFileURL(path.resolve(projectRoot, relativePath)).href
|
|
2480
2482
|
deliveredSources.set(reference, localUrl)
|
|
2481
|
-
domHashMap.set(
|
|
2483
|
+
domHashMap.set(
|
|
2484
|
+
crypto.createHash('md5').update(reference).digest('hex'),
|
|
2485
|
+
reference,
|
|
2486
|
+
)
|
|
2482
2487
|
}
|
|
2483
2488
|
}
|
|
2484
2489
|
sourcesLoaded = true
|
|
@@ -2584,15 +2589,13 @@ export function expoDomComponentsPlugin(
|
|
|
2584
2589
|
},
|
|
2585
2590
|
generateBundle() {
|
|
2586
2591
|
const sources = Object.fromEntries(
|
|
2587
|
-
[...
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
reference
|
|
2591
|
-
path
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
.join('/'),
|
|
2595
|
-
]),
|
|
2592
|
+
[...deliveredSources.keys()].sort().map((reference) => [
|
|
2593
|
+
reference,
|
|
2594
|
+
path
|
|
2595
|
+
.relative(projectRoot, fileURLToPath(deliveredSources.get(reference)!))
|
|
2596
|
+
.split(path.sep)
|
|
2597
|
+
.join('/'),
|
|
2598
|
+
]),
|
|
2596
2599
|
)
|
|
2597
2600
|
this.emitFile({
|
|
2598
2601
|
type: 'asset',
|
|
@@ -2936,10 +2939,15 @@ export default NoopMetroHMRClient;
|
|
|
2936
2939
|
const params = new URLSearchParams(query)
|
|
2937
2940
|
loadDeliveredSources()
|
|
2938
2941
|
const reference = params.get('file')
|
|
2939
|
-
|
|
2940
|
-
if (!fileUrl) {
|
|
2942
|
+
if (!reference) {
|
|
2941
2943
|
throw new Error(`Missing file query param in DOM component entry: ${id}`)
|
|
2942
2944
|
}
|
|
2945
|
+
// a portable reference names no checkout path: only the delivered
|
|
2946
|
+
// manifest or this server's own transforms can resolve it.
|
|
2947
|
+
const fileUrl = deliveredSources.get(reference) ?? reference
|
|
2948
|
+
if (fileUrl === reference && reference.startsWith(portableDomReferencePrefix)) {
|
|
2949
|
+
throw new Error(`DOM component source is not delivered: ${reference}`)
|
|
2950
|
+
}
|
|
2943
2951
|
let targetPath: string
|
|
2944
2952
|
try {
|
|
2945
2953
|
targetPath = fileUrl.startsWith('file:') ? fileURLToPath(fileUrl) : fileUrl
|
|
@@ -3032,12 +3040,14 @@ registerDOMComponent(Component);
|
|
|
3032
3040
|
'babel-preset-expo/build/plugins/use-dom-directive-plugin',
|
|
3033
3041
|
)
|
|
3034
3042
|
|
|
3035
|
-
const
|
|
3043
|
+
const filename = domSourceFilename(projectRoot, cleanId)
|
|
3044
|
+
const fileUrl = pathToFileURL(filename).href
|
|
3036
3045
|
const hash = crypto.createHash('md5').update(fileUrl).digest('hex')
|
|
3037
3046
|
domHashMap.set(hash, fileUrl)
|
|
3047
|
+
deliveredSources.set(fileUrl, pathToFileURL(cleanId).href)
|
|
3038
3048
|
|
|
3039
3049
|
const result = await transformAsync(code, {
|
|
3040
|
-
filename
|
|
3050
|
+
filename,
|
|
3041
3051
|
babelrc: false,
|
|
3042
3052
|
configFile: false,
|
|
3043
3053
|
sourceMaps: true,
|
|
@@ -3045,7 +3055,10 @@ registerDOMComponent(Component);
|
|
|
3045
3055
|
name: 'peachsim',
|
|
3046
3056
|
platform: 'ios',
|
|
3047
3057
|
isDev: !isProduction,
|
|
3048
|
-
projectRoot
|
|
3058
|
+
projectRoot:
|
|
3059
|
+
cleanId.includes(projectRoot) && !cleanId.includes('node_modules')
|
|
3060
|
+
? DOM_SOURCE_ROOT
|
|
3061
|
+
: '',
|
|
3049
3062
|
},
|
|
3050
3063
|
presets: isTS
|
|
3051
3064
|
? [
|