[K/JS] Add ability to exclude declarations from export by a new annotation @JsExport.Ignore.

This commit is contained in:
Artem Kobzar
2022-10-03 11:07:25 +00:00
committed by Space Team
parent 917c8606f5
commit eb2326eabb
49 changed files with 970 additions and 42 deletions
+8
View File
@@ -240,6 +240,14 @@ public external interface JsClass<T : kotlin.Any> {
@kotlin.SinceKotlin(version = "1.3")
public final annotation class JsExport : kotlin.Annotation {
public constructor JsExport()
@kotlin.js.ExperimentalJsExport
@kotlin.annotation.Retention(value = AnnotationRetention.BINARY)
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR})
@kotlin.SinceKotlin(version = "1.8")
public final annotation class Ignore : kotlin.Annotation {
public constructor Ignore()
}
}
@kotlin.annotation.Retention(value = AnnotationRetention.BINARY)
+8
View File
@@ -239,6 +239,14 @@ public external interface JsClass<T : kotlin.Any> {
@kotlin.SinceKotlin(version = "1.3")
public final annotation class JsExport : kotlin.Annotation {
public constructor JsExport()
@kotlin.js.ExperimentalJsExport
@kotlin.annotation.Retention(value = AnnotationRetention.BINARY)
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR})
@kotlin.SinceKotlin(version = "1.8")
public final annotation class Ignore : kotlin.Annotation {
public constructor Ignore()
}
}
@kotlin.annotation.Retention(value = AnnotationRetention.BINARY)
@@ -63,4 +63,18 @@ public annotation class ExperimentalJsExport
@Target(CLASS, PROPERTY, FUNCTION, FILE)
@SinceKotlin("1.4")
@OptionalExpectation
public expect annotation class JsExport()
public expect annotation class JsExport() {
/*
* The annotation prevents exporting the annotated member of an exported class.
* This annotation is experimental, meaning that the restrictions mentioned above are subject to change.
*/
@ExperimentalJsExport
@Retention(AnnotationRetention.BINARY)
@Target(CLASS, PROPERTY, FUNCTION)
@SinceKotlin("1.8")
// Suppress until bootstrapping
@Suppress("NESTED_OPTIONAL_EXPECTATION")
@OptionalExpectation
public annotation class Ignore()
}
+12 -1
View File
@@ -190,7 +190,18 @@ public annotation class JsQualifier(val value: String)
@Retention(AnnotationRetention.BINARY)
@Target(CLASS, PROPERTY, FUNCTION, FILE)
@SinceKotlin("1.3")
public actual annotation class JsExport
public actual annotation class JsExport {
/*
* The annotation prevents exporting the annotated member of an exported class.
* This annotation is experimental, meaning that the restrictions mentioned above are subject to change.
*/
@ExperimentalJsExport
@Retention(AnnotationRetention.BINARY)
@Target(CLASS, PROPERTY, FUNCTION, CONSTRUCTOR)
@SinceKotlin("1.8")
public actual annotation class Ignore
}
/**
* Forces a top-level property to be initialized eagerly, opposed to lazily on the first access to file and/or property.
@@ -13,7 +13,17 @@ package kotlin.js
@ExperimentalJsExport
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)
public actual annotation class JsExport
public actual annotation class JsExport {
@ExperimentalJsExport
@Retention(AnnotationRetention.BINARY)
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY,
AnnotationTarget.CONSTRUCTOR,
)
public actual annotation class Ignore
}
/**
* Specifies JavaScript name for external and imported declarations