Skip to content

Commit 9acfbbd

Browse files
authored
Move normalization logic back to common sources (#279)
After #278, the normalization library supports `wasmJs` target out-of-the-box and we can move the normalization logic back to common sources
1 parent f9d460c commit 9acfbbd

File tree

4 files changed

+9
-36
lines changed

4 files changed

+9
-36
lines changed

json-schema-validator/build.gradle.kts

+3-24
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,21 @@ kotlin {
2424
}
2525

2626
sourceSets {
27-
val commonMain by getting {
27+
commonMain {
2828
dependencies {
2929
api(libs.kotlin.serialization.json)
3030
api(libs.uri)
3131
// When using approach like above you won't be able to add because block
32-
implementation(
33-
libs.kotlin.codepoints
34-
.get()
35-
.toString(),
36-
) {
32+
implementation(libs.kotlin.codepoints.get().toString()) {
3733
because("simplifies work with unicode codepoints")
3834
}
39-
implementation(libs.karacteristics)
40-
}
41-
}
42-
43-
val nonWasmJsMain by creating {
44-
dependsOn(commonMain)
45-
46-
dependencies {
4735
implementation(libs.normalize.get().toString()) {
4836
because("provides normalization required by IDN-hostname format")
4937
}
38+
implementation(libs.karacteristics)
5039
}
5140
}
5241

53-
jvmMain {
54-
dependsOn(nonWasmJsMain)
55-
}
56-
jsMain {
57-
dependsOn(nonWasmJsMain)
58-
}
59-
nativeMain {
60-
dependsOn(nonWasmJsMain)
61-
}
62-
6342
commonTest {
6443
dependencies {
6544
implementation(libs.kotest.assertions.core)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
package io.github.optimumcode.json.schema.internal.hostname
22

3-
internal expect fun isNormalized(label: String): Boolean
3+
import doist.x.normalize.Form
4+
import doist.x.normalize.normalize
5+
6+
internal fun isNormalized(label: String): Boolean {
7+
return label.normalize(Form.NFC) == label
8+
}

json-schema-validator/src/nonWasmJsMain/kotlin/io/github/optimumcode/json/schema/internal/hostname/Normalizer.nonWasmJs.kt

-8
This file was deleted.

json-schema-validator/src/wasmJsMain/kotlin/io/github/optimumcode/json/schema/internal/hostname/Normalizer.wasmJs.kt

-3
This file was deleted.

0 commit comments

Comments
 (0)