|
|
|
@ -1,16 +1,6 @@
|
|
|
|
|
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 { |
|
|
|
|
|
|
|
|
@ -33,7 +23,7 @@ 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"); |
|
|
|
|
/* InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js"); |
|
|
|
|
String result = jsCode; |
|
|
|
|
V8 v8 = V8.createV8Runtime(); |
|
|
|
|
try { |
|
|
|
@ -49,8 +39,8 @@ public class JavaScriptFormatHelper {
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} finally { |
|
|
|
|
v8.release(true); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
}*/ |
|
|
|
|
return jsCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|