Skip to content

Commit 60331fd

Browse files
committed
feat(script): 添加 Nashorn 编译器的 ASM 依赖
- 添加 asm 等依赖解决 JavaScript 模块编译失效问题
1 parent c673261 commit 60331fd

File tree

1 file changed

+25
-0
lines changed
  • plugin/src/main/kotlin/trplugins/menu/module/internal/script/js

1 file changed

+25
-0
lines changed

plugin/src/main/kotlin/trplugins/menu/module/internal/script/js/NashornAgent.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
package trplugins.menu.module.internal.script.js
22

33
import com.google.common.collect.Maps
4+
import taboolib.common.env.RuntimeDependencies
5+
import taboolib.common.env.RuntimeDependency
46
import taboolib.common5.compileJS
57
import trplugins.menu.util.EvalResult
68
import javax.script.CompiledScript
79
import javax.script.SimpleScriptContext
810

11+
@RuntimeDependencies(
12+
RuntimeDependency(
13+
"!org.ow2.asm:asm:9.7.1",
14+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
15+
),
16+
RuntimeDependency(
17+
"!org.ow2.asm:asm-commons:9.7.1",
18+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
19+
),
20+
RuntimeDependency(
21+
"!org.ow2.asm:asm-tree:9.7.1",
22+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
23+
),
24+
RuntimeDependency(
25+
"!org.ow2.asm:asm-util:9.7.1",
26+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
27+
),
28+
RuntimeDependency(
29+
"!org.ow2.asm:asm-analysis:9.7.1",
30+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
31+
)
32+
)
33+
934
object NashornAgent {
1035
private val compiledScripts = Maps.newConcurrentMap<String, CompiledScript>();
1136
fun preCompile(script: String): CompiledScript {

0 commit comments

Comments
 (0)