peachsim 0.1.1654 → 0.1.1659
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/app-config.ts +4 -0
- package/cli/app-stubs.ts +43 -6
- package/cli/commands/inspect/shared.ts +5 -2
- package/cli/commands/inspect/url.ts +2 -1
- package/cli/commands/screenshot.ts +5 -5
- package/cli/commands/state.ts +9 -6
- package/cli/outbound-endpoints.ts +9 -1
- package/cli/output-redaction.ts +49 -0
- 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 +11485 -1316
- 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 +29 -5
- package/dist-lib/config.mjs +29 -5
- package/dist-lib/detox/index.cjs +19 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +9194 -327
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +10137 -1043
- package/dist-lib/host/fetch-proxy-handler.cjs +260 -182
- 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 +653 -338
- 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 +443 -312
- 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 +548 -163
- package/dist-lib/native-app-identity-project.cjs +179 -33
- package/dist-lib/native-app-identity-project.mjs +179 -33
- 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 +1 -1
- 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 +96 -63
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +10885 -1596
- package/dist-lib/swift-compile.cjs +9036 -331
- package/dist-lib/swift-compile.mjs +9036 -331
- 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 +9194 -327
- package/dist-lib/vite.cjs +149 -163
- 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-gesture-handler.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-seam-protocol.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +5 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +25 -0
- package/kotlin/README.md +38 -23
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -12
- package/runtime-companion.json +1 -1
- package/src/bundleGlobalFooter.ts +0 -2
- package/src/config.ts +54 -2
- package/src/configured-bundle-producer.ts +7 -1
- package/src/host/fetch-proxy-handler.ts +14 -33
- package/src/host/rolldown-bundle-forward.ts +71 -0
- package/src/installed-package-versions.ts +54 -2
- package/src/kotlin-host.ts +138 -285
- package/src/kotlin-module.ts +4 -7
- package/src/kotlin-sdk.ts +81 -0
- package/src/kotlin-toolchain.ts +152 -0
- package/src/kotlin-view-models.ts +1 -1
- package/src/kotlinSdkContract.ts +113 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/nitro-bundle.ts +18 -4
- package/src/nitro-compile.ts +5 -1
- package/src/nitro-source.ts +112 -28
- package/src/nitroContract.ts +16 -4
- package/src/swift-compile.ts +295 -237
- package/src/swift-host.ts +2 -1
- package/src/swift-objc-compile.ts +117 -4
- package/src/swift-objc-sdk.ts +8792 -135
- package/src/swift-objc-standin.ts +1 -0
- package/src/swiftContract.ts +2 -0
- package/src/vite-plugin-one.ts +73 -134
- package/src/worker-system-chunks.ts +14 -4
- package/src/xcode-project.ts +261 -34
- package/kotlin/AndroidViewSources/android/content/Context.kt +0 -22
- package/kotlin/AndroidViewSources/android/content/res/Configuration.kt +0 -25
- package/kotlin/AndroidViewSources/android/content/res/Resources.kt +0 -72
- package/kotlin/AndroidViewSources/android/graphics/Canvas.kt +0 -22
- package/kotlin/AndroidViewSources/android/graphics/Color.kt +0 -13
- package/kotlin/AndroidViewSources/android/graphics/Paint.kt +0 -18
- package/kotlin/AndroidViewSources/android/util/DisplayMetrics.kt +0 -12
- package/kotlin/AndroidViewSources/android/view/View.kt +0 -211
- package/kotlin/AndroidViewSources/android/widget/FrameLayout.kt +0 -61
- package/kotlin/AndroidViewSources/android/widget/LinearLayout.kt +0 -49
- package/kotlin/AndroidViewSources/dev/peach/app/JavaFormat.kt +0 -272
- package/kotlin/AppSources/android/app/Activity.kt +0 -174
- package/kotlin/AppSources/android/app/Application.kt +0 -11
- package/kotlin/AppSources/android/app/UiModeManager.kt +0 -9
- package/kotlin/AppSources/android/content/Intent.kt +0 -16
- package/kotlin/AppSources/android/os/Bundle.kt +0 -11
- package/kotlin/AppSources/android/util/SuperNotCalledException.kt +0 -3
- package/kotlin/AppSources/android/view/Window.kt +0 -182
- package/kotlin/AppSources/android/view/WindowInsets.kt +0 -9
- package/kotlin/AppSources/android/view/WindowInsetsController.kt +0 -17
- package/kotlin/AppSources/android/view/WindowManager.kt +0 -16
- package/kotlin/AppSources/android/window/BackEvent.kt +0 -24
- package/kotlin/AppSources/android/window/OnBackAnimationCallback.kt +0 -7
- package/kotlin/AppSources/android/window/OnBackInvokedDispatcher.kt +0 -84
- package/kotlin/AppSources/androidx/activity/ActivityFlags.kt +0 -9
- package/kotlin/AppSources/androidx/activity/ActivityViewModelLazy.kt +0 -21
- package/kotlin/AppSources/androidx/activity/BackEventCompat.kt +0 -43
- package/kotlin/AppSources/androidx/activity/ComponentActivity.kt +0 -122
- package/kotlin/AppSources/androidx/activity/EdgeToEdge.kt +0 -75
- package/kotlin/AppSources/androidx/activity/ExperimentalActivityApi.kt +0 -6
- package/kotlin/AppSources/androidx/activity/OnBackPressedCallback.kt +0 -69
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcher.kt +0 -144
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcherOwner.kt +0 -7
- package/kotlin/AppSources/androidx/activity/compose/BackHandler.kt +0 -86
- package/kotlin/AppSources/androidx/activity/compose/ComponentActivity.kt +0 -29
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerCompat.kt +0 -38
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerDispatcherCompat.kt +0 -27
- package/kotlin/AppSources/androidx/compose/foundation/layout/WindowInsets.kt +0 -15
- package/kotlin/AppSources/androidx/compose/ui/platform/AndroidCompositionLocals.kt +0 -27
- package/kotlin/AppSources/androidx/compose/ui/platform/ComposeView.kt +0 -68
- package/kotlin/AppSources/androidx/compose/ui/res/ColorResources.kt +0 -16
- package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +0 -70
- package/kotlin/AppSources/androidx/compose/ui/res/StringResources.kt +0 -38
- package/kotlin/AppSources/androidx/core/view/WindowCompat.kt +0 -32
- package/kotlin/AppSources/androidx/lifecycle/AndroidViewModel.kt +0 -10
- package/kotlin/AppSources/dev/peach/app/PeachApp.kt +0 -388
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +0 -102
- package/kotlin/AppSources/dev/peach/app/PeachWindowHost.kt +0 -14
- package/kotlin/CompilerSources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +0 -1
- package/kotlin/CompilerSources/PeachJniIncoming.kt +0 -243
- package/kotlin/CompilerSources/PeachJniPlugin.kt +0 -116
- package/kotlin/ComposeSources/PeachComposeHost.kt +0 -724
- package/kotlin/ComposeSources/PeachMagnifier.kt +0 -185
- package/kotlin/ComposeSources/PeachSemantics.kt +0 -127
- package/kotlin/ExpoComposeSources/PeachAndroidView.kt +0 -103
- package/kotlin/ExpoComposeSources/PeachExpoViewMount.kt +0 -24
- package/kotlin/ExpoComposeSources/dev/peach/expo/PeachExpoCompose.kt +0 -28
- package/kotlin/ExpoComposeSources/expo/modules/kotlin/views/ExpoComposeView.kt +0 -70
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoRuntime.kt +0 -516
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoTypes.kt +0 -173
- package/kotlin/ExpoSources/expo/modules/kotlin/AppContext.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/Promise.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +0 -198
- package/kotlin/ExpoSources/expo/modules/kotlin/exception/CodedException.kt +0 -126
- package/kotlin/ExpoSources/expo/modules/kotlin/functions/Functions.kt +0 -132
- package/kotlin/ExpoSources/expo/modules/kotlin/jni/JavaScriptTypedArray.kt +0 -81
- package/kotlin/ExpoSources/expo/modules/kotlin/modules/Module.kt +0 -98
- package/kotlin/ExpoSources/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +0 -236
- package/kotlin/ExpoSources/expo/modules/kotlin/records/Record.kt +0 -12
- package/kotlin/ExpoSources/expo/modules/kotlin/runtime/Runtime.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObject.kt +0 -50
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +0 -57
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedRef.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/ConcreteTypedArrays.kt +0 -158
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/GenericTypedArray.kt +0 -8
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArray.kt +0 -29
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArrayIterator.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/types/AnyType.kt +0 -155
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Either.kt +0 -91
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Enumerable.kt +0 -6
- package/kotlin/ExpoSources/expo/modules/kotlin/viewevent/ViewEvent.kt +0 -68
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ExpoView.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +0 -72
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewProps.kt +0 -36
- package/kotlin/JniPlatformSources/androidx/annotation/CallSuper.kt +0 -5
- package/kotlin/JniPlatformSources/com/facebook/proguard/annotations/DoNotStrip.kt +0 -5
- package/kotlin/JniPlatformSources/dalvik/annotation/optimization/FastNative.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/Synchronized.kt +0 -6
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmField.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmStatic.kt +0 -5
- package/kotlin/JniSources/com/facebook/jni/HybridData.kt +0 -66
- package/kotlin/JniSources/dev/peach/jni/IncomingBindings.kt +0 -157
- package/kotlin/JniSources/dev/peach/jni/NativeBindings.kt +0 -77
- package/kotlin/JniTransportSources/dev/peach/jni/integration/JniTransport.kt +0 -89
- package/kotlin/Sources/android/os/Build.kt +0 -17
- package/kotlin/Sources/android/os/Handler.kt +0 -35
- package/kotlin/Sources/android/os/Looper.kt +0 -17
- package/kotlin/Sources/android/os/MessageQueue.kt +0 -56
- package/kotlin/Sources/android/os/SystemClock.kt +0 -14
- package/kotlin/Sources/android/util/Log.kt +0 -64
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +0 -14
- package/kotlin/Sources/androidx/annotation/Keep.kt +0 -4
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceDispatch.kt +0 -7
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceViewDispatch.kt +0 -13
- package/kotlin/Sources/dev/onejs/one/source/OneModule.kt +0 -4
- package/kotlin/Sources/java/lang/Runnable.kt +0 -6
- package/kotlin/Sources/java/security/MessageDigest.kt +0 -114
- package/kotlin/Sources/java/util/IllegalFormatCodePointException.kt +0 -10
- package/kotlin/Sources/java/util/IllegalFormatException.kt +0 -5
- package/kotlin/Sources/kotlin/text/StringFormat.kt +0 -9
- package/kotlin/Sources/org/json/JSON.kt +0 -307
- package/kotlin/tools/abi-classes.main.kts +0 -41
- package/kotlin/tools/expo-types.main.kts +0 -127
package/kotlin/README.md
CHANGED
|
@@ -26,29 +26,43 @@ traffic in `scripts/debug/peach-swift-lazy-network.sh`.
|
|
|
26
26
|
`java.security.MessageDigest` for SHA-256, the `%02x` Byte formatter,
|
|
27
27
|
`androidx.annotation.Keep`, `dev.onejs.one.OneNativeSourceDispatch` and
|
|
28
28
|
`dev.onejs.one.source.OneModule`. Kotlin/Wasm has no implicit `java.lang`
|
|
29
|
-
import, so app sources import `java.lang.Runnable` explicitly. `
|
|
30
|
-
adds the activity
|
|
29
|
+
import, so app sources import `java.lang.Runnable` explicitly. `ComposeSources/` holds the shared view host and back-dispatch contracts.
|
|
30
|
+
`AppSources/` adds the activity and window implementation only pure Kotlin apps link.
|
|
31
31
|
- `ExpoSources/`: the expo-modules-core Kotlin DSL port and `PeachExpoRuntime`
|
|
32
32
|
that local Expo Android modules compile against. Owner spec:
|
|
33
33
|
[`specs/peach-kotlin-expo-modules.md`](../../../specs/peach-kotlin-expo-modules.md).
|
|
34
|
-
- `CompilerSources/`: the native member compiler plugin and
|
|
35
|
-
registration.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
and virtual calls, actual constructors and backing-field access. Native static
|
|
43
|
-
companion calls preserve the enclosing JVM owner and null receiver. The
|
|
34
|
+
- `CompilerSources/`: the native member compiler plugin and JVM service
|
|
35
|
+
registration. Release producers compile it to `plugin.jar`; clients load that
|
|
36
|
+
jar without compiling or receiving plugin source. `ToolSources/` builds
|
|
37
|
+
`tools.jar` for the existing Expo type scan and ViewModel ABI scan.
|
|
38
|
+
`JniPlatformSources/` and `JniSources/` supply platform declarations and the
|
|
39
|
+
native invocation runtime. Incoming JNI lookup retains stable IDs, private
|
|
40
|
+
and virtual calls, constructors and backing fields. Native static companion
|
|
41
|
+
calls preserve the enclosing JVM owner and null receiver. The
|
|
44
42
|
[binding contract](../../../docs/research/peach/kotlin-native-bindings.md)
|
|
45
|
-
owns
|
|
43
|
+
owns APIs, holder lifetime and unsupported forms.
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
and
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
`packages/peachsim/scripts/build-kotlin-sdk.ts` builds `sdk.tar.gz` from private
|
|
46
|
+
sources and the pinned compiler. It contains only compiled JVM jars, Wasm KLIB
|
|
47
|
+
profiles and an exact binary manifest. The profiles match module, JNI, Compose
|
|
48
|
+
view, Expo and pure-app source sets. The app compiler links one profile and
|
|
49
|
+
compiles only guest sources and generated glue. Generated initialization
|
|
50
|
+
registers SDK bindings before app bindings and supplies app-owned view dispatch
|
|
51
|
+
and resources explicitly. Internal JNI names retain their original JVM module
|
|
52
|
+
identity when SDK code moves into a library. SDK module names remain distinct
|
|
53
|
+
from the guest app module. Exact final property/method forwarding aliases share
|
|
54
|
+
one JNI registration; conflicting implementations fail compilation.
|
|
55
|
+
|
|
56
|
+
The compiler plugin resolves the guest's `kotlin.jvm.JvmStatic`, `JvmField` and `JvmName`
|
|
57
|
+
imports to the SDK's compiled platform annotations. Each guest gets local
|
|
58
|
+
compiler aliases to that single definition, retaining the annotation targets
|
|
59
|
+
and binary retention without duplicating annotation classes across libraries.
|
|
60
|
+
|
|
61
|
+
The manifest binds compiler, source-input digest, binary names, sizes and SHA256
|
|
62
|
+
hashes. Archive installs verify that exact flat inventory and atomically publish
|
|
63
|
+
under a content-addressed cache. Matching artifact keys reuse compiled output;
|
|
64
|
+
SDK keys bind all producer and SDK source bytes. Client artifact keys bind the
|
|
65
|
+
SDK archive, selected profile, toolchain/language pins, guest sources and glue.
|
|
52
66
|
|
|
53
67
|
The dev server compiles every `.kt` source of the app, One's glue for each and
|
|
54
68
|
a generated entry into one Kotlin/Wasm module, held to the Kotlin language
|
|
@@ -73,8 +87,9 @@ browser worker with no document, after official Skiko initializes. This proves
|
|
|
73
87
|
runtime behavior, with no Compose UI or Android pixel grade. UI fixtures still
|
|
74
88
|
use the paired Compose oracle.
|
|
75
89
|
|
|
76
|
-
The npm package publishes
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
and development fixtures remain in private Git. The package smoke
|
|
80
|
-
|
|
90
|
+
The npm package publishes `sdk.tar.gz`, `toolchain.json`, this documentation
|
|
91
|
+
and fork licenses and notices. The standalone embeds those same binary SDK and
|
|
92
|
+
toolchain bytes. Raw Kotlin SDK sources, compiler sources, JVM tool sources,
|
|
93
|
+
fork recipes and development fixtures remain in private Git. The package smoke
|
|
94
|
+
check verifies the compiled archive and rejects raw SDK inputs in actual npm
|
|
95
|
+
payloads, including a supplied tarball.
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peachsim",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1659",
|
|
4
4
|
"description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
|
|
5
5
|
"author": "Tamagui LLC",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -317,17 +317,7 @@
|
|
|
317
317
|
"runtime-companion.json",
|
|
318
318
|
"src/",
|
|
319
319
|
"cli/",
|
|
320
|
-
"kotlin/
|
|
321
|
-
"kotlin/AppSources/",
|
|
322
|
-
"kotlin/CompilerSources/",
|
|
323
|
-
"kotlin/ComposeSources/",
|
|
324
|
-
"kotlin/ExpoComposeSources/",
|
|
325
|
-
"kotlin/ExpoSources/",
|
|
326
|
-
"kotlin/JniPlatformSources/",
|
|
327
|
-
"kotlin/JniSources/",
|
|
328
|
-
"kotlin/JniTransportSources/",
|
|
329
|
-
"kotlin/Sources/",
|
|
330
|
-
"kotlin/tools/",
|
|
320
|
+
"kotlin/sdk.tar.gz",
|
|
331
321
|
"kotlin/toolchain.json",
|
|
332
322
|
"kotlin/README.md",
|
|
333
323
|
"kotlin/fork/LICENSE",
|
package/runtime-companion.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":1,"sha256":"
|
|
1
|
+
{"abi":1,"sha256":"59277122bc52023de2774e83d48eb795f32324c06d15d9780c8d827791bea7c6","file":"node/cli-59277122bc52023de2774e83d48eb795f32324c06d15d9780c8d827791bea7c6.cjs"}
|
|
@@ -68,8 +68,6 @@ export function readBundleGlobalFooter(source: string, name: string): unknown {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// transport metadata is parsed before evaluation and has no guest JS effect.
|
|
71
|
-
export const ROLLDOWN_INVENTORY_HEADER = 'X-Peach-Rolldown-Inventory'
|
|
72
|
-
|
|
73
71
|
export function readBundleMetadataFooter(source: string, name: string): unknown {
|
|
74
72
|
return readFooter(source, `// peach.${name}=`, '', name)
|
|
75
73
|
}
|
package/src/config.ts
CHANGED
|
@@ -42,6 +42,41 @@ export type NativeViewResolution = 'noop' | { file: string } | NativeViewSource
|
|
|
42
42
|
// them.
|
|
43
43
|
export type NativeStub = string
|
|
44
44
|
|
|
45
|
+
// what answers one Nitro HybridObject name: 'unsupported' (this Peach build
|
|
46
|
+
// registers no constructor) or a file whose default export is the factory for
|
|
47
|
+
// the object. 'noop' would invent a native object (specs/peach-app-stubs.md).
|
|
48
|
+
export type HybridObjectAnswer = 'unsupported' | { file: string }
|
|
49
|
+
|
|
50
|
+
function isHybridObjectAnswer(answer: unknown): answer is HybridObjectAnswer {
|
|
51
|
+
return (
|
|
52
|
+
answer === 'unsupported' ||
|
|
53
|
+
(isRecord(answer) && typeof answer.file === 'string' && answer.file.length > 0)
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isHybridObjects(value: unknown): value is Record<string, HybridObjectAnswer> {
|
|
58
|
+
return (
|
|
59
|
+
isRecord(value) &&
|
|
60
|
+
Object.entries(value).every(
|
|
61
|
+
([name, answer]) => name.length > 0 && isHybridObjectAnswer(answer),
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// a package answers 'unsupported' or the path of a factory file
|
|
67
|
+
function isPackageHybridObjects(value: unknown): value is Record<string, string> {
|
|
68
|
+
return (
|
|
69
|
+
isRecord(value) &&
|
|
70
|
+
Object.entries(value).every(
|
|
71
|
+
([name, answer]) =>
|
|
72
|
+
name.length > 0 &&
|
|
73
|
+
typeof answer === 'string' &&
|
|
74
|
+
answer.length > 0 &&
|
|
75
|
+
answer !== 'noop',
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
45
80
|
// the stubs for one package's native side, keyed by the names its JavaScript
|
|
46
81
|
// asks for. a whole-package 'noop' answers every name the installed package
|
|
47
82
|
// requests. the same shape is a published stub package's `peach` field
|
|
@@ -51,6 +86,7 @@ export type PackageStubs =
|
|
|
51
86
|
| {
|
|
52
87
|
modules?: Record<string, NativeStub>
|
|
53
88
|
views?: Record<string, NativeStub | NativeViewSource>
|
|
89
|
+
hybridObjects?: Record<string, string>
|
|
54
90
|
}
|
|
55
91
|
|
|
56
92
|
export function isPackageStubs(value: unknown): value is PackageStubs {
|
|
@@ -67,7 +103,8 @@ export function isPackageStubs(value: unknown): value is PackageStubs {
|
|
|
67
103
|
Object.values(value.views).every(
|
|
68
104
|
(stub) =>
|
|
69
105
|
(typeof stub === 'string' && stub.length > 0) || isNativeViewSource(stub),
|
|
70
|
-
)))
|
|
106
|
+
))) &&
|
|
107
|
+
(value.hybridObjects === undefined || isPackageHybridObjects(value.hybridObjects))
|
|
71
108
|
)
|
|
72
109
|
}
|
|
73
110
|
|
|
@@ -86,6 +123,7 @@ export interface PeachConfig<Settings extends Record<string, any> = Record<strin
|
|
|
86
123
|
turboModules?: Record<string, NativeModuleResolution>
|
|
87
124
|
nativeModules?: Record<string, NativeModuleResolution>
|
|
88
125
|
nativeViews?: Record<string, NativeViewResolution>
|
|
126
|
+
nativeHybridObjects?: Record<string, HybridObjectAnswer>
|
|
89
127
|
env?: Record<string, string>
|
|
90
128
|
// generic per-sim network rewrites for the guest app's runtime fetches.
|
|
91
129
|
// `remap` keys/values are `host:port` (or bare `host`) — a tenant fetch whose
|
|
@@ -117,7 +155,13 @@ export const PEACH_CONFIG_QUERY_PARAM = 'peachConfig'
|
|
|
117
155
|
export function collectConfiguredFileModules(config?: PeachConfig): string[] {
|
|
118
156
|
return [
|
|
119
157
|
...new Set(
|
|
120
|
-
[
|
|
158
|
+
[
|
|
159
|
+
'modules',
|
|
160
|
+
'turboModules',
|
|
161
|
+
'nativeModules',
|
|
162
|
+
'nativeViews',
|
|
163
|
+
'nativeHybridObjects',
|
|
164
|
+
].flatMap((key) => {
|
|
121
165
|
const entries: unknown = config && Reflect.get(config, key)
|
|
122
166
|
if (!isRecord(entries)) return []
|
|
123
167
|
return Object.values(entries).flatMap((entry) =>
|
|
@@ -151,6 +195,7 @@ export function isPeachConfig<Settings extends Record<string, any> = Record<stri
|
|
|
151
195
|
'turboModules',
|
|
152
196
|
'nativeModules',
|
|
153
197
|
'nativeViews',
|
|
198
|
+
'nativeHybridObjects',
|
|
154
199
|
'env',
|
|
155
200
|
'network',
|
|
156
201
|
'settings',
|
|
@@ -160,6 +205,8 @@ export function isPeachConfig<Settings extends Record<string, any> = Record<stri
|
|
|
160
205
|
(value.packages === undefined ||
|
|
161
206
|
(isRecord(value.packages) &&
|
|
162
207
|
Object.values(value.packages).every(isPackageStubs))) &&
|
|
208
|
+
(value.nativeHybridObjects === undefined ||
|
|
209
|
+
isHybridObjects(value.nativeHybridObjects)) &&
|
|
163
210
|
(value.nativeViews === undefined ||
|
|
164
211
|
(isRecord(value.nativeViews) &&
|
|
165
212
|
Object.values(value.nativeViews).every(
|
|
@@ -249,6 +296,7 @@ export function hasPeachConfig<
|
|
|
249
296
|
hasOwnKeys(config.turboModules as Record<string, unknown> | undefined) ||
|
|
250
297
|
hasOwnKeys(config.nativeModules as Record<string, unknown> | undefined) ||
|
|
251
298
|
hasOwnKeys(config.nativeViews) ||
|
|
299
|
+
hasOwnKeys(config.nativeHybridObjects) ||
|
|
252
300
|
hasOwnKeys(config.env as Record<string, unknown> | undefined) ||
|
|
253
301
|
hasOwnKeys(config.network?.remap as Record<string, unknown> | undefined) ||
|
|
254
302
|
hasOwnKeys(config.settings as Record<string, unknown> | undefined) ||
|
|
@@ -278,6 +326,10 @@ export function mergePeachConfig<
|
|
|
278
326
|
...(override.nativeModules || {}),
|
|
279
327
|
},
|
|
280
328
|
nativeViews: { ...(base.nativeViews || {}), ...(override.nativeViews || {}) },
|
|
329
|
+
nativeHybridObjects: {
|
|
330
|
+
...(base.nativeHybridObjects || {}),
|
|
331
|
+
...(override.nativeHybridObjects || {}),
|
|
332
|
+
},
|
|
281
333
|
env: { ...(base.env || {}), ...(override.env || {}) },
|
|
282
334
|
network: {
|
|
283
335
|
remap: { ...(base.network?.remap || {}), ...(override.network?.remap || {}) },
|
|
@@ -61,7 +61,13 @@ export async function produceConfiguredBundle(
|
|
|
61
61
|
)
|
|
62
62
|
return id
|
|
63
63
|
}
|
|
64
|
-
for (const key of [
|
|
64
|
+
for (const key of [
|
|
65
|
+
'modules',
|
|
66
|
+
'turboModules',
|
|
67
|
+
'nativeModules',
|
|
68
|
+
'nativeViews',
|
|
69
|
+
'nativeHybridObjects',
|
|
70
|
+
]) {
|
|
65
71
|
const entries: unknown = Reflect.get(packagedConfig, key)
|
|
66
72
|
if (!entries || typeof entries !== 'object') continue
|
|
67
73
|
for (const resolution of Object.values(entries)) {
|
|
@@ -33,8 +33,6 @@ import {
|
|
|
33
33
|
isTrustedBridgeRequest,
|
|
34
34
|
normalizeHostname,
|
|
35
35
|
} from '../backend-origin.ts'
|
|
36
|
-
import { ROLLDOWN_INVENTORY_HEADER } from '../bundleGlobalFooter.ts'
|
|
37
|
-
import { getCliRuntime } from '../cli-runtime.ts'
|
|
38
36
|
import { PACKAGE_VERSIONS_HEADER } from '../packageVersionsContract'
|
|
39
37
|
import { readDevServerPackageVersions } from './dev-server-package-versions.ts'
|
|
40
38
|
import {
|
|
@@ -51,6 +49,7 @@ import {
|
|
|
51
49
|
resolveRedirectUrl,
|
|
52
50
|
} from './fetch-proxy-overrides.ts'
|
|
53
51
|
import { projectLoopbackPort } from './loopback-ports.ts'
|
|
52
|
+
import { forwardRolldownBundleResponse } from './rolldown-bundle-forward.ts'
|
|
54
53
|
|
|
55
54
|
type FetchProxyRequest = IncomingMessage | Http2ServerRequest
|
|
56
55
|
type FetchProxyResponse = ServerResponse | Http2ServerResponse
|
|
@@ -220,6 +219,15 @@ export async function handleFetchProxyRequest(
|
|
|
220
219
|
return
|
|
221
220
|
}
|
|
222
221
|
|
|
222
|
+
// the project's installed versions are read while the server builds the
|
|
223
|
+
// bundle, so a bundle that records none does not wait on the read after it.
|
|
224
|
+
const packageVersionsRead =
|
|
225
|
+
isBundleProxyRequestUrl(req.url) && req.method === 'GET'
|
|
226
|
+
? readDevServerPackageVersions(upstreamUrl)
|
|
227
|
+
: null
|
|
228
|
+
// a read the response never awaits must not surface as an unhandled rejection
|
|
229
|
+
packageVersionsRead?.catch(() => {})
|
|
230
|
+
|
|
223
231
|
await proxyUpstream(req, res, upstreamUrl, params.has(FETCH_PROXY_FAILURE_PARAM), {
|
|
224
232
|
requestHeaders: (target) => buildFetchProxyHeaders(req.headers, target),
|
|
225
233
|
respond: async (upstream, setCookies) => {
|
|
@@ -246,25 +254,14 @@ export async function handleFetchProxyRequest(
|
|
|
246
254
|
}
|
|
247
255
|
// a bundle whose server records no install gets the one its project holds
|
|
248
256
|
if (
|
|
249
|
-
|
|
250
|
-
req.method === 'GET' &&
|
|
257
|
+
packageVersionsRead &&
|
|
251
258
|
upstream.statusCode === 200 &&
|
|
252
259
|
!res.hasHeader(PACKAGE_VERSIONS_HEADER)
|
|
253
260
|
) {
|
|
254
|
-
const packageVersions = await
|
|
261
|
+
const packageVersions = await packageVersionsRead
|
|
255
262
|
if (packageVersions)
|
|
256
263
|
res.setHeader(PACKAGE_VERSIONS_HEADER, JSON.stringify(packageVersions))
|
|
257
264
|
}
|
|
258
|
-
if (
|
|
259
|
-
isBundleProxyRequestUrl(req.url) &&
|
|
260
|
-
req.method === 'GET' &&
|
|
261
|
-
upstream.statusCode === 200 &&
|
|
262
|
-
upstreamUrl.pathname.endsWith('.bundle') &&
|
|
263
|
-
upstream.headers['x-peach-rolldown-inventory'] !== '1'
|
|
264
|
-
) {
|
|
265
|
-
res.setHeader(ROLLDOWN_INVENTORY_HEADER, '1')
|
|
266
|
-
res.removeHeader('content-length')
|
|
267
|
-
}
|
|
268
265
|
applyFetchProxyCors(req, res)
|
|
269
266
|
if (setCookies.length > 0)
|
|
270
267
|
res.setHeader('x-sootsim-set-cookie', setCookies.join(', '))
|
|
@@ -510,25 +507,9 @@ async function proxyUpstream(
|
|
|
510
507
|
isBundleProxyRequestUrl(req.url) &&
|
|
511
508
|
method === 'GET' &&
|
|
512
509
|
status === 200 &&
|
|
513
|
-
targetUrl.pathname.endsWith('.bundle')
|
|
514
|
-
proxyRes.headers['x-peach-rolldown-inventory'] !== '1'
|
|
510
|
+
targetUrl.pathname.endsWith('.bundle')
|
|
515
511
|
) {
|
|
516
|
-
|
|
517
|
-
for await (const chunk of proxyRes) {
|
|
518
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
|
|
519
|
-
}
|
|
520
|
-
const payload = Buffer.concat(chunks).toString('utf8')
|
|
521
|
-
const contentType =
|
|
522
|
-
typeof proxyRes.headers['content-type'] === 'string'
|
|
523
|
-
? proxyRes.headers['content-type']
|
|
524
|
-
: undefined
|
|
525
|
-
const annotated =
|
|
526
|
-
await getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleHttpPayload(
|
|
527
|
-
payload,
|
|
528
|
-
contentType,
|
|
529
|
-
)
|
|
530
|
-
res.removeHeader('content-length')
|
|
531
|
-
res.end(Buffer.from(annotated, 'utf8'))
|
|
512
|
+
await forwardRolldownBundleResponse(proxyRes, res)
|
|
532
513
|
return
|
|
533
514
|
}
|
|
534
515
|
await pipeline(proxyRes, res)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Readable } from 'stream'
|
|
2
|
+
import { pipeline } from 'stream/promises'
|
|
3
|
+
import { getCliRuntime } from '../cli-runtime.ts'
|
|
4
|
+
import type { IncomingMessage, ServerResponse } from 'http'
|
|
5
|
+
import type { Http2ServerResponse } from 'node:http2'
|
|
6
|
+
|
|
7
|
+
// marks a response this forwarder already produced, so a second hop (the
|
|
8
|
+
// bundle proxy in front of the vite plugin's route) passes it through instead
|
|
9
|
+
// of buffering and hashing it again. the tenant still verifies the footer.
|
|
10
|
+
export const ROLLDOWN_INVENTORY_HEADER = 'x-peach-rolldown-inventory'
|
|
11
|
+
|
|
12
|
+
// a peach-run dev server answers a 200 .bundle GET with the precomputed
|
|
13
|
+
// rolldown inventory the tenant verifies. the bundle proxy and the vite
|
|
14
|
+
// plugin's own .bundle route both forward the dev server's response through
|
|
15
|
+
// here. metro and other non-rolldown bundles pass through unchanged, and so do
|
|
16
|
+
// bundles a producer already annotated. metro's multipart build progress
|
|
17
|
+
// reaches the client while the build runs; only the bundle part waits for its
|
|
18
|
+
// inventory. a failed attach answers with metro's error shape, so the sim
|
|
19
|
+
// reports the cause instead of a bundle without inventory.
|
|
20
|
+
export async function forwardRolldownBundleResponse(
|
|
21
|
+
upstream: IncomingMessage,
|
|
22
|
+
res: ServerResponse | Http2ServerResponse,
|
|
23
|
+
): Promise<void> {
|
|
24
|
+
res.setHeader(ROLLDOWN_INVENTORY_HEADER, '1')
|
|
25
|
+
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === '1') {
|
|
26
|
+
await pipeline(upstream, res)
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
const contentType =
|
|
30
|
+
typeof upstream.headers['content-type'] === 'string'
|
|
31
|
+
? upstream.headers['content-type']
|
|
32
|
+
: ''
|
|
33
|
+
const inventory = getCliRuntime().rolldown_bundle_inventory
|
|
34
|
+
res.removeHeader('content-length')
|
|
35
|
+
const annotate = async function* () {
|
|
36
|
+
const decoder = new TextDecoder()
|
|
37
|
+
let payload = ''
|
|
38
|
+
let sent = 0
|
|
39
|
+
let bundleStarted = false
|
|
40
|
+
for await (const chunk of upstream) {
|
|
41
|
+
payload += decoder.decode(chunk, { stream: true })
|
|
42
|
+
if (bundleStarted) continue
|
|
43
|
+
const releasable = inventory.releasableMultipartPrefix(payload, contentType)
|
|
44
|
+
bundleStarted = releasable.bundleStarted
|
|
45
|
+
if (releasable.length > sent) {
|
|
46
|
+
yield Buffer.from(payload.slice(sent, releasable.length), 'utf8')
|
|
47
|
+
sent = releasable.length
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
payload += decoder.decode()
|
|
51
|
+
let annotated: string
|
|
52
|
+
try {
|
|
53
|
+
annotated = await inventory.attachRolldownBundleHttpPayload(payload, contentType)
|
|
54
|
+
} catch (error) {
|
|
55
|
+
const message = `could not attach the rolldown bundle inventory: ${
|
|
56
|
+
error instanceof Error ? error.message : String(error)
|
|
57
|
+
}`
|
|
58
|
+
console.error(`[peach] ${message}`)
|
|
59
|
+
if (contentType.toLowerCase().includes('multipart/mixed')) {
|
|
60
|
+
yield Buffer.from(inventory.multipartFailurePart(contentType, message), 'utf8')
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
res.statusCode = 500
|
|
64
|
+
res.setHeader('content-type', 'application/json')
|
|
65
|
+
yield Buffer.from(JSON.stringify({ message }), 'utf8')
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
yield Buffer.from(annotated.slice(sent), 'utf8')
|
|
69
|
+
}
|
|
70
|
+
await pipeline(Readable.from(annotate(), { objectMode: false }), res)
|
|
71
|
+
}
|
|
@@ -203,8 +203,60 @@ export function readInstalledNativePackageVersions(projectRoot: string): Package
|
|
|
203
203
|
return runSync(nativePackageVersionsWalk(projectRoot))
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
// what an install rewrites: the app and workspace manifests, the lockfiles, the
|
|
207
|
+
// package managers' install records and each node_modules directory itself,
|
|
208
|
+
// which changes whenever a package is added, removed or replaced. a long-lived
|
|
209
|
+
// server keys its last scan on these, so a warm bundle skips the walk.
|
|
210
|
+
const INSTALL_RECORD_FILES = [
|
|
211
|
+
'package.json',
|
|
212
|
+
'bun.lock',
|
|
213
|
+
'bun.lockb',
|
|
214
|
+
'package-lock.json',
|
|
215
|
+
'yarn.lock',
|
|
216
|
+
'pnpm-lock.yaml',
|
|
217
|
+
'node_modules',
|
|
218
|
+
'node_modules/.package-lock.json',
|
|
219
|
+
'node_modules/.yarn-integrity',
|
|
220
|
+
'node_modules/.modules.yaml',
|
|
221
|
+
]
|
|
222
|
+
|
|
223
|
+
async function installFingerprint(projectRoot: string): Promise<string> {
|
|
224
|
+
const appRoot = await fs.promises.realpath(projectRoot)
|
|
225
|
+
const targets: string[] = []
|
|
226
|
+
for (let dir = appRoot; ; ) {
|
|
227
|
+
if (path.basename(dir) !== 'node_modules')
|
|
228
|
+
for (const file of INSTALL_RECORD_FILES) targets.push(path.join(dir, file))
|
|
229
|
+
const parent = path.dirname(dir)
|
|
230
|
+
if (parent === dir) break
|
|
231
|
+
dir = parent
|
|
232
|
+
}
|
|
233
|
+
const stats = await Promise.all(
|
|
234
|
+
targets.map((target) =>
|
|
235
|
+
fs.promises.stat(target).then(
|
|
236
|
+
(stat) => `${stat.ino}:${stat.size}:${stat.mtimeMs}`,
|
|
237
|
+
() => '',
|
|
238
|
+
),
|
|
239
|
+
),
|
|
240
|
+
)
|
|
241
|
+
return `${appRoot}\n${stats.join('\n')}`
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const scans = new Map<
|
|
245
|
+
string,
|
|
246
|
+
{ fingerprint: string; versions: Promise<PackageVersions> }
|
|
247
|
+
>()
|
|
248
|
+
|
|
249
|
+
export async function readInstalledNativePackageVersionsAsync(
|
|
207
250
|
projectRoot: string,
|
|
208
251
|
): Promise<PackageVersions> {
|
|
209
|
-
|
|
252
|
+
const fingerprint = await installFingerprint(projectRoot)
|
|
253
|
+
const cached = scans.get(projectRoot)
|
|
254
|
+
if (cached?.fingerprint === fingerprint) return cached.versions
|
|
255
|
+
const versions = runAsync(nativePackageVersionsWalk(projectRoot))
|
|
256
|
+
scans.set(projectRoot, { fingerprint, versions })
|
|
257
|
+
// a failed scan is not kept for the next request to inherit
|
|
258
|
+
versions.catch(() => {
|
|
259
|
+
if (scans.get(projectRoot)?.versions === versions) scans.delete(projectRoot)
|
|
260
|
+
})
|
|
261
|
+
return versions
|
|
210
262
|
}
|