File tree Expand file tree Collapse file tree 6 files changed +46
-11
lines changed
commonMain/kotlin/io/github/optimumcode/json/schema/internal
nonWasmJsMain/kotlin/io/github/optimumcode/json/schema/internal/hostname
wasmJsMain/kotlin/io/github/optimumcode/json/schema/internal/hostname Expand file tree Collapse file tree 6 files changed +46
-11
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ kotlin {
145
145
generateTypeScriptDefinitions()
146
146
nodejs()
147
147
}
148
+ wasmJs {
149
+ nodejs()
150
+ }
148
151
applyDefaultHierarchyTemplate()
149
152
150
153
val macOsTargets =
@@ -168,7 +171,7 @@ kotlin {
168
171
)
169
172
170
173
sourceSets {
171
- commonMain {
174
+ val commonMain by getting {
172
175
kotlin.srcDirs(generatedSourceDirectory)
173
176
174
177
dependencies {
@@ -182,11 +185,33 @@ kotlin {
182
185
) {
183
186
because(" simplifies work with unicode codepoints" )
184
187
}
188
+ }
189
+ }
190
+
191
+ val wasmJsMain by getting {
192
+
193
+ }
194
+
195
+ val nonWasmJsMain by creating {
196
+ dependsOn(commonMain)
197
+
198
+ dependencies {
185
199
implementation(libs.normalize.get().toString()) {
186
200
because(" provides normalization required by IDN-hostname format" )
187
201
}
188
202
}
189
203
}
204
+
205
+ val jvmMain by getting {
206
+ dependsOn(nonWasmJsMain)
207
+ }
208
+ val jsMain by getting {
209
+ dependsOn(nonWasmJsMain)
210
+ }
211
+ val nativeMain by getting {
212
+ dependsOn(nonWasmJsMain)
213
+ }
214
+
190
215
commonTest {
191
216
dependencies {
192
217
implementation(libs.kotest.assertions.core)
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ import io.github.optimumcode.json.schema.FormatValidator
7
7
import io.github.optimumcode.json.schema.internal.formats.IdnHostnameFormatValidator.BidiLabelType.LTR
8
8
import io.github.optimumcode.json.schema.internal.formats.IdnHostnameFormatValidator.BidiLabelType.NONE
9
9
import io.github.optimumcode.json.schema.internal.formats.IdnHostnameFormatValidator.BidiLabelType.RTL
10
- import io.github.optimumcode.json.schema.internal.hostname.Normalizer
11
10
import io.github.optimumcode.json.schema.internal.hostname.Punycode
11
+ import io.github.optimumcode.json.schema.internal.hostname.isNormalized
12
12
import io.github.optimumcode.json.schema.internal.unicode.CharacterCategory
13
13
import io.github.optimumcode.json.schema.internal.unicode.CharacterCategory.ENCLOSING_MARK
14
14
import io.github.optimumcode.json.schema.internal.unicode.CharacterCategory.NONSPACING_MARK
@@ -108,7 +108,7 @@ internal object IdnHostnameFormatValidator : AbstractStringFormatValidator() {
108
108
label
109
109
}
110
110
111
- if (! Normalizer . isNormalized(unicode)) {
111
+ if (! isNormalized(unicode)) {
112
112
return false
113
113
}
114
114
Original file line number Diff line number Diff line change 1
1
package io.github.optimumcode.json.schema.internal.hostname
2
2
3
- import doist.x.normalize.Form
4
- import doist.x.normalize.normalize
5
-
6
- internal object Normalizer {
7
- fun isNormalized (label : String ): Boolean {
8
- return label.normalize(Form .NFC ) == label
9
- }
10
- }
3
+ public expect fun isNormalized (label : String ): Boolean
Original file line number Diff line number Diff line change
1
+ package io.github.optimumcode.json.schema.internal.hostname
2
+
3
+ import doist.x.normalize.Form
4
+ import doist.x.normalize.normalize
5
+
6
+ public actual fun isNormalized (label : String ): Boolean {
7
+ return label.normalize(Form .NFC ) == label
8
+ }
Original file line number Diff line number Diff line change
1
+ package io.github.optimumcode.json.schema.internal.hostname
2
+
3
+ public actual fun isNormalized (label : String ): Boolean {
4
+ // depending library does not yet support wasm: https://github.com/OptimumCode/json-schema-validator/issues/177#issuecomment-2268482409
5
+ return true
6
+ }
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ kotlin {
27
27
js(IR ) {
28
28
nodejs()
29
29
}
30
+ wasmJs {
31
+ nodejs()
32
+ }
30
33
applyDefaultHierarchyTemplate()
31
34
32
35
val macOsTargets =
You can’t perform that action at this time.
0 commit comments