public String compressJavaScript(final String source) throws Exception String reply = (String) Main.shellContextFactory.call(new ContextAction()
public void setStrictMode(boolean flag) { checkNotSealed(); this.strictMode = flag; }
/** * Read file or url specified by <tt>path</tt>. * @return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if * <tt>convertToString</tt> is true. */ private static Object readFileOrUrl(String path, boolean convertToString) throws IOException { return SourceReader.readFileOrUrl(path, convertToString, shellContextFactory.getCharacterEncoding()); }
break goodUsage; shellContextFactory.setLanguageVersion(version); continue; break goodUsage; shellContextFactory.setOptimizationLevel(opt); continue; shellContextFactory.setCharacterEncoding(enc); continue; shellContextFactory.setStrictMode(true); errorReporter.setIsReportingWarnings(true); continue; shellContextFactory.setWarningAsError(true); continue; shellContextFactory.call(iproxy); continue; shellContextFactory.setGeneratingDebug(true); continue;
public static void main(String[] args) { errorReporter = new ToolErrorReporter(false, global.getErr()); shellContextFactory.setErrorReporter(errorReporter); IProxy iproxy = new IProxy(IProxy.PROCESS_FILES, processOptions(args)); global.init(shellContextFactory); shellContextFactory.call(iproxy); }
/** * @throws Exception Likely if YUI is present, and not ShrinkSafe */ public ShrinkSafeCompressor() throws Exception { // This should fail if ShrinkSafe is not in classpath try { global = Main.getGlobal(); ToolErrorReporter errorReporter = new ToolErrorReporter(false, global.getErr()); Main.shellContextFactory.setErrorReporter(errorReporter); // Do a trial compression to check compressJavaScript(""); } catch (NoClassDefFoundError ex) { throw new InstantiationException("Could not setup ShrinkSafeCompressor because a class is missing, assuming shrinksafe.jar and js.jar are not in the classpath."); } catch (Exception ex) { Loggers.STARTUP.error("ShrinkSafeCompressor startup", ex); throw new InstantiationException("Could not setup ShrinkSafeCompressor, assuming shrinksafe.jar and js.jar are not in the classpath. Exception caught was " + ex); } }
shellContextFactory.setLanguageVersion(version);
break goodUsage; shellContextFactory.setLanguageVersion(version); continue; break goodUsage; shellContextFactory.setOptimizationLevel(opt); continue; shellContextFactory.setCharacterEncoding(enc); continue; shellContextFactory.setStrictMode(true); shellContextFactory.setAllowReservedKeywords(false); errorReporter.setIsReportingWarnings(true); continue; shellContextFactory.setWarningAsError(true); continue; shellContextFactory.call(iproxy); continue; shellContextFactory.setGeneratingDebug(true); continue;
/** * Execute the given arguments, but don't System.exit at the end. */ public static int exec(String origArgs[]) { errorReporter = new ToolErrorReporter(false, global.getErr()); shellContextFactory.setErrorReporter(errorReporter); String[] args = processOptions(origArgs); if (processStdin) { fileList.add(null); } if (!global.initialized) { global.init(shellContextFactory); } IProxy iproxy = new IProxy(IProxy.PROCESS_FILES); iproxy.args = args; shellContextFactory.call(iproxy); return exitCode; }
break goodUsage; shellContextFactory.setLanguageVersion(version); continue; break goodUsage; shellContextFactory.setOptimizationLevel(opt); continue; shellContextFactory.setCharacterEncoding(enc); continue; shellContextFactory.setStrictMode(true); shellContextFactory.setAllowReservedKeywords(false); errorReporter.setIsReportingWarnings(true); continue; shellContextFactory.setWarningAsError(true); continue; shellContextFactory.call(iproxy); continue; shellContextFactory.setGeneratingDebug(true); continue;
/** * Execute the given arguments, but don't System.exit at the end. */ public static int exec(String origArgs[]) { errorReporter = new ToolErrorReporter(false, global.getErr()); shellContextFactory.setErrorReporter(errorReporter); String[] args = processOptions(origArgs); if (processStdin) fileList.add(null); if (!global.initialized) { global.init(shellContextFactory); } IProxy iproxy = new IProxy(IProxy.PROCESS_FILES); iproxy.args = args; shellContextFactory.call(iproxy); return exitCode; }
public void setStrictMode(boolean flag) { checkNotSealed(); this.strictMode = flag; }
/** * Read file or url specified by <tt>path</tt>. * @return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if * <tt>convertToString</tt> is true. */ private static Object readFileOrUrl(String path, boolean convertToString) throws IOException { return SourceReader.readFileOrUrl(path, convertToString, shellContextFactory.getCharacterEncoding()); }
/** * Execute the given arguments, but don't System.exit at the end. */ public static int exec(String origArgs[]) { errorReporter = new ToolErrorReporter(false, global.getErr()); shellContextFactory.setErrorReporter(errorReporter); String[] args = processOptions(origArgs); if (processStdin) { fileList.add(null); } if (!global.initialized) { global.init(shellContextFactory); } IProxy iproxy = new IProxy(IProxy.PROCESS_FILES); iproxy.args = args; shellContextFactory.call(iproxy); return exitCode; }
public void setWarningAsError(boolean flag) { checkNotSealed(); this.warningAsError = flag; }
/** * Read file or url specified by <tt>path</tt>. * @return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if * <tt>convertToString</tt> is true. */ private static Object readFileOrUrl(String path, boolean convertToString) { try { return SourceReader.readFileOrUrl(path, convertToString, shellContextFactory.getCharacterEncoding()); } catch (IOException ex) { Context.reportError(ToolErrorReporter.getMessage( "msg.couldnt.read.source", path, ex.getMessage())); return null; } } }
public void setWarningAsError(boolean flag) { checkNotSealed(); this.warningAsError = flag; }
String charEnc = shellContextFactory.getCharacterEncoding(); if(charEnc == null)
public void setStrictMode(boolean flag) { checkNotSealed(); this.strictMode = flag; }
Scriptable scope = getShellScope(); Charset cs; String charEnc = shellContextFactory.getCharacterEncoding(); if (charEnc != null) { cs = Charset.forName(charEnc);