diff --git a/.idea/artifacts/permission_checker_js_2_2.xml b/.idea/artifacts/permission_checker_js_2_2.xml new file mode 100644 index 0000000..7d89340 --- /dev/null +++ b/.idea/artifacts/permission_checker_js_2_2.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/build/libs + + + + + \ No newline at end of file diff --git a/.idea/artifacts/permission_checker_jvm_2_2.xml b/.idea/artifacts/permission_checker_jvm_2_2.xml new file mode 100644 index 0000000..150f8ed --- /dev/null +++ b/.idea/artifacts/permission_checker_jvm_2_2.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/build/libs + + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..cc3da93 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index faee5b3..2e2b64c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "org.thundernetwork.permissionchecker" -version = "2.1" +version = "2.2" repositories { mavenCentral() @@ -15,10 +15,11 @@ dependencies { kotlin { jvm {} - js { - nodejs { - } - binaries.executable() + js (IR) { + nodejs {} + binaries.library() + generateTypeScriptDefinitions() + useEsModules() } sourceSets { @@ -37,19 +38,6 @@ kotlin { } } -tasks { - val jsProductionExecutableCompileSync by getting - val jsNodeRun by getting { - dependsOn(jsProductionExecutableCompileSync) - } - val jsNodeDevelopmentRun by getting { - dependsOn(jsProductionExecutableCompileSync) - } - val jsDevelopmentExecutableCompileSync by getting - val jsNodeProductionRun by getting { - dependsOn(jsDevelopmentExecutableCompileSync) - } -} publishing { // publications { diff --git a/src/commonMain/kotlin/App.kt b/src/commonMain/kotlin/App.kt index 56314bd..09ad407 100644 --- a/src/commonMain/kotlin/App.kt +++ b/src/commonMain/kotlin/App.kt @@ -1,10 +1,5 @@ package org.thundernetwork.permissionchecker -import kotlin.js.ExperimentalJsExport -import kotlin.js.JsExport - -@OptIn(ExperimentalJsExport::class) -@JsExport fun checkSingle(permission: String, requiredPermission: String): Boolean { var answer = false if (permission === "*") answer = true @@ -24,8 +19,6 @@ fun checkSingle(permission: String, requiredPermission: String): Boolean { return answer } -@OptIn(ExperimentalJsExport::class) -@JsExport fun checkList(permission: Array, requiredPermission: Array): Boolean { var actualLength = 0 val requiredLength = requiredPermission.size diff --git a/src/jsMain/kotlin/js.kt b/src/jsMain/kotlin/js.kt index 1e93d69..4a17602 100644 --- a/src/jsMain/kotlin/js.kt +++ b/src/jsMain/kotlin/js.kt @@ -1 +1,14 @@ -package org.thundernetwork.permissionchecker \ No newline at end of file +// package org.thundernetwork.permissionchecker +@file:OptIn(ExperimentalJsExport::class) +@file:JsExport +import kotlin.js.ExperimentalJsExport +import kotlin.js.JsExport + + +fun checkSingle(permission: String, requiredPermission: String): Boolean { + return org.thundernetwork.permissionchecker.checkSingle(permission, requiredPermission) +} + +fun checkList(permission: Array, requiredPermission: Array): Boolean { + return org.thundernetwork.permissionchecker.checkList(permission, requiredPermission) +} \ No newline at end of file