peachsim 0.1.1655 → 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 +11251 -1123
- 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 +8960 -134
- 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 +9769 -731
- package/dist-lib/host/fetch-proxy-handler.cjs +260 -197
- 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 +10651 -1418
- package/dist-lib/swift-compile.cjs +8802 -138
- package/dist-lib/swift-compile.mjs +8802 -138
- 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 +8960 -134
- 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 +1 -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 -50
- 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 +12 -3
- 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/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
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package android.os
|
|
2
|
-
|
|
3
|
-
// android.os.SystemClock over the guest's monotonic clock; the device boots
|
|
4
|
-
// with the guest, and a browser device never sleeps, so uptime and realtime
|
|
5
|
-
// agree. sleep() is absent: the main thread cannot block here.
|
|
6
|
-
object SystemClock {
|
|
7
|
-
fun uptimeMillis(): Long = nowMillis().toLong()
|
|
8
|
-
fun uptimeNanos(): Long = (nowMillis() * 1_000_000.0).toLong()
|
|
9
|
-
fun elapsedRealtime(): Long = nowMillis().toLong()
|
|
10
|
-
fun elapsedRealtimeNanos(): Long = (nowMillis() * 1_000_000.0).toLong()
|
|
11
|
-
fun currentThreadTimeMillis(): Long = nowMillis().toLong()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
private fun nowMillis(): Double = js("performance.now()")
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
package android.util
|
|
2
|
-
|
|
3
|
-
// android.util.Log: the main log buffer is the guest console, one console
|
|
4
|
-
// level per priority. liblog answers 1 for a written line and -EPERM below
|
|
5
|
-
// VERBOSE; isLoggable answers the unset log.tag property's INFO default.
|
|
6
|
-
object Log {
|
|
7
|
-
const val VERBOSE = 2
|
|
8
|
-
const val DEBUG = 3
|
|
9
|
-
const val INFO = 4
|
|
10
|
-
const val WARN = 5
|
|
11
|
-
const val ERROR = 6
|
|
12
|
-
const val ASSERT = 7
|
|
13
|
-
|
|
14
|
-
fun v(tag: String?, msg: String): Int = println(VERBOSE, tag, msg)
|
|
15
|
-
fun v(tag: String?, msg: String?, tr: Throwable?): Int = printlns(VERBOSE, tag, msg, tr)
|
|
16
|
-
fun d(tag: String?, msg: String): Int = println(DEBUG, tag, msg)
|
|
17
|
-
fun d(tag: String?, msg: String?, tr: Throwable?): Int = printlns(DEBUG, tag, msg, tr)
|
|
18
|
-
fun i(tag: String?, msg: String): Int = println(INFO, tag, msg)
|
|
19
|
-
fun i(tag: String?, msg: String?, tr: Throwable?): Int = printlns(INFO, tag, msg, tr)
|
|
20
|
-
fun w(tag: String?, msg: String): Int = println(WARN, tag, msg)
|
|
21
|
-
fun w(tag: String?, msg: String?, tr: Throwable?): Int = printlns(WARN, tag, msg, tr)
|
|
22
|
-
fun w(tag: String?, tr: Throwable?): Int = printlns(WARN, tag, "", tr)
|
|
23
|
-
fun e(tag: String?, msg: String): Int = println(ERROR, tag, msg)
|
|
24
|
-
fun e(tag: String?, msg: String?, tr: Throwable?): Int = printlns(ERROR, tag, msg, tr)
|
|
25
|
-
|
|
26
|
-
// an app process's default terrible failure handler logs and continues
|
|
27
|
-
fun wtf(tag: String?, msg: String?): Int = printlns(ASSERT, tag, msg, null)
|
|
28
|
-
fun wtf(tag: String?, tr: Throwable): Int = printlns(ASSERT, tag, tr.message, tr)
|
|
29
|
-
fun wtf(tag: String?, msg: String?, tr: Throwable?): Int = printlns(ASSERT, tag, msg, tr)
|
|
30
|
-
|
|
31
|
-
fun isLoggable(tag: String?, level: Int): Boolean = level >= INFO
|
|
32
|
-
|
|
33
|
-
fun getStackTraceString(tr: Throwable?): String {
|
|
34
|
-
var cause = tr ?: return ""
|
|
35
|
-
// Android hides host lookup failures, which carry no useful trace
|
|
36
|
-
while (true) {
|
|
37
|
-
if (cause::class.simpleName == "UnknownHostException") return ""
|
|
38
|
-
cause = cause.cause ?: break
|
|
39
|
-
}
|
|
40
|
-
return tr.stackTraceToString()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
fun println(priority: Int, tag: String?, msg: String): Int {
|
|
44
|
-
if (priority < VERBOSE) return -1
|
|
45
|
-
val line = if (tag == null) msg else "$tag: $msg"
|
|
46
|
-
when (priority) {
|
|
47
|
-
VERBOSE, DEBUG -> consoleDebug(line)
|
|
48
|
-
INFO -> consoleInfo(line)
|
|
49
|
-
WARN -> consoleWarn(line)
|
|
50
|
-
else -> consoleError(line)
|
|
51
|
-
}
|
|
52
|
-
return 1
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private fun printlns(priority: Int, tag: String?, msg: String?, tr: Throwable?): Int {
|
|
56
|
-
val trace = getStackTraceString(tr)
|
|
57
|
-
return println(priority, tag, if (trace.isEmpty()) msg ?: "" else "${msg ?: ""}\n$trace")
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private fun consoleDebug(line: String): Unit = js("console.debug(line)")
|
|
62
|
-
private fun consoleInfo(line: String): Unit = js("console.info(line)")
|
|
63
|
-
private fun consoleWarn(line: String): Unit = js("console.warn(line)")
|
|
64
|
-
private fun consoleError(line: String): Unit = js("console.error(line)")
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package androidx.annotation
|
|
2
|
-
|
|
3
|
-
// androidx.annotation's DrawableRes, which only its android artifact declares
|
|
4
|
-
@MustBeDocumented
|
|
5
|
-
@Retention(AnnotationRetention.BINARY)
|
|
6
|
-
@Target(
|
|
7
|
-
AnnotationTarget.FUNCTION,
|
|
8
|
-
AnnotationTarget.PROPERTY_GETTER,
|
|
9
|
-
AnnotationTarget.PROPERTY_SETTER,
|
|
10
|
-
AnnotationTarget.VALUE_PARAMETER,
|
|
11
|
-
AnnotationTarget.FIELD,
|
|
12
|
-
AnnotationTarget.LOCAL_VARIABLE,
|
|
13
|
-
)
|
|
14
|
-
annotation class DrawableRes
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
package dev.onejs.one
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
|
-
|
|
5
|
-
// generated per .kt source that declares public @Composable functions: renders
|
|
6
|
-
// one of them from the host's json props. a callback reports its arguments
|
|
7
|
-
// through emit as a json array.
|
|
8
|
-
interface OneNativeSourceViewDispatch {
|
|
9
|
-
val contractHash: String
|
|
10
|
-
|
|
11
|
-
@Composable
|
|
12
|
-
fun Content(view: String, propsJson: String, emit: (String, String) -> Unit)
|
|
13
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
package java.security
|
|
2
|
-
|
|
3
|
-
class NoSuchAlgorithmException(message: String) : Exception(message)
|
|
4
|
-
|
|
5
|
-
class MessageDigest private constructor() {
|
|
6
|
-
companion object {
|
|
7
|
-
fun getInstance(algorithm: String): MessageDigest {
|
|
8
|
-
if (algorithm.uppercase() != "SHA-256")
|
|
9
|
-
throw NoSuchAlgorithmException("$algorithm MessageDigest not available")
|
|
10
|
-
return MessageDigest()
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
fun digest(input: ByteArray): ByteArray = sha256(input)
|
|
15
|
-
|
|
16
|
-
private fun sha256(input: ByteArray): ByteArray {
|
|
17
|
-
val bitLength = input.size.toLong() * 8L
|
|
18
|
-
val paddedLength = ((input.size + 9 + 63) / 64) * 64
|
|
19
|
-
val padded = ByteArray(paddedLength)
|
|
20
|
-
input.copyInto(padded)
|
|
21
|
-
padded[input.size] = 0x80.toByte()
|
|
22
|
-
for (index in 0 until 8) {
|
|
23
|
-
padded[paddedLength - 1 - index] = (bitLength ushr (index * 8)).toByte()
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
val state = intArrayOf(
|
|
27
|
-
0x6a09e667,
|
|
28
|
-
0xbb67ae85.toInt(),
|
|
29
|
-
0x3c6ef372,
|
|
30
|
-
0xa54ff53a.toInt(),
|
|
31
|
-
0x510e527f,
|
|
32
|
-
0x9b05688c.toInt(),
|
|
33
|
-
0x1f83d9ab,
|
|
34
|
-
0x5be0cd19,
|
|
35
|
-
)
|
|
36
|
-
val constants = intArrayOf(
|
|
37
|
-
0x428a2f98.toInt(), 0x71374491, 0xb5c0fbcf.toInt(), 0xe9b5dba5.toInt(),
|
|
38
|
-
0x3956c25b, 0x59f111f1, 0x923f82a4.toInt(), 0xab1c5ed5.toInt(),
|
|
39
|
-
0xd807aa98.toInt(), 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74,
|
|
40
|
-
0x80deb1fe.toInt(), 0x9bdc06a7.toInt(), 0xc19bf174.toInt(),
|
|
41
|
-
0xe49b69c1.toInt(), 0xefbe4786.toInt(), 0x0fc19dc6, 0x240ca1cc,
|
|
42
|
-
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da.toInt(), 0x983e5152.toInt(),
|
|
43
|
-
0xa831c66d.toInt(), 0xb00327c8.toInt(), 0xbf597fc7.toInt(), 0xc6e00bf3.toInt(),
|
|
44
|
-
0xd5a79147.toInt(), 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138,
|
|
45
|
-
0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e.toInt(),
|
|
46
|
-
0x92722c85.toInt(), 0xa2bfe8a1.toInt(), 0xa81a664b.toInt(), 0xc24b8b70.toInt(),
|
|
47
|
-
0xc76c51a3.toInt(), 0xd192e819.toInt(), 0xd6990624.toInt(), 0xf40e3585.toInt(),
|
|
48
|
-
0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
|
49
|
-
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee,
|
|
50
|
-
0x78a5636f, 0x84c87814.toInt(), 0x8cc70208.toInt(), 0x90befffa.toInt(),
|
|
51
|
-
0xa4506ceb.toInt(), 0xbef9a3f7.toInt(), 0xc67178f2.toInt(),
|
|
52
|
-
)
|
|
53
|
-
val words = IntArray(64)
|
|
54
|
-
var offset = 0
|
|
55
|
-
while (offset < padded.size) {
|
|
56
|
-
for (index in 0 until 16) {
|
|
57
|
-
val start = offset + index * 4
|
|
58
|
-
words[index] =
|
|
59
|
-
((padded[start].toInt() and 0xff) shl 24) or
|
|
60
|
-
((padded[start + 1].toInt() and 0xff) shl 16) or
|
|
61
|
-
((padded[start + 2].toInt() and 0xff) shl 8) or
|
|
62
|
-
(padded[start + 3].toInt() and 0xff)
|
|
63
|
-
}
|
|
64
|
-
for (index in 16 until 64) {
|
|
65
|
-
val x = words[index - 15]
|
|
66
|
-
val y = words[index - 2]
|
|
67
|
-
val small0 = x.rotateRight(7) xor x.rotateRight(18) xor (x ushr 3)
|
|
68
|
-
val small1 = y.rotateRight(17) xor y.rotateRight(19) xor (y ushr 10)
|
|
69
|
-
words[index] = words[index - 16] + small0 + words[index - 7] + small1
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var a = state[0]
|
|
73
|
-
var b = state[1]
|
|
74
|
-
var c = state[2]
|
|
75
|
-
var d = state[3]
|
|
76
|
-
var e = state[4]
|
|
77
|
-
var f = state[5]
|
|
78
|
-
var g = state[6]
|
|
79
|
-
var h = state[7]
|
|
80
|
-
for (index in 0 until 64) {
|
|
81
|
-
val large1 = e.rotateRight(6) xor e.rotateRight(11) xor e.rotateRight(25)
|
|
82
|
-
val choose = (e and f) xor (e.inv() and g)
|
|
83
|
-
val first = h + large1 + choose + constants[index] + words[index]
|
|
84
|
-
val large0 = a.rotateRight(2) xor a.rotateRight(13) xor a.rotateRight(22)
|
|
85
|
-
val majority = (a and b) xor (a and c) xor (b and c)
|
|
86
|
-
val second = large0 + majority
|
|
87
|
-
h = g
|
|
88
|
-
g = f
|
|
89
|
-
f = e
|
|
90
|
-
e = d + first
|
|
91
|
-
d = c
|
|
92
|
-
c = b
|
|
93
|
-
b = a
|
|
94
|
-
a = first + second
|
|
95
|
-
}
|
|
96
|
-
state[0] += a
|
|
97
|
-
state[1] += b
|
|
98
|
-
state[2] += c
|
|
99
|
-
state[3] += d
|
|
100
|
-
state[4] += e
|
|
101
|
-
state[5] += f
|
|
102
|
-
state[6] += g
|
|
103
|
-
state[7] += h
|
|
104
|
-
offset += 64
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return ByteArray(32) { index ->
|
|
108
|
-
(state[index / 4] ushr (24 - (index % 4) * 8)).toByte()
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
private fun Int.rotateRight(distance: Int): Int =
|
|
113
|
-
(this ushr distance) or (this shl (32 - distance))
|
|
114
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
package java.util
|
|
2
|
-
|
|
3
|
-
open class IllegalFormatCodePointException(private val c: Int) : IllegalFormatException() {
|
|
4
|
-
// kotlin callers of the java getter can use either spelling
|
|
5
|
-
val codePoint: Int get() = getCodePoint()
|
|
6
|
-
|
|
7
|
-
open fun getCodePoint(): Int = c
|
|
8
|
-
|
|
9
|
-
override val message: String get() = "Code point = 0x${c.toUInt().toString(16)}"
|
|
10
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package kotlin.text
|
|
2
|
-
|
|
3
|
-
fun String.format(vararg args: Any?): String {
|
|
4
|
-
if (this != "%02x" || args.size != 1 || args[0] !is Byte)
|
|
5
|
-
throw IllegalArgumentException("Peach Kotlin formatting supports only %02x Byte conversion")
|
|
6
|
-
return ((args[0] as Byte).toInt() and 0xff).toString(16).padStart(2, '0')
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
fun String.toByteArray(): ByteArray = encodeToByteArray()
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
package org.json
|
|
2
|
-
|
|
3
|
-
// the part of android's org.json that One's generated glue and app modules
|
|
4
|
-
// use, with android's parse and print rules: an integer literal parses as Int,
|
|
5
|
-
// or Long past Int, anything with a fraction or exponent as Double; a number
|
|
6
|
-
// whose value is integral prints without a fraction; '/' prints escaped.
|
|
7
|
-
|
|
8
|
-
class JSONException(message: String) : RuntimeException(message)
|
|
9
|
-
|
|
10
|
-
private class JSONTokener(private val text: String) {
|
|
11
|
-
private var at = 0
|
|
12
|
-
|
|
13
|
-
private fun skip() {
|
|
14
|
-
while (at < text.length && text[at].isWhitespace()) at++
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
private fun next(): Char {
|
|
18
|
-
if (at >= text.length) throw JSONException("End of input at character $at of $text")
|
|
19
|
-
return text[at++]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
private fun peek(): Char {
|
|
23
|
-
skip()
|
|
24
|
-
if (at >= text.length) throw JSONException("End of input at character $at of $text")
|
|
25
|
-
return text[at]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
fun nextValue(): Any = when (peek()) {
|
|
29
|
-
'[' -> { at++; array() }
|
|
30
|
-
'{' -> { at++; objectValue() }
|
|
31
|
-
'"', '\'' -> string(next())
|
|
32
|
-
else -> literal()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private fun array(): JSONArray {
|
|
36
|
-
val result = JSONArray()
|
|
37
|
-
if (peek() == ']') { at++; return result }
|
|
38
|
-
while (true) {
|
|
39
|
-
result.put(nextValue())
|
|
40
|
-
when (peek().also { at++ }) {
|
|
41
|
-
']' -> return result
|
|
42
|
-
',', ';' -> continue
|
|
43
|
-
else -> throw JSONException("Unterminated array at character $at of $text")
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
private fun objectValue(): JSONObject {
|
|
49
|
-
val result = JSONObject()
|
|
50
|
-
if (peek() == '}') { at++; return result }
|
|
51
|
-
while (true) {
|
|
52
|
-
val name = nextValue() as? String ?: throw JSONException("Names must be strings at character $at of $text")
|
|
53
|
-
if (peek() != ':' && text[at] != '=') throw JSONException("Expected ':' after $name at character $at of $text")
|
|
54
|
-
at++
|
|
55
|
-
if (text.getOrNull(at) == '>') at++
|
|
56
|
-
result.put(name, nextValue())
|
|
57
|
-
when (peek().also { at++ }) {
|
|
58
|
-
'}' -> return result
|
|
59
|
-
',', ';' -> continue
|
|
60
|
-
else -> throw JSONException("Unterminated object at character $at of $text")
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private fun string(quote: Char): String {
|
|
66
|
-
val out = StringBuilder()
|
|
67
|
-
while (true) {
|
|
68
|
-
val c = next()
|
|
69
|
-
if (c == quote) return out.toString()
|
|
70
|
-
if (c != '\\') { out.append(c); continue }
|
|
71
|
-
when (val escaped = next()) {
|
|
72
|
-
'u' -> {
|
|
73
|
-
if (at + 4 > text.length) throw JSONException("Unterminated escape sequence at character $at of $text")
|
|
74
|
-
out.append(text.substring(at, at + 4).toInt(16).toChar())
|
|
75
|
-
at += 4
|
|
76
|
-
}
|
|
77
|
-
't' -> out.append('\t')
|
|
78
|
-
'b' -> out.append('\b')
|
|
79
|
-
'n' -> out.append('\n')
|
|
80
|
-
'r' -> out.append('\r')
|
|
81
|
-
'f' -> out.append('\u000c')
|
|
82
|
-
else -> out.append(escaped)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private fun literal(): Any {
|
|
88
|
-
val start = at
|
|
89
|
-
while (at < text.length && text[at] !in "\r\n\t ,:#/\\;=[]{}\"'") at++
|
|
90
|
-
val word = text.substring(start, at)
|
|
91
|
-
if (word.isEmpty()) throw JSONException("Expected literal value at character $at of $text")
|
|
92
|
-
when (word.lowercase()) {
|
|
93
|
-
"null" -> return JSONObject.NULL
|
|
94
|
-
"true" -> return true
|
|
95
|
-
"false" -> return false
|
|
96
|
-
}
|
|
97
|
-
if (word.none { it == '.' || it == 'e' || it == 'E' }) {
|
|
98
|
-
val long = word.toLongOrNull()
|
|
99
|
-
if (long != null) return if (long in Int.MIN_VALUE..Int.MAX_VALUE) long.toInt() else long
|
|
100
|
-
}
|
|
101
|
-
return word.toDoubleOrNull() ?: word
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private fun quote(value: String, out: StringBuilder) {
|
|
106
|
-
out.append('"')
|
|
107
|
-
for (c in value) {
|
|
108
|
-
when (c) {
|
|
109
|
-
'"', '\\', '/' -> out.append('\\').append(c)
|
|
110
|
-
'\t' -> out.append("\\t")
|
|
111
|
-
'\b' -> out.append("\\b")
|
|
112
|
-
'\n' -> out.append("\\n")
|
|
113
|
-
'\r' -> out.append("\\r")
|
|
114
|
-
'\u000c' -> out.append("\\f")
|
|
115
|
-
else -> if (c.code <= 0x1f) out.append("\\u").append(c.code.toString(16).padStart(4, '0')) else out.append(c)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
out.append('"')
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
private fun numberToString(number: Number): String {
|
|
122
|
-
val double = number.toDouble()
|
|
123
|
-
if (double.isNaN() || double.isInfinite()) throw JSONException("Forbidden numeric value: $number")
|
|
124
|
-
if (double == 0.0 && 1.0 / double < 0) return "-0"
|
|
125
|
-
val long = number.toLong()
|
|
126
|
-
if (double == long.toDouble()) return long.toString()
|
|
127
|
-
return number.toString()
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private fun write(value: Any?, out: StringBuilder) {
|
|
131
|
-
when (value) {
|
|
132
|
-
null, JSONObject.NULL -> out.append("null")
|
|
133
|
-
is String -> quote(value, out)
|
|
134
|
-
is Boolean -> out.append(value)
|
|
135
|
-
is Number -> out.append(numberToString(value))
|
|
136
|
-
is JSONArray -> value.writeTo(out)
|
|
137
|
-
is JSONObject -> value.writeTo(out)
|
|
138
|
-
else -> quote(value.toString(), out)
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private fun typeMismatch(indexOrName: Any, value: Any, required: String): JSONException {
|
|
143
|
-
val className = when (value) {
|
|
144
|
-
JSONObject.NULL -> "org.json.JSONObject\$1"
|
|
145
|
-
is String -> "java.lang.String"
|
|
146
|
-
is Boolean -> "java.lang.Boolean"
|
|
147
|
-
is Int -> "java.lang.Integer"
|
|
148
|
-
is Long -> "java.lang.Long"
|
|
149
|
-
is Double -> "java.lang.Double"
|
|
150
|
-
is Float -> "java.lang.Float"
|
|
151
|
-
else -> value::class.qualifiedName
|
|
152
|
-
}
|
|
153
|
-
return JSONException("Value $value at $indexOrName of type $className cannot be converted to $required")
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
class JSONArray() {
|
|
157
|
-
private val values = ArrayList<Any?>()
|
|
158
|
-
|
|
159
|
-
constructor(json: String) : this() {
|
|
160
|
-
val parsed = JSONTokener(json).nextValue()
|
|
161
|
-
if (parsed !is JSONArray) throw JSONException("Value $json of type ${parsed::class.simpleName} cannot be converted to JSONArray")
|
|
162
|
-
values.addAll(parsed.values)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
constructor(collection: Collection<*>) : this() {
|
|
166
|
-
for (item in collection) values.add(JSONObject.wrap(item))
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
fun length(): Int = values.size
|
|
170
|
-
|
|
171
|
-
fun opt(index: Int): Any? = values.getOrNull(index)
|
|
172
|
-
|
|
173
|
-
fun get(index: Int): Any {
|
|
174
|
-
if (index < 0 || index >= values.size) throw JSONException("Index $index out of range [0..${values.size})")
|
|
175
|
-
return values[index] ?: throw JSONException("Value at $index is null.")
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
fun getString(index: Int): String = get(index).toString()
|
|
179
|
-
|
|
180
|
-
fun getJSONArray(index: Int): JSONArray {
|
|
181
|
-
val value = get(index)
|
|
182
|
-
return value as? JSONArray ?: throw typeMismatch(index, value, "JSONArray")
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
fun optJSONArray(index: Int): JSONArray? = opt(index) as? JSONArray
|
|
186
|
-
|
|
187
|
-
fun getJSONObject(index: Int): JSONObject {
|
|
188
|
-
val value = get(index)
|
|
189
|
-
return value as? JSONObject ?: throw typeMismatch(index, value, "JSONObject")
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
fun optJSONObject(index: Int): JSONObject? = opt(index) as? JSONObject
|
|
193
|
-
|
|
194
|
-
fun put(value: Any?): JSONArray {
|
|
195
|
-
values.add(value)
|
|
196
|
-
return this
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
internal fun writeTo(out: StringBuilder) {
|
|
200
|
-
out.append('[')
|
|
201
|
-
values.forEachIndexed { index, value ->
|
|
202
|
-
if (index > 0) out.append(',')
|
|
203
|
-
write(value, out)
|
|
204
|
-
}
|
|
205
|
-
out.append(']')
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
override fun toString(): String = StringBuilder().also { writeTo(it) }.toString()
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
class JSONObject() {
|
|
212
|
-
private val fields = LinkedHashMap<String, Any?>()
|
|
213
|
-
|
|
214
|
-
constructor(json: String) : this() {
|
|
215
|
-
val parsed = JSONTokener(json).nextValue()
|
|
216
|
-
if (parsed !is JSONObject) throw JSONException("Value $json of type ${parsed::class.simpleName} cannot be converted to JSONObject")
|
|
217
|
-
fields.putAll(parsed.fields)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
constructor(map: Map<*, *>) : this() {
|
|
221
|
-
for ((key, value) in map) fields[key as? String ?: throw NullPointerException("key == null")] = wrap(value)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
fun length(): Int = fields.size
|
|
225
|
-
|
|
226
|
-
fun has(name: String): Boolean = fields.containsKey(name)
|
|
227
|
-
|
|
228
|
-
fun opt(name: String): Any? = fields[name]
|
|
229
|
-
|
|
230
|
-
fun get(name: String): Any = fields[name] ?: throw JSONException("No value for $name")
|
|
231
|
-
|
|
232
|
-
fun put(name: String, value: Any?): JSONObject {
|
|
233
|
-
if (value == null) fields.remove(name) else {
|
|
234
|
-
if (value is Number) numberToString(value)
|
|
235
|
-
fields[name] = value
|
|
236
|
-
}
|
|
237
|
-
return this
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// android's coercions: any value reads as its string; a number or a
|
|
241
|
-
// numeric string reads as an int, anything else as the fallback
|
|
242
|
-
fun getString(name: String): String = when (val value = get(name)) {
|
|
243
|
-
is String -> value
|
|
244
|
-
else -> value.toString()
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
fun getJSONArray(name: String): JSONArray {
|
|
248
|
-
val value = get(name)
|
|
249
|
-
return value as? JSONArray ?: throw typeMismatch(name, value, "JSONArray")
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
fun optJSONArray(name: String): JSONArray? = opt(name) as? JSONArray
|
|
253
|
-
|
|
254
|
-
fun getJSONObject(name: String): JSONObject {
|
|
255
|
-
val value = get(name)
|
|
256
|
-
return value as? JSONObject ?: throw typeMismatch(name, value, "JSONObject")
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
fun optJSONObject(name: String): JSONObject? = opt(name) as? JSONObject
|
|
260
|
-
|
|
261
|
-
fun optInt(name: String, fallback: Int = 0): Int = when (val value = opt(name)) {
|
|
262
|
-
is Number -> value.toInt()
|
|
263
|
-
is String -> value.toDoubleOrNull()?.toInt() ?: fallback
|
|
264
|
-
else -> fallback
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
fun optBoolean(name: String): Boolean = when (val value = opt(name)) {
|
|
268
|
-
is Boolean -> value
|
|
269
|
-
is String -> value.equals("true", ignoreCase = true)
|
|
270
|
-
else -> false
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
fun keys(): Iterator<String> = fields.keys.iterator()
|
|
274
|
-
|
|
275
|
-
internal fun writeTo(out: StringBuilder) {
|
|
276
|
-
out.append('{')
|
|
277
|
-
var first = true
|
|
278
|
-
for ((key, value) in fields) {
|
|
279
|
-
if (!first) out.append(',')
|
|
280
|
-
first = false
|
|
281
|
-
quote(key, out)
|
|
282
|
-
out.append(':')
|
|
283
|
-
write(value, out)
|
|
284
|
-
}
|
|
285
|
-
out.append('}')
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
override fun toString(): String = StringBuilder().also { writeTo(it) }.toString()
|
|
289
|
-
|
|
290
|
-
companion object {
|
|
291
|
-
val NULL: Any = object {
|
|
292
|
-
override fun equals(other: Any?): Boolean = other == null || other === this
|
|
293
|
-
override fun hashCode(): Int = 0
|
|
294
|
-
override fun toString(): String = "null"
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
fun wrap(value: Any?): Any? = when (value) {
|
|
298
|
-
null -> NULL
|
|
299
|
-
is JSONArray, is JSONObject, NULL -> value
|
|
300
|
-
is Collection<*> -> JSONArray(value)
|
|
301
|
-
is Array<*> -> JSONArray(value.toList())
|
|
302
|
-
is Map<*, *> -> JSONObject(value)
|
|
303
|
-
is Boolean, is Byte, is Char, is Double, is Float, is Int, is Long, is Short, is String -> value
|
|
304
|
-
else -> null
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// prints an app klib's classes as the compiler resolved them, one JSON object
|
|
2
|
-
// per line: qualified name, kind, modality, whether it is inner or generic,
|
|
3
|
-
// its supertypes and its public constructors' parameter types, each marked
|
|
4
|
-
// when every parameter has a default
|
|
5
|
-
@file:OptIn(org.jetbrains.kotlin.library.abi.ExperimentalLibraryAbiReader::class)
|
|
6
|
-
|
|
7
|
-
import org.jetbrains.kotlin.library.abi.*
|
|
8
|
-
|
|
9
|
-
fun name(qualified: AbiQualifiedName): String {
|
|
10
|
-
val pkg = qualified.packageName.value.replace('/', '.')
|
|
11
|
-
val relative = qualified.relativeName.value
|
|
12
|
-
return if (pkg.isEmpty()) relative else "$pkg.$relative"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
fun type(type: AbiType): String =
|
|
16
|
-
((type as? AbiType.Simple)?.classifierReference as? AbiClassifierReference.ClassReference)
|
|
17
|
-
?.let { name(it.className) } ?: "?"
|
|
18
|
-
|
|
19
|
-
fun quote(value: String) = "\"" + value.replace("\\", "\\\\").replace("\"", "\\\"") + "\""
|
|
20
|
-
|
|
21
|
-
fun walk(declaration: AbiDeclaration) {
|
|
22
|
-
if (declaration !is AbiClass) return
|
|
23
|
-
val constructors = declaration.declarations.filterIsInstance<AbiFunction>()
|
|
24
|
-
.filter { it.isConstructor }
|
|
25
|
-
.map { constructor ->
|
|
26
|
-
val parameters = constructor.valueParameters.joinToString(",", "[", "]") { quote(type(it.type)) }
|
|
27
|
-
"{\"parameters\":$parameters,\"defaulted\":${constructor.valueParameters.all { it.hasDefaultArg }}}"
|
|
28
|
-
}
|
|
29
|
-
println(
|
|
30
|
-
"{\"name\":${quote(name(declaration.qualifiedName))}" +
|
|
31
|
-
",\"kind\":${quote(declaration.kind.name)}" +
|
|
32
|
-
",\"modality\":${quote(declaration.modality.name)}" +
|
|
33
|
-
",\"inner\":${declaration.isInner}" +
|
|
34
|
-
",\"generic\":${declaration.typeParameters.isNotEmpty()}" +
|
|
35
|
-
",\"supers\":${declaration.superTypes.joinToString(",", "[", "]") { quote(type(it)) }}" +
|
|
36
|
-
",\"constructors\":${constructors.joinToString(",", "[", "]")}}",
|
|
37
|
-
)
|
|
38
|
-
declaration.declarations.forEach(::walk)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
LibraryAbiReader.readAbiInfo(java.io.File(args[0])).topLevelDeclarations.declarations.forEach(::walk)
|