Edoardo Luppi
11/01/2023, 1:33 PMArtem Kobzar
11/01/2023, 1:37 PMandylamax
11/01/2023, 2:15 PMhfhbd
11/01/2023, 2:42 PMturansky
11/01/2023, 3:06 PMkotlin-web
is also for workers, service workers, audio worklets.
As result - 6 platforms at start?
1. Web (JS Common)
2. Browser
3. Browser Worker
4. Browser Service Worker
5. Browser Audio Worklet
6. Nodehfhbd
11/01/2023, 3:08 PMturansky
11/01/2023, 3:09 PMEdoardo Luppi
11/01/2023, 3:38 PMjsCommomMain
and the two targets to build on top. This improves flexibility, avoids runtime checks and workarounds, and allow being clear on the supported platforms.turansky
11/01/2023, 3:54 PMEdoardo Luppi
11/01/2023, 4:05 PMkotlinx-io
library.
internal val fs: dynamic
get(): dynamic {
return try {
js("require('fs')")
} catch (t: Throwable) {
null
}
}
You could avoid this kind of stuff with the two being separated.turansky
11/01/2023, 4:07 PMEdoardo Luppi
11/01/2023, 4:11 PMI think we need more elegant solution then targetsI can't think of any other solution tbh. The targets architecture and HMPP model are the most immediate things that come to mind. Multiple targets > multiple actualizations of expect declarations > it's a win for me
turansky
11/01/2023, 4:12 PMEdoardo Luppi
11/01/2023, 4:14 PMpolyfill classesPolyfills are a workaround imo. If Kotlin is able to enforce better boundaries, that's another win
kotlin {
...
js("jsNode", IR) {
nodejs()
attributes.attribute(kotlinJsTargetAttribute, targetName)
}
js("jsBrowser", IR) {
browser()
attributes.attribute(kotlinJsTargetAttribute, targetName)
}
Someone correct me if I'm wrong but now specifying multiple targets of the same type is deprecated/going to be removed.
So yeah you can't even do that.turansky
11/01/2023, 5:09 PMIlya Goncharov [JB]
11/01/2023, 5:31 PMAnother example from the issueIt is how personally I recommend to solve this issue. Case with different targets are indeed has problems that in fact we compile just JS, compiler doesn’t care about its runtime, and I don’t think that knowing of runtime is useful for compiler (native is different here, because Native actually compiles different binary files for different targets with different dependencies). But for JS you can use dependencies for all of targets. So I think that usage with different targets and attributes can help now
Edoardo Luppi
11/01/2023, 5:38 PMhfhbd
11/01/2023, 5:46 PMandylamax
11/02/2023, 5:38 AMBig Chungus
11/20/2023, 11:40 AMEdoardo Luppi
11/20/2023, 11:44 AM