Browse Source

Pull request #9866: KERNEL-12469 js引擎j2v8剥离成独立插件

Merge in DESIGN/design from ~PENGDA/design:release/11.0 to release/11.0

* commit 'c4c8125cfa8d4a841f1021ea1209ede2ce7bc3cb':
  KERNEL-12469 js引擎j2v8剥离成独立插件
release/11.0
pengda 2 years ago
parent
commit
0d779628b5
  1. 16
      designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java

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

@ -1,16 +1,6 @@
package com.fr.design.javascript.beautify; package com.fr.design.javascript.beautify;
import com.eclipsesource.v8.V8;
import com.eclipsesource.v8.V8Array;
import com.eclipsesource.v8.V8Object;
import com.eclipsesource.v8.utils.V8ObjectUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
public class JavaScriptFormatHelper { public class JavaScriptFormatHelper {
@ -33,7 +23,7 @@ public class JavaScriptFormatHelper {
* @see <a href="https://github.com/beautify-web/js-beautify">JSBeautify<a/> * @see <a href="https://github.com/beautify-web/js-beautify">JSBeautify<a/>
*/ */
public static String beautify(String jsCode, BeautifyOption option) { public static String beautify(String jsCode, BeautifyOption option) {
InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js"); /* InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js");
String result = jsCode; String result = jsCode;
V8 v8 = V8.createV8Runtime(); V8 v8 = V8.createV8Runtime();
try { try {
@ -49,8 +39,8 @@ public class JavaScriptFormatHelper {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally { } finally {
v8.release(true); v8.release(true);
} }*/
return result; return jsCode;
} }
public static void main(String[] args) { public static void main(String[] args) {

Loading…
Cancel
Save