Browse Source

KERNEL-12469 js引擎j2v8剥离成独立插件

release/11.0
pengda 2 years ago
parent
commit
afee1887d4
  1. 3
      designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java

3
designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java

@ -30,9 +30,8 @@ public class JavaScriptFormatHelper {
* @see <a href="https://github.com/beautify-web/js-beautify">JSBeautify<a/>
*/
public static String beautify(String jsCode, BeautifyOption option) {
InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js");
String result = jsCode;
try {
try (InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js")) {
ScriptEngine nashorn = new ScriptEngineManager().getEngineByName("JavaScript");
nashorn.eval(IOUtils.inputStream2String(resourceAsStream, EncodeConstants.ENCODING_UTF_8));
Invocable invocable = (Invocable) nashorn;

Loading…
Cancel
Save