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,127 +0,0 @@
|
|
|
1
|
-
// prints the Expo records, enums, compose views and compose props each app
|
|
2
|
-
// source declares, as Kotlin's own parser reads them, one JSON object per file
|
|
3
|
-
// that has any. upstream finds @Field properties, view constructors and
|
|
4
|
-
// MutableState props by reflection or its compile-time introspection;
|
|
5
|
-
// Kotlin/Wasm has neither, so the host generates the same code from this.
|
|
6
|
-
@file:OptIn(
|
|
7
|
-
org.jetbrains.kotlin.config.CompilerConfiguration.Internals::class,
|
|
8
|
-
org.jetbrains.kotlin.CoreEnvironmentDeprecation::class,
|
|
9
|
-
org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi::class,
|
|
10
|
-
)
|
|
11
|
-
import com.intellij.openapi.util.Disposer
|
|
12
|
-
import org.jetbrains.kotlin.cli.extensionsStorage
|
|
13
|
-
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
|
14
|
-
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
|
|
15
|
-
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
|
16
|
-
import org.jetbrains.kotlin.config.CompilerConfiguration
|
|
17
|
-
import org.jetbrains.kotlin.lexer.KtTokens
|
|
18
|
-
import org.jetbrains.kotlin.psi.*
|
|
19
|
-
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
|
20
|
-
|
|
21
|
-
fun quote(value: String) = "\"" + value.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n") + "\""
|
|
22
|
-
|
|
23
|
-
val environment = KotlinCoreEnvironment.createForProduction(
|
|
24
|
-
Disposer.newDisposable(),
|
|
25
|
-
CompilerConfiguration().apply { extensionsStorage = CompilerPluginRegistrar.ExtensionStorage() },
|
|
26
|
-
EnvironmentConfigFiles.JVM_CONFIG_FILES,
|
|
27
|
-
)
|
|
28
|
-
val factory = KtPsiFactory(environment.project)
|
|
29
|
-
|
|
30
|
-
fun KtAnnotated.annotation(name: String): KtAnnotationEntry? =
|
|
31
|
-
annotationEntries.firstOrNull { it.shortName?.asString() == name }
|
|
32
|
-
|
|
33
|
-
fun relativeName(declaration: KtClassOrObject): String =
|
|
34
|
-
generateSequence(declaration) { it.containingClassOrObject }.toList().reversed().joinToString(".") { it.name ?: "?" }
|
|
35
|
-
|
|
36
|
-
fun hidden(declaration: KtModifierListOwner) =
|
|
37
|
-
declaration.hasModifier(KtTokens.PRIVATE_KEYWORD) || declaration.hasModifier(KtTokens.PROTECTED_KEYWORD)
|
|
38
|
-
|
|
39
|
-
fun field(property: KtCallableDeclaration, mutable: Boolean, initializer: KtExpression?): String? {
|
|
40
|
-
val annotation = property.annotation("Field") ?: return null
|
|
41
|
-
val argument = annotation.valueArguments.firstOrNull()?.getArgumentExpression() as? KtStringTemplateExpression
|
|
42
|
-
if (argument != null && argument.hasInterpolation()) error("${property.name}: @Field key must be a constant string")
|
|
43
|
-
val key = argument?.entries?.joinToString("") { it.text }?.takeUnless { it.isBlank() } ?: property.name!!
|
|
44
|
-
val range = initializer?.textRange
|
|
45
|
-
return "{\"name\":${quote(property.name!!)},\"key\":${quote(key)}" +
|
|
46
|
-
",\"required\":${property.annotation("Required") != null}" +
|
|
47
|
-
",\"mutable\":$mutable,\"hidden\":${hidden(property)}" +
|
|
48
|
-
",\"initializer\":${if (range == null) "null" else "[${range.startOffset},${range.endOffset}]"}}"
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
for (path in args) {
|
|
52
|
-
val text = java.io.File(path).readText().replace("\r\n", "\n")
|
|
53
|
-
val file = factory.createFile(path.substringAfterLast('/'), text)
|
|
54
|
-
val records = mutableListOf<String>()
|
|
55
|
-
val enums = mutableListOf<String>()
|
|
56
|
-
val views = mutableListOf<String>()
|
|
57
|
-
val props = mutableListOf<String>()
|
|
58
|
-
file.accept(object : KtTreeVisitorVoid() {
|
|
59
|
-
override fun visitClass(klass: KtClass) {
|
|
60
|
-
super.visitClass(klass)
|
|
61
|
-
val name = relativeName(klass)
|
|
62
|
-
val isHidden = generateSequence<KtClassOrObject>(klass) { it.containingClassOrObject }.any(::hidden)
|
|
63
|
-
if (klass.isEnum()) {
|
|
64
|
-
// upstream reads the enum's declared fields: its val and var parameters
|
|
65
|
-
val fields = klass.primaryConstructorParameters.filter { it.hasValOrVar() }
|
|
66
|
-
val parameter = fields.singleOrNull()
|
|
67
|
-
enums += "{\"name\":${quote(name)},\"hidden\":$isHidden,\"fields\":${fields.size}" +
|
|
68
|
-
",\"parameter\":${parameter?.name?.let(::quote) ?: "null"}" +
|
|
69
|
-
",\"hiddenParameter\":${parameter != null && hidden(parameter)}}"
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
// a view class names its props class as ExpoComposeView's argument
|
|
73
|
-
val composeView = klass.superTypeListEntries.firstNotNullOfOrNull { entry ->
|
|
74
|
-
val type = entry.typeReference?.typeElement as? KtUserType ?: return@firstNotNullOfOrNull null
|
|
75
|
-
if (type.referencedName != "ExpoComposeView") return@firstNotNullOfOrNull null
|
|
76
|
-
type.typeArgumentsAsTypes.singleOrNull()?.text ?: ""
|
|
77
|
-
}
|
|
78
|
-
if (composeView != null && !klass.hasModifier(KtTokens.ABSTRACT_KEYWORD)) {
|
|
79
|
-
views += "{\"name\":${quote(name)},\"hidden\":$isHidden,\"props\":${quote(composeView)},\"appContext\":true}"
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
val isAndroidView = !klass.hasModifier(KtTokens.ABSTRACT_KEYWORD) && klass.superTypeListEntries.any {
|
|
83
|
-
val ref = it.typeReference?.text?.substringAfterLast('.')
|
|
84
|
-
ref == "ExpoView" || ref == "View" || ref == "FrameLayout" || ref == "LinearLayout" || ref == "ViewGroup"
|
|
85
|
-
}
|
|
86
|
-
if (isAndroidView) {
|
|
87
|
-
// native selects exact public constructor signatures, preferring Context/AppContext.
|
|
88
|
-
val constructors = listOfNotNull(klass.primaryConstructor) + klass.secondaryConstructors
|
|
89
|
-
val signatures = constructors.filter { !hidden(it) }.map { ctor ->
|
|
90
|
-
ctor.valueParameters.map { it.typeReference?.text?.substringAfterLast('.') }
|
|
91
|
-
}
|
|
92
|
-
val takesAppContext = when {
|
|
93
|
-
listOf("Context", "AppContext") in signatures -> true
|
|
94
|
-
listOf("Context") in signatures -> false
|
|
95
|
-
else -> return
|
|
96
|
-
}
|
|
97
|
-
views += "{\"name\":${quote(name)},\"hidden\":$isHidden,\"props\":\"\",\"appContext\":$takesAppContext}"
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
if (klass.superTypeListEntries.any { it.typeReference?.text?.substringAfterLast('.') == "ComposeProps" }) {
|
|
101
|
-
// upstream unwraps each member property's MutableState
|
|
102
|
-
val states = klass.primaryConstructorParameters.filter { it.hasValOrVar() && !hidden(it) }.map { it.name!! } +
|
|
103
|
-
klass.getProperties().filter { !hidden(it) }.map { it.name!! }
|
|
104
|
-
props += "{\"name\":${quote(name)},\"hidden\":$isHidden,\"states\":${states.joinToString(",", "[", "]") { quote(it) }}}"
|
|
105
|
-
return
|
|
106
|
-
}
|
|
107
|
-
val record = klass.superTypeListEntries.any {
|
|
108
|
-
val type = it.typeReference?.text
|
|
109
|
-
type == "Record" || type == "expo.modules.kotlin.records.Record"
|
|
110
|
-
}
|
|
111
|
-
if (!record) return
|
|
112
|
-
val fields = klass.primaryConstructorParameters
|
|
113
|
-
.filter { it.hasValOrVar() }
|
|
114
|
-
.mapNotNull { field(it, it.isMutable, it.defaultValue) } +
|
|
115
|
-
klass.getProperties().mapNotNull { field(it, it.isVar, it.initializer) }
|
|
116
|
-
records += "{\"name\":${quote(name)},\"hidden\":$isHidden,\"fields\":${fields.joinToString(",", "[", "]")}}"
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
if (records.isEmpty() && enums.isEmpty() && views.isEmpty() && props.isEmpty()) continue
|
|
120
|
-
println(
|
|
121
|
-
"{\"file\":${quote(path)},\"package\":${quote(file.packageFqName.asString())}" +
|
|
122
|
-
",\"records\":${records.joinToString(",", "[", "]")}" +
|
|
123
|
-
",\"enums\":${enums.joinToString(",", "[", "]")}" +
|
|
124
|
-
",\"views\":${views.joinToString(",", "[", "]")}" +
|
|
125
|
-
",\"props\":${props.joinToString(",", "[", "]")}}",
|
|
126
|
-
)
|
|
127
|
-
}
|