You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/02/12 16:35:00 UTC

[jira] [Commented] (TAP5-2661) Allow options to be passed to GoogleClosureMinimizer

    [ https://issues.apache.org/jira/browse/TAP5-2661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17283812#comment-17283812 ] 

ASF subversion and git services commented on TAP5-2661:
-------------------------------------------------------

Commit d8c550fa04c38b2f2fb6923e9aceab7f18946c75 in tapestry-5's branch refs/heads/master from Benjamin Weidig
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=d8c550f ]

TAP5-2661: GoogleClosureMinimizerOptionsProvider added

The Google Closure compiler was previously used with a fixed options. Due to JavaScript edge-cases this could lead to problems for some JS code.
    
So far the only solutions were to either disable compression completely, or set the Request parameter "tapestry.disable-javascript-minimization", for example with a RequestFilter.
    
To give the user more fine-grained control over the options, the "GoogleClosureMinimizerOptionsProvider" is added. In addition to provide custom compiler options, an empty Optional can be returned, and the StreamableResource will be transferred "as-is".

> Allow options to be passed to GoogleClosureMinimizer
> ----------------------------------------------------
>
>                 Key: TAP5-2661
>                 URL: https://issues.apache.org/jira/browse/TAP5-2661
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-webresources
>    Affects Versions: 5.4.1, 5.5.0, 5.6.1
>            Reporter: Geoff Callender
>            Assignee: Benjamin Weidig
>            Priority: Major
>             Fix For: 5.7.0
>
>
> 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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)