Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2661

Allow options to be passed to GoogleClosureMinimizer

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.4.1, 5.5.0, 5.6.1
    • Fix Version/s: 5.6.2, 5.7.0
    • Component/s: tapestry-webresources
    • Labels:
      None

      Description

      We need a way to pass options via GoogleClosureMinimizer to the google-closure-compiler.

      This is becoming more important as JavaScript advances. For example, the minimizer now fails to parse a javascript file if it contains ECMASCRIPT5 (aka ECMAScript 2009) features such as getters. With third party javascript this can be a blocker.

      The google-closure-compiler used by GoogleClosureMinimizer accepts options that can control this behaviour. One such option is --language=ECMASCRIPT5 (see [google/closure-compiler|https://github.com/google/closure-compiler),] which will stop parser trying to protect us from earlier versions of javascript.

      Here is an example of the parser rejection, using tapestry-webresources-5.4.3:

      2021-01-28 04:31:40,536 ERROR [org.apache.tapestry5.ioc.Registry] (default task-14) Compilation failed: JSC_PARSE_ERROR. Parse error. getters are not supported in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option. at StreamableResource<text/javascript classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.
      2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default task-14) Operations trace:
      2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default task-14) [ 1] Streaming compressed module html2canvas.min
      2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default task-14) [ 2] Streaming classpath:META-INF/modules/html2canvas.min.js (compressed)
      2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default task-14) [ 3] Minimizing StreamableResource<text/javascript classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu Jan 28 03:44:05 UTC 2021 size: 165202>
      2021-01-28 04:31:40,544 ERROR [org.apache.tapestry5.modules.TapestryModule.RequestExceptionHandler] (default task-14) Processing of request failed with uncaught exception: org.apache.tapestry5.ioc.internal.OperationException: Compilation failed: JSC_PARS
      E_ERROR. Parse error. getters are not supported in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option. at StreamableResource<text/javascript classpath:META-INF/modules/html2canvas.min.j
      s COMPRESSABLE lastModified: Thu Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.: org.apache.tapestry5.ioc.internal.OperationException: Compilation failed: JSC_PARSE_ERROR. Parse error. getters are not supported in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option. at StreamableResource<text/javascript classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.

      Caused by: java.lang.RuntimeException: Compilation failed: JSC_PARSE_ERROR. Parse error. getters are not supported in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option. at StreamableResource<text/javascript classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.
              at org.apache.tapestry5.internal.webresources.GoogleClosureMinimizer.doMinimize(GoogleClosureMinimizer.java:97)
              at org.apache.tapestry5.internal.webresources.AbstractMinimizer$1.perform(AbstractMinimizer.java:72)
              at org.apache.tapestry5.internal.webresources.AbstractMinimizer$1.perform(AbstractMinimizer.java:68)
              at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
              ... 101 more

        Attachments

          Activity

            People

            • Assignee:
              ben-ng Ben Weidig
              Reporter:
              geoffcallender Geoff Callender
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: