Skip to content

Commit ba04206

Browse files
authored
Merge pull request #36 from skydoves/kmp/support-wasm
Support wasmJs in multiplatform
2 parents aa5f75b + 538ffd3 commit ba04206

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

compose-stability-analyzer-idea/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to the IntelliJ IDEA plugin will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
- **wasmJs target support** - Added WebAssembly JavaScript (wasmJs) target to stability-runtime module (Issue #32)
9+
- Enables Kotlin Multiplatform projects to use wasmJs alongside other targets (Android, iOS, Desktop, macOS)
10+
- Runtime module now publishes wasmJs artifacts (klib) for Compose Multiplatform web applications
11+
- Implemented `DefaultRecompositionLogger` for wasmJs using `println()` for browser console output
12+
- wasmJs target placed directly under common hierarchy (separate from skia group) for proper source set resolution
13+
714
---
815

916
## [0.5.0] - 2025-11-08

stability-runtime/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ kotlin {
3232
macosX64()
3333
macosArm64()
3434

35+
wasmJs {
36+
browser()
37+
}
38+
3539
@Suppress("OPT_IN_USAGE")
3640
applyHierarchyTemplate {
3741
common {
3842
withAndroidTarget()
3943
withJvm()
44+
withWasmJs()
4045
group("skia") {
4146
group("darwin") {
4247
group("apple") {
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Designed and developed by 2025 skydoves (Jaewoong Eum)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.skydoves.compose.stability.runtime
17+
18+
/**
19+
* WebAssembly JavaScript implementation of DefaultRecompositionLogger that uses println.
20+
*
21+
* Example output:
22+
* ```
23+
* [Recomposition #3] UserProfile (tag: user-screen)
24+
* ├─ user: User changed (User@abc123 → User@def456)
25+
* ├─ count: Int stable (42)
26+
* ├─ onClick: () -> Unit stable
27+
* └─ Unstable parameters: [user]
28+
* ```
29+
*/
30+
public actual class DefaultRecompositionLogger : RecompositionLogger {
31+
public actual constructor()
32+
33+
actual override fun log(event: RecompositionEvent) {
34+
val tagSuffix = if (event.tag.isNotEmpty()) " (tag: ${event.tag})" else ""
35+
36+
println("[Recomposition #${event.recompositionCount}] ${event.composableName}$tagSuffix")
37+
38+
// Log parameter changes
39+
event.parameterChanges.forEachIndexed { index, change ->
40+
val isLast = index == event.parameterChanges.size - 1
41+
val prefix = if (isLast) " └─" else " ├─"
42+
43+
val status = when {
44+
change.changed -> {
45+
val oldStr = change.oldValue?.toString() ?: "null"
46+
val newStr = change.newValue?.toString() ?: "null"
47+
"changed ($oldStr$newStr)"
48+
}
49+
50+
change.stable -> "stable (${change.newValue})"
51+
else -> "unstable (${change.newValue})"
52+
}
53+
54+
println("$prefix ${change.name}: ${change.type} $status")
55+
}
56+
57+
// Log unstable parameters summary
58+
if (event.unstableParameters.isNotEmpty()) {
59+
println(" └─ Unstable parameters: ${event.unstableParameters}")
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)