diff --git a/jaggr-core/WebContent/loaderExtCommon.js b/jaggr-core/WebContent/loaderExtCommon.js index 088542da..cc6b1a07 100644 --- a/jaggr-core/WebContent/loaderExtCommon.js +++ b/jaggr-core/WebContent/loaderExtCommon.js @@ -53,13 +53,14 @@ var params = { extraArgs = {}, + featureFilter = /** * Default feature filter allows all features * - * @return true if the specified feature should be included + * @return {boolean} true if the specified feature should be included * in the list of features sent to the aggregator */ - featureFilter = function(feature) {return true;}, + function(feature) {return true;}, /** * Array of functions that process a url, returning the new, @@ -88,6 +89,7 @@ var params = { return size; }, + addFoldedModuleName = /** * Adds the module specified by dep to the list of folded module names * in oFolded. @@ -107,7 +109,7 @@ var params = { * plugin, then the plugin name and its ordinal are added to this * map. */ - addFoldedModuleName = function(dep, position, oFolded, oPrefixes) { + function(dep, position, oFolded, oPrefixes) { var name = dep.name, segments = name.split('/'), len = segments.length, @@ -146,6 +148,7 @@ var params = { } }, + addModuleIdEncoded = /** * Adds the module specified by dep to the encoded module id list at the specified * list position. The encoded module id list uses the mapping of module name to @@ -179,7 +182,7 @@ var params = { * the server. * @return true if the module was added to the encoded list */ - addModuleIdEncoded = function(dep, position, encodedIds, moduleIdMap) { + function(dep, position, encodedIds, moduleIdMap) { var nameId = moduleIdMap[dep.name], result = false, pluginNameId = dep.prefix ? moduleIdMap[dep.prefix] : 0; @@ -266,6 +269,7 @@ var params = { return asEnc.join(''); }, + base64EncodeModuleIds = /** * Performs base64 encoding of the encoded module id list * @@ -275,7 +279,7 @@ var params = { * the base64 encoder * @return the URL safe base64 encoded representation of the number array */ - base64EncodeModuleIds = function(ids, encoder, idListHash) { + function(ids, encoder, idListHash) { // First, determine the max id. If max id is less than 64k, then we can // use 16-bit encoding. Otherwise, we need to use 32-bit encoding. var use32BitEncoding = false; @@ -305,6 +309,7 @@ var params = { }); }, + addModulesToUrl = /** * Adds the list of modules specified in opt_deps to the request as * request URL query args. For each module in the list, we will try @@ -327,7 +332,7 @@ var params = { * the base64 encoder to use for encoding the encoded module id * list. */ - addModulesToUrl = function(url, argNames, opt_deps, moduleIdMap, base64Encoder) { + function(url, argNames, opt_deps, moduleIdMap, base64Encoder) { var oFolded = {}, oPrefixes = {}, ids = [], diff --git a/jaggr-core/pom.xml b/jaggr-core/pom.xml index 53a41aac..c0e2ac25 100644 --- a/jaggr-core/pom.xml +++ b/jaggr-core/pom.xml @@ -177,6 +177,8 @@ closure-compiler, + protobuf-java, + gson, commons-codec, commons-io, commons-lang3, @@ -392,6 +394,14 @@ com.google.javascript closure-compiler + + com.google.protobuf + protobuf-java + + + com.google.code.gson + gson + org.mozilla rhino diff --git a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepParser.java b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepParser.java index 3a36de37..2d4798fb 100644 --- a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepParser.java +++ b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepParser.java @@ -21,11 +21,12 @@ import com.ibm.jaggr.core.util.CompilerUtil; import com.google.javascript.jscomp.Compiler; -import com.google.javascript.jscomp.JSSourceFile; +import com.google.javascript.jscomp.SourceFile; import com.google.javascript.rhino.Node; import java.io.InputStream; import java.net.URI; +import java.nio.charset.Charset; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -77,7 +78,7 @@ public URI call() throws Exception { InputStream in = resource.getInputStream(); Node node = null; try { - node = compiler.parse(JSSourceFile.fromInputStream(resource.getURI().toString(), in)); + node = compiler.parse(SourceFile.fromInputStream(resource.getURI().toString(), in, Charset.forName("UTF-8"))); //$NON-NLS-1$ } catch (Throwable e) { if (log.isLoggable(Level.WARNING)) { log.log(Level.WARNING, "Error occurred parsing " + resource.getURI().toString() + ": " + e.getMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPass.java b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPass.java index e0029ee8..847a52d6 100644 --- a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPass.java +++ b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPass.java @@ -56,7 +56,7 @@ public void processChildren(Node node) { name.getString().equals("define")) { // name is "define" //$NON-NLS-1$ Node param = name.getNext(); if (param != null && param.getType() != Token.STRING) { - String expname = name.getProp(Node.SOURCENAME_PROP).toString(); + String expname = name.getSourceFileName(); if (source != null) { PositionLocator locator = source.locate(name.getLineno(), name.getCharno()+6); char tok = locator.findNextJSToken(); // move cursor to the open paren diff --git a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java index af9ad343..1d416115 100644 --- a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java +++ b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/JavaScriptModuleBuilder.java @@ -48,7 +48,6 @@ import com.ibm.jaggr.core.util.RequestUtil; import com.ibm.jaggr.core.util.StringUtil; -import com.google.common.collect.HashMultimap; import com.google.javascript.jscomp.CheckLevel; import com.google.javascript.jscomp.CompilationLevel; import com.google.javascript.jscomp.Compiler; @@ -56,13 +55,14 @@ import com.google.javascript.jscomp.CustomPassExecutionTime; import com.google.javascript.jscomp.DiagnosticGroups; import com.google.javascript.jscomp.JSError; -import com.google.javascript.jscomp.JSSourceFile; import com.google.javascript.jscomp.Result; +import com.google.javascript.jscomp.SourceFile; import org.apache.commons.lang3.mutable.MutableBoolean; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; @@ -94,7 +94,7 @@ public class JavaScriptModuleBuilder implements IModuleBuilder, IExtensionInitializer, ILayerListener, IShutdownListener { private static final Logger log = Logger.getLogger(JavaScriptModuleBuilder.class.getName()); - private static final List externs = Collections.emptyList(); + private static final List externs = Collections.emptyList(); /** * Name of the request attribute containing the expanded dependencies for @@ -306,7 +306,7 @@ public ModuleBuild build( throw new NotFoundException(resource.getURI().toString()); } - List sources = this.getJSSource(mid, resource, request, keyGens); + List sources = this.getJSSource(mid, resource, request, keyGens); JSSource source = null; if (level == null) { @@ -314,7 +314,7 @@ public ModuleBuild build( // when expanding require lists and exporting module names because the // parsed AST produced by closure does not preserve whitespace and comments. StringBuffer code = new StringBuffer(); - for (JSSourceFile sf : sources) { + for (SourceFile sf : sources) { code.append(sf.getCode()); } source = new JSSource(code.toString(), mid); @@ -336,7 +336,7 @@ public ModuleBuild build( Compiler compiler = new Compiler(); CompilerOptions compiler_options = CompilerUtil.getDefaultOptions(); - compiler_options.customPasses = HashMultimap.create(); + //compiler_options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); if (isHasFiltering && (level != null || keyGens == null)) { // Run has filtering compiler pass if we are doing has filtering, or if this // is the first build for this module (keyGens == null) so that we can get @@ -346,7 +346,7 @@ public ModuleBuild build( keyGens == null ? hasFiltDiscoveredHasConditionals : null, coerceUndefinedToFalse ); - compiler_options.customPasses.put(CustomPassExecutionTime.BEFORE_CHECKS, hfcp); + compiler_options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS, hfcp); } boolean isReqExpLogging = RequestUtil.isDependencyExpansionLogging(request); @@ -371,7 +371,7 @@ public ModuleBuild build( isReqExpLogging, source); - compiler_options.customPasses.put(CustomPassExecutionTime.BEFORE_CHECKS, recp); + compiler_options.addCustomPass(CustomPassExecutionTime.BEFORE_CHECKS, recp); // Call IRequestedModuleNames.getBaseLayerDeps() in case it throws an exception so that // we propagate it here instead of in layerBeginEndNotifier where we can't propagate @@ -382,7 +382,7 @@ public ModuleBuild build( } } if (RequestUtil.isExportModuleName(request)) { - compiler_options.customPasses.put( + compiler_options.addCustomPass( CustomPassExecutionTime.BEFORE_CHECKS, new ExportModuleNameCompilerPass(source) ); @@ -459,7 +459,7 @@ public ModuleBuild build( // together with the uncompressed source. String errorMsg = StringUtil.escapeForJavaScript(sb.toString()); StringBuffer code = new StringBuffer(); - for (JSSourceFile sf : sources) { + for (SourceFile sf : sources) { code.append(sf.getCode()); } return new ModuleBuild(code.toString(), null, errorMsg); @@ -490,11 +490,11 @@ public ModuleBuild build( * @return the list of source files * @throws IOException */ - protected List getJSSource(String mid, IResource resource, HttpServletRequest request, List keyGens) throws IOException { + protected List getJSSource(String mid, IResource resource, HttpServletRequest request, List keyGens) throws IOException { - List result = new LinkedList(); + List result = new LinkedList(); InputStream in = resource.getInputStream(); - JSSourceFile sf = JSSourceFile.fromInputStream(mid, in); + SourceFile sf = SourceFile.fromInputStream(mid, in, Charset.forName("UTF-8")); //$NON-NLS-1$ sf.setOriginalPath(resource.getURI().toString()); in.close(); result.add(sf); diff --git a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java index 2defd838..c9d32437 100644 --- a/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java +++ b/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPass.java @@ -236,7 +236,7 @@ public void processChildren(Node node, List enclosingDependencie ) : null, false); } else if ((dependencies = NodeUtil.moduleDepsFromDefine(cursor)) != null) { - String moduleName = cursor.getFirstChild().getProp(Node.SOURCENAME_PROP).toString(); + String moduleName = cursor.getFirstChild().getSourceFileName(); if (aggregator.getOptions().isDevelopmentMode() && aggregator.getOptions().isVerifyDeps()) { @@ -311,7 +311,7 @@ private void expandRequireList(Node array, List enclosingDepende return; } List msg = new LinkedList(); - String moduleName = array.getParent().getProp(Node.SOURCENAME_PROP).toString(); + String moduleName = array.getParent().getSourceFileName(); if (logDebug) { msg.add("%c" + MessageFormat.format( //$NON-NLS-1$ Messages.RequireExpansionCompilerPass_6, diff --git a/jaggr-core/src/main/java/com/ibm/jaggr/core/util/NodeUtil.java b/jaggr-core/src/main/java/com/ibm/jaggr/core/util/NodeUtil.java index f7f648f8..886d09ec 100644 --- a/jaggr-core/src/main/java/com/ibm/jaggr/core/util/NodeUtil.java +++ b/jaggr-core/src/main/java/com/ibm/jaggr/core/util/NodeUtil.java @@ -143,7 +143,8 @@ public static Node moduleDepsFromRequire(Node cursor) { * null. */ public static Node moduleDepsFromConfigDeps(Node cursor, String configVarName) { - if (cursor.getType() == Token.STRING && cursor.getString().equals("deps")) { //$NON-NLS-1$ + if ((cursor.getType() == Token.STRING || cursor.getType() == Token.STRING_KEY) + && cursor.getString().equals("deps")) { //$NON-NLS-1$ // handle require.deps assignment of array literal Node parent = cursor.getParent(), previousSibling = parent.getChildBefore(cursor); @@ -177,7 +178,7 @@ public static Node moduleDepsFromConfigDeps(Node cursor, String configVarName) { // var require = { deps: [...] } return cursor.getFirstChild(); } else if (parent.getType() == Token.OBJECTLIT && - parent.getParent().getType() == Token.STRING && + parent.getParent().getType() == Token.STRING_KEY && parent.getParent().getString().equals(configVarName) && parent.getParent().getParent().getType() == Token.OBJECTLIT && cursor.getFirstChild() != null && diff --git a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/deps/DepUtilsTest.java b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/deps/DepUtilsTest.java index db7699f3..049d5e0f 100644 --- a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/deps/DepUtilsTest.java +++ b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/deps/DepUtilsTest.java @@ -23,7 +23,7 @@ import com.ibm.jaggr.core.impl.deps.DepUtils.ParseResult; import com.google.javascript.jscomp.Compiler; -import com.google.javascript.jscomp.JSSourceFile; +import com.google.javascript.jscomp.SourceFile; import com.google.javascript.rhino.Node; import org.junit.Test; @@ -123,25 +123,25 @@ public void testParseDependencies() { Compiler compiler = new Compiler(); - Node node = compiler.parse(JSSourceFile.fromCode("js1", js1)); + Node node = compiler.parse(SourceFile.fromCode("js1", js1)); Collection deps = DepUtils.parseDependencies(node, new HashSet()).getDefineDependencies(); assertEquals(deps.toString(), "[a, b, c]"); - node = compiler.parse(JSSourceFile.fromCode("js2", js2)); + node = compiler.parse(SourceFile.fromCode("js2", js2)); deps = DepUtils.parseDependencies(node, new HashSet()).getDefineDependencies(); assertEquals(deps.toString(), "[a, b, c]"); - node = compiler.parse(JSSourceFile.fromCode("js3", js3)); + node = compiler.parse(SourceFile.fromCode("js3", js3)); deps = DepUtils.parseDependencies(node, new HashSet()).getDefineDependencies(); assertEquals(deps.size(), 0); - node = compiler.parse(JSSourceFile.fromCode("js4", js4)); + node = compiler.parse(SourceFile.fromCode("js4", js4)); deps = DepUtils.parseDependencies(node, new HashSet()).getDefineDependencies(); assertEquals(deps.toString(), "[a, b, c]"); - node = compiler.parse(JSSourceFile.fromCode("js5", js5)); + node = compiler.parse(SourceFile.fromCode("js5", js5)); deps = DepUtils.parseDependencies(node, new HashSet()).getDefineDependencies(); assertNull(deps); - node = compiler.parse(JSSourceFile.fromCode("js6", js6)); + node = compiler.parse(SourceFile.fromCode("js6", js6)); deps = DepUtils.parseDependencies(node, new HashSet()).getDefineDependencies(); assertNull(deps); - node = compiler.parse(JSSourceFile.fromCode("js7", js7)); + node = compiler.parse(SourceFile.fromCode("js7", js7)); // Test dependent features Set dependentFeatures = new HashSet(); ParseResult parseResult = DepUtils.parseDependencies(node, dependentFeatures); diff --git a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPassTest.java b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPassTest.java index 45581a56..af872b92 100644 --- a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPassTest.java +++ b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/ExportModuleNameCompilerPassTest.java @@ -20,7 +20,7 @@ import com.google.javascript.jscomp.Compiler; import com.google.javascript.jscomp.Compiler.CodeBuilder; -import com.google.javascript.jscomp.JSSourceFile; +import com.google.javascript.jscomp.SourceFile; import com.google.javascript.rhino.Node; import org.junit.Test; @@ -80,7 +80,7 @@ public void testSourceUpdate() throws Exception { private String runPass(String moduleName, String code) { Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode(moduleName, code)); + Node root = compiler.parse(SourceFile.fromCode(moduleName, code)); pass.process(null, root); CodeBuilder cb = new CodeBuilder(); compiler.toSource(cb, 0, root); diff --git a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/HasFilteringCompilerPassTest.java b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/HasFilteringCompilerPassTest.java index b5596b3d..8cf26879 100644 --- a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/HasFilteringCompilerPassTest.java +++ b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/HasFilteringCompilerPassTest.java @@ -16,12 +16,11 @@ package com.ibm.jaggr.core.impl.modulebuilder.javascript; -import com.ibm.jaggr.core.impl.modulebuilder.javascript.HasFilteringCompilerPass; import com.ibm.jaggr.core.util.Features; import com.google.javascript.jscomp.Compiler; import com.google.javascript.jscomp.Compiler.CodeBuilder; -import com.google.javascript.jscomp.JSSourceFile; +import com.google.javascript.jscomp.SourceFile; import com.google.javascript.rhino.Node; import org.junit.Assert; @@ -193,7 +192,7 @@ public void testProcess() throws Exception { private String runPass(HasFilteringCompilerPass pass, String code) { Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("test", code)); + Node root = compiler.parse(SourceFile.fromCode("test", code)); pass.process(null, root); CodeBuilder cb = new CodeBuilder(); compiler.toSource(cb, 0, root); diff --git a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPassTest.java b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPassTest.java index e4e38a96..661e68e0 100644 --- a/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPassTest.java +++ b/jaggr-core/src/test/java/com/ibm/jaggr/core/impl/modulebuilder/javascript/RequireExpansionCompilerPassTest.java @@ -23,13 +23,12 @@ import com.ibm.jaggr.core.test.TestUtils; import com.ibm.jaggr.core.util.Features; -import com.google.common.collect.HashMultimap; import com.google.javascript.jscomp.CompilationLevel; import com.google.javascript.jscomp.Compiler; import com.google.javascript.jscomp.Compiler.CodeBuilder; import com.google.javascript.jscomp.CompilerOptions; import com.google.javascript.jscomp.CustomPassExecutionTime; -import com.google.javascript.jscomp.JSSourceFile; +import com.google.javascript.jscomp.SourceFile; import com.google.javascript.rhino.Node; import org.apache.commons.lang3.mutable.MutableBoolean; @@ -292,7 +291,7 @@ public void testRequireExpansion() throws Exception { } - private static final List externs = Collections.emptyList(); + private static final List externs = Collections.emptyList(); /* * Ensure that arrays of strings are not mutated into expressions of the form @@ -302,8 +301,8 @@ public void testRequireExpansion() throws Exception { @Test public void testArrayMutation() throws Exception { String code = "define([\"module\"],function(bar){require([\"foo\", \"abc\", \"bcd\", \"cde\", \"def\", \"efg\", \"fgh\", \"ghi\"]);});"; - JSSourceFile sf = JSSourceFile.fromCode("test", code); - List sources = new ArrayList(); + SourceFile sf = SourceFile.fromCode("test", code); + List sources = new ArrayList(); sources.add(sf); Compiler compiler = new Compiler(); CompilerOptions compiler_options = new CompilerOptions(); @@ -325,8 +324,7 @@ public void testArrayMutation() throws Exception { compiler = new Compiler(); compiler_options = new CompilerOptions(); CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(compiler_options); - compiler_options.customPasses = HashMultimap.create(); - compiler_options.customPasses.put(CustomPassExecutionTime.BEFORE_CHECKS, pass); + compiler_options.addCustomPass(CustomPassExecutionTime.BEFORE_CHECKS, pass); compiler.compile(externs, sources, compiler_options); output = compiler.toSource(); System.out.println(output); @@ -604,7 +602,7 @@ public void testLogging() throws Exception { private String runPass(RequireExpansionCompilerPass pass, String code) { Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode(moduleName, code)); + Node root = compiler.parse(SourceFile.fromCode(moduleName, code)); pass.process(null, root); CodeBuilder cb = new CodeBuilder(); compiler.toSource(cb, 0, root); diff --git a/jaggr-core/src/test/java/com/ibm/jaggr/core/util/JSSourceTest.java b/jaggr-core/src/test/java/com/ibm/jaggr/core/util/JSSourceTest.java index e2f60660..3ee40e19 100644 --- a/jaggr-core/src/test/java/com/ibm/jaggr/core/util/JSSourceTest.java +++ b/jaggr-core/src/test/java/com/ibm/jaggr/core/util/JSSourceTest.java @@ -16,7 +16,7 @@ package com.ibm.jaggr.core.util; import com.google.javascript.jscomp.Compiler; -import com.google.javascript.jscomp.JSSourceFile; +import com.google.javascript.jscomp.SourceFile; import com.google.javascript.rhino.Node; import org.junit.Test; @@ -91,7 +91,7 @@ public void testAppendToArray_basic() throws IOException { "});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); @@ -114,7 +114,7 @@ public void testAppendToArray_var() throws IOException { "});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); @@ -145,7 +145,7 @@ public void testAppendToArray_newline() throws IOException { "});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); @@ -174,7 +174,7 @@ public void testAppendToArray_newlineLineComment() throws IOException { "});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); @@ -203,7 +203,7 @@ public void testAppendToArray_singleLineBlockComment() throws IOException { "});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); @@ -234,7 +234,7 @@ public void testAppendToArray_multiLineBlockComment() throws IOException { "});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); @@ -273,7 +273,7 @@ public void testAppendToArray_multiLineSpaces() throws IOException { "});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); @@ -296,7 +296,7 @@ public void testAppendToArray_lastLine() throws IOException { " ,\"insertedDep\"], function(dep1, dep2) {alert('hello world');});});"; Compiler compiler = new Compiler(); - Node root = compiler.parse(JSSourceFile.fromCode("file", "name", code)); + Node root = compiler.parse(SourceFile.fromCode("name", code)); Node array = findRequireDeps(root); JSSource source = new JSSource(code, null); source.appendToArrayLit(array, "insertedDep"); diff --git a/jaggr-sample-dojo/plugin.xml b/jaggr-sample-dojo/plugin.xml index 051ce1ca..39c9dc91 100644 --- a/jaggr-sample-dojo/plugin.xml +++ b/jaggr-sample-dojo/plugin.xml @@ -23,12 +23,12 @@ - + - - - + + + diff --git a/jaggr-sample-dojo/pom.xml b/jaggr-sample-dojo/pom.xml index 3a123474..6f444401 100644 --- a/jaggr-sample-dojo/pom.xml +++ b/jaggr-sample-dojo/pom.xml @@ -103,7 +103,7 @@ - + diff --git a/jaggr-sample-dojo/source_1.8.0-20120830-IBM_dojo.zip b/jaggr-sample-dojo/source_1.10.4-20150621-IBM_dojo.zip similarity index 58% rename from jaggr-sample-dojo/source_1.8.0-20120830-IBM_dojo.zip rename to jaggr-sample-dojo/source_1.10.4-20150621-IBM_dojo.zip index cd3a84fe..0d5bce1b 100644 Binary files a/jaggr-sample-dojo/source_1.8.0-20120830-IBM_dojo.zip and b/jaggr-sample-dojo/source_1.10.4-20150621-IBM_dojo.zip differ diff --git a/jaggr-sample/WebContent/js/css.js b/jaggr-sample/WebContent/js/css.js index 93118afe..2975bbc6 100644 --- a/jaggr-sample/WebContent/js/css.js +++ b/jaggr-sample/WebContent/js/css.js @@ -402,7 +402,7 @@ define([ /* * Installs the global require() and define() function intercepts. * - * @return An object with a remove() function that can be called to cancel the intercepts + * Return an object with a remove() function that can be called to cancel the intercepts * (useful for unit testing). */ installAutoInjectHooks: function() { diff --git a/jaggr-sample/WebContent/js/loaderConfig.js b/jaggr-sample/WebContent/js/loaderConfig.js index 6fa88f5d..49b1c0f5 100644 --- a/jaggr-sample/WebContent/js/loaderConfig.js +++ b/jaggr-sample/WebContent/js/loaderConfig.js @@ -24,17 +24,17 @@ packages: [ { name: 'dojo', - location: 'dojo-1.8.0/dojo', + location: 'dojo/dojo', lib: '.' }, { name: 'dijit', - location: 'dojo-1.8.0/dijit', + location: 'dojo/dijit', lib: '.' }, { name: 'dojox', - location: 'dojo-1.8.0/dojox', + location: 'dojo/dojox', lib: '.' } ], diff --git a/jaggr-sample/WebContent/test-no-aggr.html b/jaggr-sample/WebContent/test-no-aggr.html index 6622ffaa..b3eeb745 100644 --- a/jaggr-sample/WebContent/test-no-aggr.html +++ b/jaggr-sample/WebContent/test-no-aggr.html @@ -24,7 +24,7 @@ - +
diff --git a/jaggr-sample/plugin.xml b/jaggr-sample/plugin.xml index b8f61af6..4bc56c83 100644 --- a/jaggr-sample/plugin.xml +++ b/jaggr-sample/plugin.xml @@ -36,8 +36,8 @@ - - + + diff --git a/jaggr-sample/src/test/javascript/testCss.js b/jaggr-sample/src/test/javascript/testCss.js index 989acd51..b1a3136c 100644 --- a/jaggr-sample/src/test/javascript/testCss.js +++ b/jaggr-sample/src/test/javascript/testCss.js @@ -151,21 +151,26 @@ define(['require', 'dojo/has', 'dojo/_base/window', 'js/css', 'dojo/query', "doj style = test; }); }); + waitsFor(function() { return style; }); + runs(function() { expect(style.innerHTML).toBe('.html {color: red;}'); }); + }); }); describe("tests css-inject-api feature", function() { var undef, signal; beforeEach(function() { - require.undef("js/css"); css = undef; - require.undef("spec/styles/test.css"); + require.undef("js/css"); + require.undef("js/css!spec/styles/test.css"); + delete require.modules["js/css"]; + delete require.modules["js/css!spec/styles/test.css"]; }); afterEach(function() { diff --git a/jaggr-sample/testaggr-config.js b/jaggr-sample/testaggr-config.js index de11460c..4abda6a6 100644 --- a/jaggr-sample/testaggr-config.js +++ b/jaggr-sample/testaggr-config.js @@ -21,15 +21,15 @@ packages: [ { name: 'dojo', - location: 'namedbundleresource:///com.ibm.jaggr.sample.dojo/WebContent/source_1.8.0-20120830-IBM_dojo/dojo' + location: 'namedbundleresource:///com.ibm.jaggr.sample.dojo/WebContent/source_1.10.4-20150621-IBM_dojo/dojo' }, { name: 'dijit', - location: 'namedbundleresource:///com.ibm.jaggr.sample.dojo/WebContent/source_1.8.0-20120830-IBM_dojo/dijit' + location: 'namedbundleresource:///com.ibm.jaggr.sample.dojo/WebContent/source_1.10.4-20150621-IBM_dojo/dijit' }, { name: 'dojox', - location: 'namedbundleresource:///com.ibm.jaggr.sample.dojo/WebContent/source_1.8.0-20120830-IBM_dojo/dojox' + location: 'namedbundleresource:///com.ibm.jaggr.sample.dojo/WebContent/source_1.10.4-20150621-IBM_dojo/dojox' } ], paths: { diff --git a/pom.xml b/pom.xml index 318469a8..4b8c20ea 100644 --- a/pom.xml +++ b/pom.xml @@ -381,8 +381,17 @@ com.google.javascript closure-compiler - - r1918 + v20150609 + + + com.google.protobuf + protobuf-java + 2.6.1 + + + com.google.code.gson + gson + 2.3.1 org.mozilla