On Thu, Jan 28, 2021 at 9:59 PM JumpStart < geoff.callender.jumpst...@gmail.com> wrote:
> As requested, I’ve created a ticket for it. TAP5-2661 - Allow options to > be passed to GoogleClosureMinimizer < > https://issues.apache.org/jira/browse/TAP5-2661> . > Ben implemented it and Tapestry 5.6.2, with that and some other stuff, is up to voting in the Dev mailing list now. 5.7.0 too. > > Thanks for the responses, lads. > > > On 28 Jan 2021, at 9:32 pm, Ben Weidig <b...@netzgut.net> wrote: > > > > Hi, > > > > the GoogleClosureMinimizer and its non-configurability is on my personal > > "things to look at" list for quite some time. > > We ran into issues in the past, and it popped up on the mailing list last > > year a few times IIRC. > > > > So far, you need either to set > > TapestryConstants.DISABLE_JAVASCRIPT_MINIMIZATION in an appropriate place > > like a RequestFilter, or disable minimization altogether. > > > > My initial thought is a CompilerOptionsFactory/Provider with a default > > implementation. > > > > I didn't find any information if the options are thread-safe and could be > > reused, so contributing it as a symbol (as an alternative to a factory) > > might not be feasible. > > > > If I find some time this weekend I try to (finally) take a deeper look at > > it. > > > > Cheers, > > Ben > > > > On Thu, Jan 28, 2021 at 1:16 PM Thiago H. de Paula Figueiredo < > > thiag...@gmail.com> wrote: > > > >> Hello, Geoff! > >> > >> Looking at GoogleClosureMinimizer, I cannot see how the options can be > >> customized. Could you please create a Jira issue so we can fix this in > >> 5.7.0? Thanks in advance. > >> > >> Cheers! > >> > >> On Thu, Jan 28, 2021 at 6:31 AM JumpStart < > >> geoff.callender.jumpst...@gmail.com> wrote: > >> > >>> Can I pass options to GoogleClosureMinimizer at runtime? > >>> > >>> I have a 3rd party javascript file (html2canvas.min.js) that > >>> tapestry-webresources is failing to parse because the JS is using > >>> javascript getters, which I think were introduced in ECMASCRIPT5. > >>> > >>> 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. > >>> > >>> As I am targeting only modern versions of Chrome and Safari, it seems > >> that > >>> I could fix this by passing option —language_in=ECMASCRIPT5 to > >>> google-closure-compiler, but how can I do this? Is there a system > >> property > >>> I can provide at runtime? > >>> > >>> In case it helps, here’s the stack trace... > >>> > >>> 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 yo > >>> u 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 > >>> > >>> Cheers, > >>> > >>> Geoff > >> > >> > >> > >> -- > >> Thiago > >> > > -- Thiago