Giter Site home page Giter Site logo

primefaces-extensions / resources-optimizer-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
25.0 9.0 15.0 551 KB

Maven plugin to compress and merge web JS/CSS resources

License: Apache License 2.0

Java 79.76% CSS 20.24%
maven-plugin primefaces css javascript java

resources-optimizer-maven-plugin's Introduction

Maven License Discord Chat Actions Status Stackoverflow

Resources Optimizer Maven Plugin

Maven plugin for web resource optimization of JS/CSS including:

  • compressing Javascript
  • transpiling Javascript from one version to another (e.g. ECMASCRIPT3 to ECMASCRIPT2015)
  • source map generation for Javascript
  • compressing and merging CSS
  • converting images to base64 encoded data-uri's embedded in your CSS
  • ...and more

See Wiki documentation for the configuration and usage of the plugin.

JDK 8

Warning

Plugin version 2.4.4 is the last to support JDK8 because of Google Closure Compiler stopped supporting JDK8.

JDK 11+

Important

Plugin version 2.5.0+ is for JDK11+

resources-optimizer-maven-plugin's People

Contributors

dependabot[bot] avatar ivu-rek avatar jensdallmann avatar melloware avatar muh3gpab avatar ova2 avatar stolp avatar tandraschko avatar vsevolodgolovanov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

resources-optimizer-maven-plugin's Issues

CSS: incorrectly applies and removes spaces to variables and calc functions

original: margin: 0 calc(var(--month-margin) / 2) var(--month-margin) 0;
bugged: margin: 0 calc(var(--month - margin) / 2)var(--month - margin) 0;

original: min-height: calc((var(--duration) * (var(--month-height) + var(--month-margin)) - var(--month-margin)));
bugged: min-height: calc((var(--duration) * (var(--month - height) + var(--month - margin)) - var(--month - margin)));
^^ also does it for max-height

original: top: calc(var(--month-offset) * (var(--month-height) + var(--month-margin)));
bugged: top: calc(var(--month - offset) * (var(--month - height) + var(--month - margin)));

original: width: calc(100% - 2 * var(--current-date-border));
bugged: width: calc(100% - 2 * var(--current-date - border));

it looks like it has a tendency to add spaces to variable names with dashes. At first I was wondering if I was just naming them weird but using dashes seems to be the standard for css variables, it also removed the space between calc() and var() in the first one.

CSS : Whitespaces removed around operator of calc() function

I'm facing a problem when optimizing CSS files containing the CSS function calc(), whitespaces inside this function are removed.

This problem only appear from 2.5.0 version. Previous versions didn't remove these whitespaces.

To be interpreted by browsers, the calc() function must have whitespaces around operator '-' or '+'.
Then, the expected behavior should be to not remove whitespaces for calc() function.

To reproduce the problem, you can use this CSS code and optimize it with plugin :
height: calc(100vh - 20px);

You should get this :
height: calc(100vh-20px);

The plugin should support the 'skip' plugin parameter

For faster builds it is desirable to skip non-essential maven targets in profiles.

Resource optimization is one of those targets and thus it should be able to control this via a plugin parameter.

I will provide a pull request for this.

resources-optimizer-maven-plugin: Option `useDataUri` has no effect

Describe the bug

Not sure if this is correct place for resources-optimizer-maven-plugin

The configuration like this:

<configuration>
    <useDataUri>false</useDataUri>
</configuration>

