Fixes for js

This commit is contained in:
KillerBossOriginal 2024-07-05 00:06:30 +02:00
parent b361acc075
commit 92182c94aa
6 changed files with 42 additions and 26 deletions

View file

@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="permission-checker-js-2.2">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="permission-checker-js-2.2.jar">
<element id="module-output" name="permission-checker.jsMain" />
</root>
</artifact>
</component>

View file

@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="permission-checker-jvm-2.2">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="permission-checker-jvm-2.2.jar">
<element id="module-output" name="permission-checker.jvmMain" />
</root>
</artifact>
</component>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{Node.js Core}" />
</component>
</project>

View file

@ -4,7 +4,7 @@ plugins {
} }
group = "org.thundernetwork.permissionchecker" group = "org.thundernetwork.permissionchecker"
version = "2.1" version = "2.2"
repositories { repositories {
mavenCentral() mavenCentral()
@ -15,10 +15,11 @@ dependencies {
kotlin { kotlin {
jvm {} jvm {}
js { js (IR) {
nodejs { nodejs {}
} binaries.library()
binaries.executable() generateTypeScriptDefinitions()
useEsModules()
} }
sourceSets { 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 { publishing {
// publications { // publications {

View file

@ -1,10 +1,5 @@
package org.thundernetwork.permissionchecker package org.thundernetwork.permissionchecker
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
@OptIn(ExperimentalJsExport::class)
@JsExport
fun checkSingle(permission: String, requiredPermission: String): Boolean { fun checkSingle(permission: String, requiredPermission: String): Boolean {
var answer = false var answer = false
if (permission === "*") answer = true if (permission === "*") answer = true
@ -24,8 +19,6 @@ fun checkSingle(permission: String, requiredPermission: String): Boolean {
return answer return answer
} }
@OptIn(ExperimentalJsExport::class)
@JsExport
fun checkList(permission: Array<String>, requiredPermission: Array<String>): Boolean { fun checkList(permission: Array<String>, requiredPermission: Array<String>): Boolean {
var actualLength = 0 var actualLength = 0
val requiredLength = requiredPermission.size val requiredLength = requiredPermission.size

View file

@ -1 +1,14 @@
package org.thundernetwork.permissionchecker // 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<String>, requiredPermission: Array<String>): Boolean {
return org.thundernetwork.permissionchecker.checkList(permission, requiredPermission)
}