[K/JS, K/Wasm] Generate star imports for external objects with the @JsModule annotation for ES modules

This commit is contained in:
Artem Kobzar
2023-07-18 15:36:19 +00:00
committed by Space Team
parent e61a11f0a3
commit 41f27d19b5
5 changed files with 58 additions and 42 deletions
@@ -4,13 +4,16 @@ package foo
@JsModule("./externalObject.mjs")
external object A {
val x: Int = definedExternally
@JsName("default")
object Default {
val x: Int = definedExternally
fun foo(y: Int): Int = definedExternally
fun foo(y: Int): Int = definedExternally
}
}
fun box(): String {
assertEquals(23, A.x)
assertEquals(65, A.foo(42))
assertEquals(23, A.Default.x)
assertEquals(65, A.Default.foo(42))
return "OK"
}
@@ -1,21 +1,19 @@
export default {
createX: function () {
return {x: "X1"};
},
createXY: function () {
return {x: "X2", y: "Y2"};
},
createXYZ: function () {
return {x: "X3", y: "Y3", z: "Z3"};
},
createClassXYZ: function () {
return {x: "X4", y: "Y4", z: "Z4"};
},
createNestedInterfaceXYZ: function () {
return {x: "X5", y: "Y5", z: "Z5"};
},
export function createX () {
return {x: "X1"};
}
export function createXY () {
return {x: "X2", y: "Y2"};
}
export function createXYZ() {
return {x: "X3", y: "Y3", z: "Z3"};
}
export function createClassXYZ() {
return {x: "X4", y: "Y4", z: "Z4"};
}
export function createNestedInterfaceXYZ() {
return {x: "X5", y: "Y5", z: "Z5"};
}
x: "X6",
y: "Y6",
z: "Z6"
};
export const x = "X6"
export const y = "Y6"
export const z = "Z6"