has no effect for version 2.6.0 (works as expected for 2.4.1

Reproducer

Steps:

  • run maven build
  • check minified CSS
    Result: images inlined

Expected behavior

images should remain external

PrimeFaces Extensions version

2.6.0

JSF implementation

None

JSF version

No response

Browser(s)

No response

Source files are being deleted, and only last file is being aggregated into the final file when no compression is forced

If I run the plugin with <compilationLevel>WHITESPACE_ONLY</compilationLevel> and <withoutCompress>true</withoutCompress>, once the build is completed, the source files will disappear and the resulting file will only contain the content of the last file in the source files list.
This is happening for both css and js files .

.pom content:

<plugin>
			  <groupId>org.primefaces.extensions</groupId>
			  <artifactId>resources-optimizer-maven-plugin</artifactId>
			  <version>2.5.6</version>
			  <executions>
			    <execution>
			      <id>optimize</id>
			      <goals>
			        <goal>optimize</goal>
			      </goals>
			    </execution>
			  </executions>
			  <configuration>
			    <compilationLevel>WHITESPACE_ONLY</compilationLevel>
			    <warningLevel>VERBOSE</warningLevel>
			    <failOnWarning>false</failOnWarning>
			    <suffix>-min</suffix>
			    <useDataUri>false</useDataUri>
			    <languageIn>ECMASCRIPT_2017</languageIn>
			    <languageOut>ECMASCRIPT_2017</languageOut>
			    <resourcesSets>
			      <resourcesSet>
			        <inputDir>${basedir}/src/main/resources/static/p/js</inputDir>
			        <includes>
			          <include>*.js</include>
			        </includes>
			        <excludes>
			          <exclude>./lib/*.js</exclude>
			        </excludes>
			        <aggregations>
				        <aggregation>
				          <withoutCompress>false</withoutCompress>
				          <outputFile>
				            ${project.build.directory}/webapp/resources/scripts.js
				          </outputFile>
				        </aggregation>
				      </aggregations>
			      </resourcesSet>
			      <resourcesSet>
			        <inputDir>${basedir}/src/main/resources/static/p</inputDir>
			        <includes>
			          <include>**/*.css</include>
			        </includes>
			        <aggregations>
			          <aggregation>
			            <outputFile>${project.build.directory}/webapp/resources/min.css</outputFile>
			          </aggregation>
			        </aggregations>
			      </resourcesSet>
			    </resourcesSets>
			  </configuration>        
			</plugin>
      </plugins>

logs:

INFO] --- resources-optimizer-maven-plugin:2.5.6:optimize (optimize) @ middleware ---
[INFO] Optimize JS file alerts.js ...
[INFO] Optimize JS file barcodeReader.js ...
[INFO] Optimize JS file camera.js ...
[INFO] Optimize JS file charts.js ...
[INFO] Optimize JS file contact.js ...
[INFO] Optimize JS file enLocalization.js ...
[INFO] Optimize JS file exchange.js ...
[INFO] Optimize JS file filter.js ...
[INFO] Optimize JS file friends.js ...
[INFO] Optimize JS file image.js ...
[INFO] Optimize JS file loading.js ...
[INFO] Optimize JS file locales.js ...
[INFO] Optimize JS file location.js ...
[INFO] Optimize JS file mainView.js ...
[INFO] Optimize JS file manageAds.js ...
[INFO] Optimize JS file manageCredits.js ...
[INFO] Optimize JS file maps.js ...
[INFO] Optimize JS file mwutils.js ...
[INFO] Optimize JS file onlineLocation.js ...
[INFO] Optimize JS file pagination.js ...
[INFO] Optimize JS file plans.js ...
[INFO] Optimize JS file policy.js ...
[INFO] Optimize JS file product.js ...
[INFO] Optimize JS file productEdit.js ...
[INFO] Optimize JS file pub.js ...
[INFO] Optimize JS file ratings.js ...
[INFO] Optimize JS file reports.js ...
[INFO] Optimize JS file roLocalization.js ...
[INFO] Optimize JS file search.js ...
[INFO] Optimize JS file searchSelect.js ...
[INFO] Optimize JS file settings.js ...
[INFO] Optimize JS file share.js ...
[INFO] Optimize JS file shoppingCart.js ...
[INFO] Optimize JS file store.js ...
[INFO] Optimize JS file storeEdit.js ...
[INFO] Optimize JS file systemAlerts.js ...
[INFO] Optimize JS file taxes.js ...
[INFO] Optimize JS file theme.js ...
[INFO] Optimize JS file translate.js ...
[INFO] Optimize JS file urlutils.js ...
[INFO] Optimize JS file user.js ...
[INFO] Optimize JS file utils.js ...
[INFO] Optimize JS file validation.js ...
[INFO] Optimize JS file veil.js ...
[INFO] Optimize JS file version.js ...
[INFO] Optimize JS file versionHistory.js ...
[INFO] Optimize CSS file leaflet.draw-src.css ...
[INFO] Optimize CSS file leaflet.draw.css ...
[INFO] Optimize CSS file leaflet.css ...
[INFO] Optimize CSS file markerCluster.css ...
[INFO] Optimize CSS file leaflet-notifications.min.css ...
[INFO] Optimize CSS file p.css ...
[INFO] === Statistic ===========================================
[INFO] Size before optimization = 871.671 KB
[INFO] Size after optimization = 225.593 KB
[INFO] Optimized resources have 25.88% of original size
[INFO] =========================================================

Add Google Guava as dependency

Previously this plugin was counting on maven-core to provide Google Guava but in the latest run Maven said "this dependency should be marked provided" when I did that I didn't realize the plugin was getting its Guava dependency from it.

So we have to add Guava to the pom.xml as a compile dependency.

Maven plugin - ERROR - [JSC_UNDEFINED_VARIABLE] variable document is undeclared

Hi,

I'm new to resources-optimizer-maven-plugin, and I'm trying to minify my java html resources: js + css.
When running the maven build, with the plugin enabled, I end up getting a bunch of JSC_UNDEFINED_VARIABLE against javascript objects and methods and methods and objects from 3rd party libs I'm using, and which are not included in the minification. Because of this the build is failing.

Any idea how can I mute these errors and also get a valid minify output?

If i change the compilationLevel to WHITESPACE_ONLY, the build will be successful, but the js content won't be minified. And I don't want this. I want it aggregated and minified .

Thanks!
I'm running java 17

My .pom plugin definition looks like this:

<plugin>
	<groupId>org.primefaces.extensions</groupId>
	<artifactId>resources-optimizer-maven-plugin</artifactId>
	<version>2.5.6</version>
	<executions>
			<execution>
			  <id>optimize</id>
			  <goals>
			    <goal>optimize</goal>
			  </goals>
			</execution>
	</executions>
	<configuration>
			<compilationLevel>ADVANCED_OPTIMIZATIONS</compilationLevel>
			<warningLevel>VERBOSE</warningLevel>
			<failOnWarning>false</failOnWarning>
			<suffix>-min</suffix>
			<useDataUri>false</useDataUri>
			<languageIn>ECMASCRIPT_2017</languageIn>
			<languageOut>ECMASCRIPT_2017</languageOut>
			<resourcesSets>
			  <resourcesSet>
			    <inputDir>${basedir}/src/main/resources/static/p/js</inputDir>
			    <includes>
			      <include>*.js</include>
			    </includes>
			    <excludes>
			      <exclude>./lib/*.js</exclude>
			    </excludes>
			    <aggregations>
				    <aggregation>
				      <withoutCompress>false</withoutCompress>
				      <outputFile>
				        ${project.build.directory}/webapp/resources/scripts.js
				      </outputFile>
				    </aggregation>
				  </aggregations>
			  </resourcesSet>
			  <resourcesSet>
			    <inputDir>${basedir}/src/main/resources/static/p</inputDir>
			    <includes>
			      <include>**/*.css</include>
			    </includes>
			    <aggregations>
			      <aggregation>
			        <outputFile>${project.build.directory}/webapp/resources/min.css</outputFile>
			      </aggregation>
			    </aggregations>
			  </resourcesSet>
			</resourcesSets>
	</configuration>        
</plugin>

The errors I'm getting are:

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:11:19: ERROR - [JSC_UNDEFINED_VARIABLE] variable document is undeclared
  11| var alertElement = document.getElementById(ALERT_ID);
                         ^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:12:16: ERROR - [JSC_UNDEFINED_VARIABLE] variable undefined is undeclared
  12| var timeoutId = undefined;
                      ^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:34:13: ERROR - [JSC_UNDEFINED_VARIABLE] variable setTimeout is undeclared
  34|   timeoutId = setTimeout(function(){
                    ^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:42:2: ERROR - [JSC_UNDEFINED_VARIABLE] variable clearTimeout is undeclared
  42|           clearTimeout(timeoutId);
                ^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:48:1: ERROR - [JSC_UNDEFINED_VARIABLE] variable alert is undeclared
  48|   alert(message);
        ^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:186:5: ERROR - [JSC_UNDEFINED_VARIABLE] variable navigator is undeclared
  186|  if (navigator.mediaDevices && typeof navigator.mediaDevices.getUserMedia === 'function') {
            ^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:188:3: ERROR - [JSC_UNDEFINED_VARIABLE] variable Quagga is undeclared
  188|    Quagga.init({
          ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:211:11: ERROR - [JSC_UNDEFINED_VARIABLE] variable console is undeclared
  211|            console.log(err);
                  ^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:223:44: ERROR - [JSC_UNDEFINED_VARIABLE] variable parseInt is undeclared
  223|                  drawingCtx.clearRect(0, 0, parseInt(drawingCanvas.getAttribute("width")), parseInt(drawingCanvas.getAttribute("height")));
                                                   ^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:288:29: ERROR - [JSC_UNDEFINED_VARIABLE] variable Object is undeclared
  288|          for (const [key, value] of Object.entries(stack)) {
                                           ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:486:19: ERROR - [JSC_UNDEFINED_VARIABLE] variable Math is undeclared
  486|          let newHeight =  Math.floor((height * maxWidth) / width);
                                 ^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:616:31: ERROR - [JSC_UNDEFINED_VARIABLE] variable Date is undeclared
  616|                          dataObject.push({date: new Date(response.content[i].creationTime), value: response.content[i].basePrice, currency: response.content[i].currency, isLast: false});
                                                           ^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:646:11: ERROR - [JSC_UNDEFINED_VARIABLE] variable d3 is undeclared
  646|     return d3.axisBottom(x)
                  ^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:706:17: ERROR - [JSC_UNDEFINED_VARIABLE] variable isNaN is undeclared
  706|          .defined(d => !isNaN(d.value))
                               ^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:1325:1: ERROR - [JSC_UNDEFINED_VARIABLE] variable window is undeclared
  1325| ;window['en'] = {
         ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:3490:11: ERROR - [JSC_UNDEFINED_VARIABLE] variable Stripe is undeclared
  3490|                 stripe = Stripe(settings.stripePublicKey);
                                 ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:3640:27: ERROR - [JSC_UNDEFINED_VARIABLE] variable URLSearchParams is undeclared
  3640|   const clientSecret = new URLSearchParams(window.location.search).get(
                                   ^^^^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:4229:55: ERROR - [JSC_UNDEFINED_VARIABLE] variable JSON is undeclared
  4229|                                 <div class="productBrand" onclick='filterOnBrand(${JSON.stringify(response.content.content[i])})'>
                                                                                           ^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:4614:13: ERROR - [JSC_UNDEFINED_VARIABLE] variable parseFloat is undeclared
  4614|                 setElement(parseFloat(maxDistance), DISTANCE);
                                   ^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:4709:25: ERROR - [JSC_UNDEFINED_VARIABLE] variable encodeURIComponent is undeclared
  4709|                 result += '?filter=' + encodeURIComponent(filter);
                                               ^^^^^^^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:4900:26: ERROR - [JSC_UNDEFINED_VARIABLE] variable localStorage is undeclared
  4900|         let storageSortResults = localStorage.getItem(USER_FRIENDS_SORT_FIELD_ID);
                                         ^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:5362:12: ERROR - [JSC_UNDEFINED_VARIABLE] variable URL is undeclared
  5362|                 let src = URL.createObjectURL(event.target.files[0]);
                                  ^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:5525:19: ERROR - [JSC_UNDEFINED_VARIABLE] variable languages is undeclared
  5525|         for (let i = 0; i<languages.length; i++) {
                                  ^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:5818:18: ERROR - [JSC_UNDEFINED_VARIABLE] variable L is undeclared
  5818|                                 map.flyTo(new L.LatLng(currentLocation.latitude + mapHeight / 2.1, currentLocation.longitude));
                                                      ^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:6205:15: ERROR - [JSC_UNDEFINED_VARIABLE] variable Promise is undeclared
  6205|     return new Promise((resolve, reject) => {
                       ^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:6568:29: ERROR - [JSC_UNDEFINED_VARIABLE] variable av is undeclared
  6568|                 let lv = new av(a,b);
                                     ^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:6584:20: ERROR - [JSC_UNDEFINED_VARIABLE] variable google is undeclared
  6584|                         translator = new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE},  TRANSLATE_ICON_ID);
                                                 ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:6948:21: ERROR - [JSC_UNDEFINED_VARIABLE] variable FormData is undeclared
  6948|         let multipart = new FormData();
                                    ^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:6953:31: ERROR - [JSC_UNDEFINED_VARIABLE] variable Blob is undeclared
  6953|         multipart.append('adDTO', new Blob([JSON.stringify(adDTO)], {
                                              ^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:8270:12: ERROR - [JSC_UNDEFINED_VARIABLE] variable storeViewMap is undeclared
  8270|         let zoom = storeViewMap.getZoom();
                           ^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:8442:7: ERROR - [JSC_UNDEFINED_VARIABLE] variable loadCreateLocalTaxMap is undeclared
  8442|         await loadCreateLocalTaxMap(zoom);
                      ^^^^^^^^^^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:9064:31: ERROR - [JSC_UNDEFINED_VARIABLE] variable fetch is undeclared
  9064|         const response = await fetch(url, settings);
                                       ^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:14335:1: ERROR - [JSC_UNDEFINED_VARIABLE] variable result is undeclared
  14335|        result =  Math.floor((availableWidth - (availableWidth * ADS_PADDING_PERCENTAGE)) / AD_WIDTH);
                ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:14775:2: ERROR - [JSC_UNDEFINED_VARIABLE] variable response is undeclared
  14775|                response = await mwCreateUserReport(username, reportMessageBody);
                        ^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:15089:53: ERROR - [JSC_UNDEFINED_VARIABLE] variable NaN is undeclared
  15089|        if (page === null || page === undefined || page === NaN || page <0) {
                                                                    ^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:15124:60: ERROR - [JSC_UNDEFINED_VARIABLE] variable Number is undeclared
  15124|                if (!isValueEmpty(minPrice) && !isValueEmpty(maxPrice) && Number(minPrice) > Number(maxPrice)) {
                                                                                  ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:16804:2: ERROR - [JSC_UNDEFINED_VARIABLE] variable scannerContainer is undeclared
  16804|                scannerContainer.classList.add('displayNone')
                        ^^^^^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:19383:19: ERROR - [JSC_UNDEFINED_VARIABLE] variable Array is undeclared
  19383|        let queryParams = Array.from(url.searchParams);
                                  ^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:19594:2: ERROR - [JSC_UNDEFINED_VARIABLE] variable history is undeclared
  19594|                history.pushState({}, '', newUrl);
                        ^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:20851:0: ERROR - [JSC_UNDEFINED_VARIABLE] variable String is undeclared
  20851| String.prototype.format = function () {
         ^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:21164:30: ERROR - [JSC_UNDEFINED_VARIABLE] variable Element is undeclared
  21164|     return element instanceof Element || element instanceof HTMLDocument;  
                                       ^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:21164:60: ERROR - [JSC_UNDEFINED_VARIABLE] variable HTMLDocument is undeclared
  21164|     return element instanceof Element || element instanceof HTMLDocument;  
                                                                     ^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js:21279:2: ERROR - [JSC_UNDEFINED_VARIABLE] variable sessionStorage is undeclared
  21279|                sessionStorage.setItem(key, JSON.stringify(value));
                        ^^^^^^^^^^^^^^

May 01, 2023 11:44:47 A.M. com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 43 error(s), 0 warning(s)
[ERROR] JSC_UNDEFINED_VARIABLE. variable document is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 11 : 19
[ERROR] JSC_UNDEFINED_VARIABLE. variable undefined is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 12 : 16
[ERROR] JSC_UNDEFINED_VARIABLE. variable setTimeout is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 34 : 13
[ERROR] JSC_UNDEFINED_VARIABLE. variable clearTimeout is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 42 : 2
[ERROR] JSC_UNDEFINED_VARIABLE. variable alert is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 48 : 1
[ERROR] JSC_UNDEFINED_VARIABLE. variable navigator is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 186 : 5
[ERROR] JSC_UNDEFINED_VARIABLE. variable Quagga is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 188 : 3
[ERROR] JSC_UNDEFINED_VARIABLE. variable console is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 211 : 11
[ERROR] JSC_UNDEFINED_VARIABLE. variable parseInt is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 223 : 44
[ERROR] JSC_UNDEFINED_VARIABLE. variable Object is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 288 : 29
[ERROR] JSC_UNDEFINED_VARIABLE. variable Math is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 486 : 19
[ERROR] JSC_UNDEFINED_VARIABLE. variable Date is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 616 : 31
[ERROR] JSC_UNDEFINED_VARIABLE. variable d3 is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 646 : 11
[ERROR] JSC_UNDEFINED_VARIABLE. variable isNaN is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 706 : 17
[ERROR] JSC_UNDEFINED_VARIABLE. variable window is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 1325 : 1
[ERROR] JSC_UNDEFINED_VARIABLE. variable Stripe is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 3490 : 11
[ERROR] JSC_UNDEFINED_VARIABLE. variable URLSearchParams is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 3640 : 27
[ERROR] JSC_UNDEFINED_VARIABLE. variable JSON is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 4229 : 55
[ERROR] JSC_UNDEFINED_VARIABLE. variable parseFloat is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 4614 : 13
[ERROR] JSC_UNDEFINED_VARIABLE. variable encodeURIComponent is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 4709 : 25
[ERROR] JSC_UNDEFINED_VARIABLE. variable localStorage is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 4900 : 26
[ERROR] JSC_UNDEFINED_VARIABLE. variable URL is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 5362 : 12
[ERROR] JSC_UNDEFINED_VARIABLE. variable languages is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 5525 : 19
[ERROR] JSC_UNDEFINED_VARIABLE. variable L is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 5818 : 18
[ERROR] JSC_UNDEFINED_VARIABLE. variable Promise is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 6205 : 15
[ERROR] JSC_UNDEFINED_VARIABLE. variable av is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 6568 : 29
[ERROR] JSC_UNDEFINED_VARIABLE. variable google is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 6584 : 20
[ERROR] JSC_UNDEFINED_VARIABLE. variable FormData is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 6948 : 21
[ERROR] JSC_UNDEFINED_VARIABLE. variable Blob is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 6953 : 31
[ERROR] JSC_UNDEFINED_VARIABLE. variable storeViewMap is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 8270 : 12
[ERROR] JSC_UNDEFINED_VARIABLE. variable loadCreateLocalTaxMap is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 8442 : 7
[ERROR] JSC_UNDEFINED_VARIABLE. variable fetch is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 9064 : 31
[ERROR] JSC_UNDEFINED_VARIABLE. variable result is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 14335 : 1
[ERROR] JSC_UNDEFINED_VARIABLE. variable response is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 14775 : 2
[ERROR] JSC_UNDEFINED_VARIABLE. variable NaN is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 15089 : 53
[ERROR] JSC_UNDEFINED_VARIABLE. variable Number is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 15124 : 60
[ERROR] JSC_UNDEFINED_VARIABLE. variable scannerContainer is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 16804 : 2
[ERROR] JSC_UNDEFINED_VARIABLE. variable Array is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 19383 : 19
[ERROR] JSC_UNDEFINED_VARIABLE. variable history is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 19594 : 2
[ERROR] JSC_UNDEFINED_VARIABLE. variable String is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 20851 : 0
[ERROR] JSC_UNDEFINED_VARIABLE. variable Element is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 21164 : 30
[ERROR] JSC_UNDEFINED_VARIABLE. variable HTMLDocument is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 21164 : 60
[ERROR] JSC_UNDEFINED_VARIABLE. variable sessionStorage is undeclared at /opt/RD/project-k-middleware/target/webapp/resources/scripts.source.js line 21279 : 2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.167 s
[INFO] Finished at: 2023-05-01T11:44:47-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.primefaces.extensions:resources-optimizer-maven-plugin:2.5.6:optimize (optimize) on project middleware: Resources optimization failure: Resources optimization failure. Please fix errors and try again. -> [Help 1]

CSS Compressor: Incorrect optimization for transition property

Used resources-optimizer-maven-plugin v2.3.8

Before optimization:

.transition-test {
	transition: all 0s ease 0s;
	transition-delay: 0s;
	transition-duration: 0s;
	transition-delay: 0ms;
	transition-duration: 0ms;
}

After optimization:

.transition-test{transition:all 0 ease 0;transition-delay:0;transition-duration:0;transition-delay:0;transition-duration:0}

Removing the units of measure s, ms for a value of 0 is invalid for the transition property.

https://developer.mozilla.org/en-US/docs/Web/CSS/time
"0 Although unitless zero is allowed for [length's], it's invalid for [time's]."

Support CommonJS Modules?

Hi there, I came across this awesome maven plugin, however while trying to optimize my *.JS files with failOnWarning enabled I see the following as output:

[ERROR] JSC_UNDEFINED_VARIABLE. variable define is undeclared at /home/nolddor/git/mvn-test/target/classes/js/TestCommon.js line 6 : 4
[ERROR] JSC_UNDEFINED_VARIABLE. variable require is undeclared at /home/nolddor/git/mvn-test/target/classes/js/TestCommon.js line 21 : 0

It looks like i need to explicity enable CommonJS module support by using --process_common_js_modules flag / CompilerOptions#setProcessCommonJSModules, but i do not see the option on this maven plugin.

Refers to google/closure-compiler/wiki/JS-Modules#commonjs-modules section.

Plugin Config

            <plugin>
                <groupId>org.primefaces.extensions</groupId>
                <artifactId>resources-optimizer-maven-plugin</artifactId>
                <version>2.6.1</version>
                <executions>
                    <execution>
                        <id>optimize</id>
                        <goals>
                            <goal>optimize</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <warningLevel>VERBOSE</warningLevel>
                    <failOnWarning>true</failOnWarning>
                    <languageIn>ECMASCRIPT_2015</languageIn>
                    <inputDir>${project.build.directory}/classes/js</inputDir>
                    <includes>
                        <include>**/*.js</include>
                    </includes>
                </configuration>
            </plugin>

CSS Compressor: Invalid whitespace removal / @supports () "or" ()

original Issue: yui/yuicompressor#340

Raw:

.foo {
    @supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
        background: rgba(69, 69, 69, 0.5);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
      }
}

Incorrectly compressed to:

.foo {
    @supports (backdrop-filter: blur(10px)) or(-webkit-backdrop-filter: blur(10px)) {
        background: rgba(69, 69, 69, 0.5);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
      }
}

No space after the or causes issues in Chrome

CSS Compressor: Keep 0 units in linear-gradient

Original issue: yui/yuicompressor#295

https://www.w3schools.com/css/css3_gradients.asp
Using Angles
If you want more control over the direction of the gradient, you can define an angle, instead of the predefined directions (to bottom, to top, to right, to left, to bottom right, etc.).
Syntax
background: linear-gradient(angle, color-stop1, color-stop2);
Before
linear-gradient(0deg, #eee 0px, #eee 10px, transparent 10px, transparent 50px, #eee 50px),
After
linear-gradient(0, #eee 0px, #eee 10px, transparent 10px, transparent 50px, #eee 50px),

Google Closure v20200504

Upgrade to Google Closure v20200426 and update WIKI for language in and language out values.

  • Update pom.xml
  • Update WIKI for language in and language out

Css Compressor has a problem with replacing "calc function"

Hi.

Css Compressor does't return the result that I expected because of CssCompressor line#552.

e.g:

.test {
	left: calc(50% - 84px);
}

.test2-test:nth-child(2) {
	display: contents;
}

Result:
.test{left:calc(50% - 84px)}.test2 - test:nth - child(2){display:contents}

Would you give me some advice to avoid this issue?
Thank you!

Support embedding data uris for non-JSF resources

Support and embed simple relative urls in CSS files like:

  background-image: url(../images/remove.svg);

Because I want to pack a single JS+CSS library as both webjar for use in JSF UI and as a npm package for use in React UI. So I don't want to hardcode #{resource['...']} in the CSS (which also prevents these references from working in a simple openable demo.html including these JS and CSS for development/debugging purposes).

CSS Compressor: Update token matcher regex

original Issue: yui/yuicompressor#228

p = Pattern.compile("(\"([^\\\\\"]|\\\\.|\\\\)*\")|(\'([^\\\\\']|\\\\.|\\\\)*\')");

Should be to make it match CSS specs:

p = Pattern.compile("\"([^\"\r\n\f\\\\]|\\\\[^0-9a-fA-f]|\\\\[0-9a-fA-F]{1,6}(?>\r\n|[ \t\r\n\f])?)*+\"|'([^'\r\n\f\\\\]|\\\\[^0-9a-fA-f]|\\\\[0-9a-fA-F]{1,6}(?>\r\n|[ \t\r\n\f])?)*+'");

Mojo: Use Annotations instead of JavaDoc

[WARNING]
[WARNING] Deprecated extractor java-javadoc extracted 1 descriptor. Upgrade your Mojo definitions.
[WARNING] You should use Mojo Annotations instead of Javadoc tags.
[WARNING]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.