From 011a75f41bf4815a3f0788252e278e144da56912 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov <slopukhov@ebay.com> Date: Fri, 3 Jul 2015 13:27:00 +0300 Subject: [PATCH] MAGETWO-39553: Replace JSMin with JShrink lib --- .php_cs | 1 - app/code/Magento/Store/etc/config.xml | 4 +- composer.json | 5 +- composer.lock | 388 ++++++++++++------ .../Framework/View/Asset/MinifierTest.php | 2 +- lib/internal/JSMin/jsmin.php | 386 ----------------- .../Code/Minifier/Adapter/Css/CssMinifier.php | 5 +- .../Code/Minifier/Adapter/Js/JShrink.php | 29 ++ .../Code/Minifier/Adapter/Js/Jsmin.php | 23 -- .../Unit/Minifier/Adapter/Js/JsminTest.php | 4 +- 10 files changed, 302 insertions(+), 545 deletions(-) delete mode 100644 lib/internal/JSMin/jsmin.php create mode 100644 lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/JShrink.php delete mode 100644 lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/Jsmin.php diff --git a/.php_cs b/.php_cs index 8381e44cf08..7f5e43f9d4f 100644 --- a/.php_cs +++ b/.php_cs @@ -17,7 +17,6 @@ $finder = Symfony\CS\Finder\DefaultFinder::create() ->exclude('dev/tests/integration/var') ->exclude('lib/internal/Cm') ->exclude('lib/internal/Credis') - ->exclude('lib/internal/JSMin') ->exclude('lib/internal/Less') ->exclude('lib/internal/LinLibertineFont') ->exclude('lib/internal/phpseclib') diff --git a/app/code/Magento/Store/etc/config.xml b/app/code/Magento/Store/etc/config.xml index 0bf0f4cdb88..53555a0e17b 100644 --- a/app/code/Magento/Store/etc/config.xml +++ b/app/code/Magento/Store/etc/config.xml @@ -20,11 +20,11 @@ <js> <merge_files>0</merge_files> <minify_files>0</minify_files> - <minify_adapter>Magento\Framework\Code\Minifier\Adapter\Js\Jsmin</minify_adapter> + <minify_adapter>Magento\Framework\Code\Minifier\Adapter\Js\JShrink</minify_adapter> </js> <css> <minify_files>0</minify_files> - <minify_adapter>Magento\Framework\Code\Minifier\Adapter\Css\CssMinifier</minify_adapter> + <minify_adapter>Magento\Framework\Code\Minifier\Adapter\Css\CSSmin</minify_adapter> </css> <image> <default_adapter>GD2</default_adapter> diff --git a/composer.json b/composer.json index 46f9532c0fc..78e383f4370 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "oyejorge/less.php": "1.7.0.3", "tubalmartin/cssmin": "2.4.8-p4", "magento/magento-composer-installer": "*", - "symfony/console": "~2.3 <2.7" + "symfony/console": "~2.3 <2.7", + "tedivm/jshrink": "~1.0.1" }, "require-dev": { "phpunit/phpunit": "4.1.0", @@ -163,7 +164,6 @@ "trentrichardson/jquery-timepicker-addon": "1.4.3", "colinmollenhour/cache-backend-redis": "dev-master#193d377b7fb2e88595578b282fa01a62d1185abc", "colinmollenhour/credis": "dev-master#f07bbfd4117294f462f0fb19c49221d350bf396f", - "linkorb/jsmin-php": "1.1.2", "phpseclib/phpseclib": "0.2.1", "components/jquery": "1.11.0", "blueimp/jquery-file-upload": "5.6.14", @@ -176,7 +176,6 @@ "trentrichardson/jquery-timepicker-addon": "lib/web/jquery/jquery-ui-timepicker-addon.js", "colinmollenhour/cache-backend-redis": "lib/internal/Cm/Cache/Backend/Redis.php", "colinmollenhour/credis": "lib/internal/Credis", - "linkorb/jsmin-php": "lib/internal/JSMin", "phpseclib/phpseclib": "lib/internal/phpseclib", "components/jquery": [ "lib/web/jquery.js", diff --git a/composer.lock b/composer.lock index 3edd20fd60b..9ed9812e325 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "0c8183878a902922b635912a4ca71bdd", + "hash": "88dc56240945d70d05b0a44169a65b17", "packages": [ { "name": "composer/composer", @@ -634,6 +634,52 @@ "homepage": "https://symfony.com", "time": "2015-06-08 09:37:21" }, + { + "name": "tedivm/jshrink", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/tedious/JShrink.git", + "reference": "7575d9d96f113bc7c1c28ec8231ee086751a9078" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tedious/JShrink/zipball/7575d9d96f113bc7c1c28ec8231ee086751a9078", + "reference": "7575d9d96f113bc7c1c28ec8231ee086751a9078", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "0.4.0", + "phpunit/phpunit": "4.0.*", + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "autoload": { + "psr-0": { + "JShrink": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Robert Hafner", + "email": "tedivm@tedivm.com" + } + ], + "description": "Javascript Minifier built in PHP", + "homepage": "http://github.com/tedious/JShrink", + "keywords": [ + "javascript", + "minifier" + ], + "time": "2014-11-11 03:54:14" + }, { "name": "tubalmartin/cssmin", "version": "v2.4.8-p4", @@ -684,12 +730,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-code.git", - "reference": "cfd5951ff4348e4430850560416c7ddb755f95d3" + "reference": "0ed94f842ba60cdc900c46a61bdbd7ac95a3e140" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-code/zipball/0ed94f842ba60cdc900c46a61bdbd7ac95a3e140", - "reference": "cfd5951ff4348e4430850560416c7ddb755f95d3", + "reference": "0ed94f842ba60cdc900c46a61bdbd7ac95a3e140", "shasum": "" }, "require": { @@ -698,6 +744,9 @@ }, "require-dev": { "doctrine/common": ">=2.1", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-stdlib": "self.version" }, "suggest": { @@ -713,7 +762,7 @@ }, "autoload": { "psr-4": { - "Zend\\Code\\": "" + "Zend\\Code\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -721,12 +770,12 @@ "BSD-3-Clause" ], "description": "provides facilities to generate arbitrary code using an object oriented interface", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-code", "keywords": [ "code", "zf2" ], - "time": "2015-04-01 17:59:08" + "time": "2015-03-31 15:39:14" }, { "name": "zendframework/zend-config", @@ -734,12 +783,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-config.git", - "reference": "8682fe4e2923b383bb6472fc84b5796a07589163" + "reference": "95f3a4b3fa85d49e6f060183122de4596fa6d29d" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-config/zipball/95f3a4b3fa85d49e6f060183122de4596fa6d29d", - "reference": "8682fe4e2923b383bb6472fc84b5796a07589163", + "reference": "95f3a4b3fa85d49e6f060183122de4596fa6d29d", "shasum": "" }, "require": { @@ -747,6 +796,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-filter": "self.version", "zendframework/zend-i18n": "self.version", "zendframework/zend-json": "self.version", @@ -767,7 +819,7 @@ }, "autoload": { "psr-4": { - "Zend\\Config\\": "" + "Zend\\Config\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -775,12 +827,12 @@ "BSD-3-Clause" ], "description": "provides a nested object property based user interface for accessing this configuration data within application code", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-config", "keywords": [ "config", "zf2" ], - "time": "2015-04-01 17:59:31" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-console", @@ -788,18 +840,23 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-console.git", - "reference": "94ab6663b07e19f20b3319ecf317bd72b6a72dca" + "reference": "54823d9ba6f8ce39046384ee5a043b5b3d5f56d7" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-console/zipball/54823d9ba6f8ce39046384ee5a043b5b3d5f56d7", - "reference": "94ab6663b07e19f20b3319ecf317bd72b6a72dca", + "reference": "54823d9ba6f8ce39046384ee5a043b5b3d5f56d7", "shasum": "" }, "require": { "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "suggest": { "zendframework/zend-filter": "To support DefaultRouteMatcher usage", "zendframework/zend-validator": "To support DefaultRouteMatcher usage" @@ -813,19 +870,19 @@ }, "autoload": { "psr-4": { - "Zend\\Console\\": "" + "Zend\\Console\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-console", "keywords": [ "console", "zf2" ], - "time": "2015-04-01 17:59:48" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-di", @@ -833,12 +890,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-di.git", - "reference": "0811f2a67ad0b50dfb8d602ed67cde0b82249190" + "reference": "b9f8de081adecf71a003a569e9ba76c0a4c00bf2" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-di/zipball/b9f8de081adecf71a003a569e9ba76c0a4c00bf2", - "reference": "0811f2a67ad0b50dfb8d602ed67cde0b82249190", + "reference": "b9f8de081adecf71a003a569e9ba76c0a4c00bf2", "shasum": "" }, "require": { @@ -847,6 +904,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-servicemanager": "self.version" }, "suggest": { @@ -861,19 +921,19 @@ }, "autoload": { "psr-4": { - "Zend\\Di\\": "" + "Zend\\Di\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-di", "keywords": [ "di", "zf2" ], - "time": "2015-04-01 18:01:30" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-escaper", @@ -881,17 +941,22 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-escaper.git", - "reference": "65b3328627362b0be1d5e9067bc846511d1fbc96" + "reference": "15e5769e4fcdb4bf07ebd76500810e7070e23a97" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/15e5769e4fcdb4bf07ebd76500810e7070e23a97", - "reference": "65b3328627362b0be1d5e9067bc846511d1fbc96", + "reference": "15e5769e4fcdb4bf07ebd76500810e7070e23a97", "shasum": "" }, "require": { "php": ">=5.3.23" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -901,19 +966,19 @@ }, "autoload": { "psr-4": { - "Zend\\Escaper\\": "" + "Zend\\Escaper\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-escaper", "keywords": [ "escaper", "zf2" ], - "time": "2015-04-01 18:02:07" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-eventmanager", @@ -921,18 +986,23 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "38df5b567d4ff4d22144745c503ba0502d0d5695" + "reference": "58d21c95c7005a527262fd536499195f104e83f9" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/58d21c95c7005a527262fd536499195f104e83f9", - "reference": "38df5b567d4ff4d22144745c503ba0502d0d5695", + "reference": "58d21c95c7005a527262fd536499195f104e83f9", "shasum": "" }, "require": { "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -942,19 +1012,19 @@ }, "autoload": { "psr-4": { - "Zend\\EventManager\\": "" + "Zend\\EventManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-event-manager", "keywords": [ "eventmanager", "zf2" ], - "time": "2015-04-01 18:05:26" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-filter", @@ -962,12 +1032,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-filter.git", - "reference": "b13741a88553351fc52472de529b57b580b8f6f1" + "reference": "6d8aed2da81b62a04747346c4370562cdbe34595" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/6d8aed2da81b62a04747346c4370562cdbe34595", - "reference": "b13741a88553351fc52472de529b57b580b8f6f1", + "reference": "6d8aed2da81b62a04747346c4370562cdbe34595", "shasum": "" }, "require": { @@ -975,6 +1045,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-crypt": "self.version", "zendframework/zend-servicemanager": "self.version", "zendframework/zend-uri": "self.version" @@ -994,7 +1067,7 @@ }, "autoload": { "psr-4": { - "Zend\\Filter\\": "" + "Zend\\Filter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1002,12 +1075,12 @@ "BSD-3-Clause" ], "description": "provides a set of commonly needed data filters", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-filter", "keywords": [ "filter", "zf2" ], - "time": "2015-04-01 18:09:25" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-form", @@ -1015,12 +1088,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-form.git", - "reference": "09f5bd46ffbf783df22281898e2175b291bd43a3" + "reference": "bca0db55718355d25c2c10fdd41a83561f1c94b3" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-form/zipball/bca0db55718355d25c2c10fdd41a83561f1c94b3", - "reference": "09f5bd46ffbf783df22281898e2175b291bd43a3", + "reference": "bca0db55718355d25c2c10fdd41a83561f1c94b3", "shasum": "" }, "require": { @@ -1029,6 +1102,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-captcha": "self.version", "zendframework/zend-code": "self.version", "zendframework/zend-eventmanager": "self.version", @@ -1059,19 +1135,19 @@ }, "autoload": { "psr-4": { - "Zend\\Form\\": "" + "Zend\\Form\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-form", "keywords": [ "form", "zf2" ], - "time": "2015-04-01 18:09:25" + "time": "2015-03-28 20:29:18" }, { "name": "zendframework/zend-http", @@ -1079,12 +1155,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-http.git", - "reference": "ee6220609845b32d1b2873c9ac694aef56d508f5" + "reference": "9c6047a0bdb3094d3ea07a215ff929cc47de4deb" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-http/zipball/9c6047a0bdb3094d3ea07a215ff929cc47de4deb", - "reference": "ee6220609845b32d1b2873c9ac694aef56d508f5", + "reference": "9c6047a0bdb3094d3ea07a215ff929cc47de4deb", "shasum": "" }, "require": { @@ -1094,6 +1170,11 @@ "zendframework/zend-uri": "self.version", "zendframework/zend-validator": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1103,7 +1184,7 @@ }, "autoload": { "psr-4": { - "Zend\\Http\\": "" + "Zend\\Http\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1111,12 +1192,12 @@ "BSD-3-Clause" ], "description": "provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-http", "keywords": [ "http", "zf2" ], - "time": "2015-04-01 18:09:25" + "time": "2015-03-27 15:46:30" }, { "name": "zendframework/zend-i18n", @@ -1124,12 +1205,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "33051775d9a8c341fe3b77d1f3daa0e921e2f4bd" + "reference": "9aebc5287373a802540d75fe5508417f866c2e52" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/9aebc5287373a802540d75fe5508417f866c2e52", - "reference": "33051775d9a8c341fe3b77d1f3daa0e921e2f4bd", + "reference": "9aebc5287373a802540d75fe5508417f866c2e52", "shasum": "" }, "require": { @@ -1137,6 +1218,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-cache": "self.version", "zendframework/zend-config": "self.version", "zendframework/zend-eventmanager": "self.version", @@ -1165,19 +1249,19 @@ }, "autoload": { "psr-4": { - "Zend\\I18n\\": "" + "Zend\\I18n\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-i18n", "keywords": [ "i18n", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-inputfilter", @@ -1185,12 +1269,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-inputfilter.git", - "reference": "16856fec61f285e41e5492235220a4dec06ab90f" + "reference": "4b1398f3635fae3cc5e873c5bb067274f3d10a93" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/4b1398f3635fae3cc5e873c5bb067274f3d10a93", - "reference": "16856fec61f285e41e5492235220a4dec06ab90f", + "reference": "4b1398f3635fae3cc5e873c5bb067274f3d10a93", "shasum": "" }, "require": { @@ -1200,6 +1284,9 @@ "zendframework/zend-validator": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-servicemanager": "self.version" }, "suggest": { @@ -1214,19 +1301,19 @@ }, "autoload": { "psr-4": { - "Zend\\InputFilter\\": "" + "Zend\\InputFilter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-input-filter", "keywords": [ "inputfilter", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-json", @@ -1234,12 +1321,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-json.git", - "reference": "76aeb27e4baf39799e5ca3cf6f2fdd6748ee930c" + "reference": "2d845e151c1b9a237cf1899ac31e17fb10bd1e3f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-json/zipball/2d845e151c1b9a237cf1899ac31e17fb10bd1e3f", - "reference": "76aeb27e4baf39799e5ca3cf6f2fdd6748ee930c", + "reference": "2d845e151c1b9a237cf1899ac31e17fb10bd1e3f", "shasum": "" }, "require": { @@ -1247,6 +1334,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-http": "self.version", "zendframework/zend-server": "self.version" }, @@ -1264,7 +1354,7 @@ }, "autoload": { "psr-4": { - "Zend\\Json\\": "" + "Zend\\Json\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1272,12 +1362,12 @@ "BSD-3-Clause" ], "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-json", "keywords": [ "json", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-loader", @@ -1285,17 +1375,22 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-loader.git", - "reference": "6868b8a0c346f17fb97724c3a63aa2cbf6b94865" + "reference": "65de2c7a56f8eee633c6bf1cfab73e45648880d4" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-loader/zipball/65de2c7a56f8eee633c6bf1cfab73e45648880d4", - "reference": "6868b8a0c346f17fb97724c3a63aa2cbf6b94865", + "reference": "65de2c7a56f8eee633c6bf1cfab73e45648880d4", "shasum": "" }, "require": { "php": ">=5.3.23" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1305,19 +1400,19 @@ }, "autoload": { "psr-4": { - "Zend\\Loader\\": "" + "Zend\\Loader\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-loader", "keywords": [ "loader", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-log", @@ -1325,12 +1420,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-log.git", - "reference": "2d5d20fd45470506bdaff727c46dc25fe953146e" + "reference": "002e3c810cad7e31e51c9895e9e3cb6fbd312cdd" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-log/zipball/002e3c810cad7e31e51c9895e9e3cb6fbd312cdd", - "reference": "2d5d20fd45470506bdaff727c46dc25fe953146e", + "reference": "002e3c810cad7e31e51c9895e9e3cb6fbd312cdd", "shasum": "" }, "require": { @@ -1339,6 +1434,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-console": "self.version", "zendframework/zend-db": "self.version", "zendframework/zend-escaper": "self.version", @@ -1362,7 +1460,7 @@ }, "autoload": { "psr-4": { - "Zend\\Log\\": "" + "Zend\\Log\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1370,13 +1468,13 @@ "BSD-3-Clause" ], "description": "component for general purpose logging", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-log", "keywords": [ "log", "logging", "zf2" ], - "time": "2015-04-01 18:09:26" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-math", @@ -1384,17 +1482,22 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-math.git", - "reference": "634123f83ca90b6613f132d0d100e6b5e9890a29" + "reference": "f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-math/zipball/f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73", - "reference": "634123f83ca90b6613f132d0d100e6b5e9890a29", + "reference": "f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73", "shasum": "" }, "require": { "php": ">=5.3.23" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "suggest": { "ext-bcmath": "If using the bcmath functionality", "ext-gmp": "If using the gmp functionality", @@ -1410,19 +1513,19 @@ }, "autoload": { "psr-4": { - "Zend\\Math\\": "" + "Zend\\Math\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-math", "keywords": [ "math", "zf2" ], - "time": "2015-04-01 18:09:27" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-modulemanager", @@ -1430,12 +1533,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-modulemanager.git", - "reference": "cbe16b0eafe734a062ed0182381e64b9c953dccf" + "reference": "af7ae3cd29a1efb73cc66ae1081e606039d5c20f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-modulemanager/zipball/af7ae3cd29a1efb73cc66ae1081e606039d5c20f", - "reference": "cbe16b0eafe734a062ed0182381e64b9c953dccf", + "reference": "af7ae3cd29a1efb73cc66ae1081e606039d5c20f", "shasum": "" }, "require": { @@ -1444,6 +1547,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-config": "self.version", "zendframework/zend-console": "self.version", "zendframework/zend-loader": "self.version", @@ -1465,19 +1571,19 @@ }, "autoload": { "psr-4": { - "Zend\\ModuleManager\\": "" + "Zend\\ModuleManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-module-manager", "keywords": [ "modulemanager", "zf2" ], - "time": "2015-04-01 18:09:27" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-mvc", @@ -1485,12 +1591,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-mvc.git", - "reference": "bfff0f5f9e4d925ee13b8c159c9d6ae7e0db5412" + "reference": "0b4a4a829b30be510a3f215c4ff00c703ee8b431" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-mvc/zipball/0b4a4a829b30be510a3f215c4ff00c703ee8b431", - "reference": "bfff0f5f9e4d925ee13b8c159c9d6ae7e0db5412", + "reference": "0b4a4a829b30be510a3f215c4ff00c703ee8b431", "shasum": "" }, "require": { @@ -1501,6 +1607,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-authentication": "self.version", "zendframework/zend-console": "self.version", "zendframework/zend-di": "self.version", @@ -1549,19 +1658,19 @@ }, "autoload": { "psr-4": { - "Zend\\Mvc\\": "" + "Zend\\Mvc\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-mvc", "keywords": [ "mvc", "zf2" ], - "time": "2015-04-01 18:09:27" + "time": "2015-03-26 18:55:14" }, { "name": "zendframework/zend-serializer", @@ -1569,12 +1678,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-serializer.git", - "reference": "a46960854d6326f0036d98c9abc7a79e36e25928" + "reference": "3c531789a9882a5deb721356a7bd2642b65d4b09" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/3c531789a9882a5deb721356a7bd2642b65d4b09", - "reference": "a46960854d6326f0036d98c9abc7a79e36e25928", + "reference": "3c531789a9882a5deb721356a7bd2642b65d4b09", "shasum": "" }, "require": { @@ -1584,6 +1693,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-servicemanager": "self.version" }, "suggest": { @@ -1598,7 +1710,7 @@ }, "autoload": { "psr-4": { - "Zend\\Serializer\\": "" + "Zend\\Serializer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1606,12 +1718,12 @@ "BSD-3-Clause" ], "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-serializer", "keywords": [ "serializer", "zf2" ], - "time": "2015-04-01 18:09:28" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-server", @@ -1619,12 +1731,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-server.git", - "reference": "fc73c34490908ba143af3c57c7e166b40c4b9f8e" + "reference": "d11ff0bd529d202022823d4accf5983cbd50fc49" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-server/zipball/d11ff0bd529d202022823d4accf5983cbd50fc49", - "reference": "fc73c34490908ba143af3c57c7e166b40c4b9f8e", + "reference": "d11ff0bd529d202022823d4accf5983cbd50fc49", "shasum": "" }, "require": { @@ -1632,6 +1744,11 @@ "zendframework/zend-code": "self.version", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1641,19 +1758,19 @@ }, "autoload": { "psr-4": { - "Zend\\Server\\": "" + "Zend\\Server\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-server", "keywords": [ "server", "zf2" ], - "time": "2015-04-01 18:09:28" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-servicemanager", @@ -1661,18 +1778,21 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-servicemanager.git", - "reference": "d3c27c708a148a30608f313a5b7a61a531bd9cb9" + "reference": "57cf99fa5ac08c05a135a8d0d676c52a5e450083" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/57cf99fa5ac08c05a135a8d0d676c52a5e450083", - "reference": "d3c27c708a148a30608f313a5b7a61a531bd9cb9", + "reference": "57cf99fa5ac08c05a135a8d0d676c52a5e450083", "shasum": "" }, "require": { "php": ">=5.3.23" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-di": "self.version" }, "suggest": { @@ -1688,19 +1808,19 @@ }, "autoload": { "psr-4": { - "Zend\\ServiceManager\\": "" + "Zend\\ServiceManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-service-manager", "keywords": [ "servicemanager", "zf2" ], - "time": "2015-04-01 18:09:28" + "time": "2015-03-23 18:29:14" }, { "name": "zendframework/zend-soap", @@ -1708,12 +1828,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-soap.git", - "reference": "e42b900798ea95a9063fa4922da976d8b3a8ab6f" + "reference": "a599463aba97ce247faf3fb443e3c7858b46449b" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-soap/zipball/a599463aba97ce247faf3fb443e3c7858b46449b", - "reference": "e42b900798ea95a9063fa4922da976d8b3a8ab6f", + "reference": "a599463aba97ce247faf3fb443e3c7858b46449b", "shasum": "" }, "require": { @@ -1723,6 +1843,9 @@ "zendframework/zend-uri": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-http": "self.version" }, "suggest": { @@ -1737,19 +1860,19 @@ }, "autoload": { "psr-4": { - "Zend\\Soap\\": "" + "Zend\\Soap\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-soap", "keywords": [ "soap", "zf2" ], - "time": "2015-04-01 18:09:29" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-stdlib", @@ -1812,12 +1935,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-text.git", - "reference": "35f519e20e575a331c2ee554e5a555a59ce4b9e2" + "reference": "d962ea25647b20527f3ca34ae225bbc885dabfc7" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-text/zipball/d962ea25647b20527f3ca34ae225bbc885dabfc7", - "reference": "35f519e20e575a331c2ee554e5a555a59ce4b9e2", + "reference": "d962ea25647b20527f3ca34ae225bbc885dabfc7", "shasum": "" }, "require": { @@ -1825,6 +1948,11 @@ "zendframework/zend-servicemanager": "self.version", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1834,19 +1962,19 @@ }, "autoload": { "psr-4": { - "Zend\\Text\\": "" + "Zend\\Text\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-text", "keywords": [ "text", "zf2" ], - "time": "2015-04-01 18:09:29" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-uri", @@ -1854,12 +1982,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-uri.git", - "reference": "53f5b162b293f80de8b951eece8e08be83c4fe16" + "reference": "bd9e625639415376f6a82551c73328448d7bc7d1" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-uri/zipball/bd9e625639415376f6a82551c73328448d7bc7d1", - "reference": "53f5b162b293f80de8b951eece8e08be83c4fe16", + "reference": "bd9e625639415376f6a82551c73328448d7bc7d1", "shasum": "" }, "require": { @@ -1867,6 +1995,11 @@ "zendframework/zend-escaper": "self.version", "zendframework/zend-validator": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -1876,7 +2009,7 @@ }, "autoload": { "psr-4": { - "Zend\\Uri\\": "" + "Zend\\Uri\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1884,12 +2017,12 @@ "BSD-3-Clause" ], "description": "a component that aids in manipulating and validating » Uniform Resource Identifiers (URIs)", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-uri", "keywords": [ "uri", "zf2" ], - "time": "2015-04-01 18:09:29" + "time": "2015-03-25 20:55:48" }, { "name": "zendframework/zend-validator", @@ -1961,12 +2094,12 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-view.git", - "reference": "e119b4b5f082af58a96eb206e782b62c193227bf" + "reference": "37beb1ad46e530f627b4b6c3716efd728e976ba9" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/zendframework/zend-view/zipball/37beb1ad46e530f627b4b6c3716efd728e976ba9", - "reference": "e119b4b5f082af58a96eb206e782b62c193227bf", + "reference": "37beb1ad46e530f627b4b6c3716efd728e976ba9", "shasum": "" }, "require": { @@ -1976,6 +2109,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-authentication": "self.version", "zendframework/zend-escaper": "self.version", "zendframework/zend-feed": "self.version", @@ -2014,7 +2150,7 @@ }, "autoload": { "psr-4": { - "Zend\\View\\": "" + "Zend\\View\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2022,12 +2158,12 @@ "BSD-3-Clause" ], "description": "provides a system of helpers, output filters, and variable escaping", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-view", "keywords": [ "view", "zf2" ], - "time": "2015-04-01 18:09:30" + "time": "2015-03-25 20:55:48" } ], "packages-dev": [ @@ -2353,16 +2489,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.1.6", + "version": "2.1.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "631e365cf26bb2c078683e8d9bcf8bc631ac4d44" + "reference": "07e27765596d72c378a6103e80da5d84e802f1e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/631e365cf26bb2c078683e8d9bcf8bc631ac4d44", - "reference": "631e365cf26bb2c078683e8d9bcf8bc631ac4d44", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/07e27765596d72c378a6103e80da5d84e802f1e4", + "reference": "07e27765596d72c378a6103e80da5d84e802f1e4", "shasum": "" }, "require": { @@ -2411,7 +2547,7 @@ "testing", "xunit" ], - "time": "2015-06-19 07:11:55" + "time": "2015-06-30 06:52:35" }, { "name": "phpunit/php-file-iterator", diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php index 9e64e9345c6..0126085f607 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php @@ -34,7 +34,7 @@ class MinifierTest extends \PHPUnit_Framework_TestCase * 4 - ensure that new minified CSS is fully workable in all supported browsers * 5 - replace `_files/static/css/styles.magento.min.css` with new minified css */ - public function testCssMinifierLibrary() + public function testCSSminLibrary() { /** @var \Magento\Framework\View\Asset\Config $config */ $config = $this->objectManager->get('Magento\Framework\View\Asset\Config'); diff --git a/lib/internal/JSMin/jsmin.php b/lib/internal/JSMin/jsmin.php deleted file mode 100644 index ee1b442bcec..00000000000 --- a/lib/internal/JSMin/jsmin.php +++ /dev/null @@ -1,386 +0,0 @@ -<?php -/** - * jsmin.php - PHP implementation of Douglas Crockford's JSMin. - * - * This is pretty much a direct port of jsmin.c to PHP with just a few - * PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and - * outputs to stdout, this library accepts a string as input and returns another - * string as output. - * - * PHP 5 or higher is required. - * - * Permission is hereby granted to use this version of the library under the - * same terms as jsmin.c, which has the following license: - * - * -- - * Copyright (c) 2002 Douglas Crockford (www.crockford.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * The Software shall be used for Good, not Evil. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * -- - * - * @package JSMin - * @author Ryan Grove <ryan@wonko.com> - * @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c) - * @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port) - * @copyright 2012 Adam Goforth <aag@adamgoforth.com> (Updates) - * @license http://opensource.org/licenses/mit-license.php MIT License - * @version 1.1.2 (2012-05-01) - * @link https://github.com/rgrove/jsmin-php - */ - -class JSMin { - const ORD_LF = 10; - const ORD_SPACE = 32; - const ACTION_KEEP_A = 1; - const ACTION_DELETE_A = 2; - const ACTION_DELETE_A_B = 3; - - protected $a = ''; - protected $b = ''; - protected $input = ''; - protected $inputIndex = 0; - protected $inputLength = 0; - protected $lookAhead = null; - protected $output = ''; - - // -- Public Static Methods -------------------------------------------------- - - /** - * Minify Javascript - * - * @uses __construct() - * @uses min() - * @param string $js Javascript to be minified - * @return string - */ - public static function minify($js) { - $jsmin = new JSMin($js); - return $jsmin->min(); - } - - // -- Public Instance Methods ------------------------------------------------ - - /** - * Constructor - * - * @param string $input Javascript to be minified - */ - public function __construct($input) { - $this->input = str_replace("\r\n", "\n", $input); - $this->inputLength = strlen($this->input); - } - - // -- Protected Instance Methods --------------------------------------------- - - /** - * Action -- do something! What to do is determined by the $command argument. - * - * action treats a string as a single character. Wow! - * action recognizes a regular expression if it is preceded by ( or , or =. - * - * @uses next() - * @uses get() - * @throws JSMinException If parser errors are found: - * - Unterminated string literal - * - Unterminated regular expression set in regex literal - * - Unterminated regular expression literal - * @param int $command One of class constants: - * ACTION_KEEP_A Output A. Copy B to A. Get the next B. - * ACTION_DELETE_A Copy B to A. Get the next B. (Delete A). - * ACTION_DELETE_A_B Get the next B. (Delete B). - */ - protected function action($command) { - switch($command) { - case self::ACTION_KEEP_A: - $this->output .= $this->a; - - case self::ACTION_DELETE_A: - $this->a = $this->b; - - if ($this->a === "'" || $this->a === '"') { - for (;;) { - $this->output .= $this->a; - $this->a = $this->get(); - - if ($this->a === $this->b) { - break; - } - - if (ord($this->a) <= self::ORD_LF) { - throw new JSMinException('Unterminated string literal.'); - } - - if ($this->a === '\\') { - $this->output .= $this->a; - $this->a = $this->get(); - } - } - } - - case self::ACTION_DELETE_A_B: - $this->b = $this->next(); - - if ($this->b === '/' && ( - $this->a === '(' || $this->a === ',' || $this->a === '=' || - $this->a === ':' || $this->a === '[' || $this->a === '!' || - $this->a === '&' || $this->a === '|' || $this->a === '?' || - $this->a === '{' || $this->a === '}' || $this->a === ';' || - $this->a === "\n" )) { - - $this->output .= $this->a . $this->b; - - for (;;) { - $this->a = $this->get(); - - if ($this->a === '[') { - /* - inside a regex [...] set, which MAY contain a '/' itself. Example: mootools Form.Validator near line 460: - return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(element.get('value')); - */ - for (;;) { - $this->output .= $this->a; - $this->a = $this->get(); - - if ($this->a === ']') { - break; - } elseif ($this->a === '\\') { - $this->output .= $this->a; - $this->a = $this->get(); - } elseif (ord($this->a) <= self::ORD_LF) { - throw new JSMinException('Unterminated regular expression set in regex literal.'); - } - } - } elseif ($this->a === '/') { - break; - } elseif ($this->a === '\\') { - $this->output .= $this->a; - $this->a = $this->get(); - } elseif (ord($this->a) <= self::ORD_LF) { - throw new JSMinException('Unterminated regular expression literal.'); - } - - $this->output .= $this->a; - } - - $this->b = $this->next(); - } - } - } - - /** - * Get next char. Convert ctrl char to space. - * - * @return string|null - */ - protected function get() { - $c = $this->lookAhead; - $this->lookAhead = null; - - if ($c === null) { - if ($this->inputIndex < $this->inputLength) { - $c = substr($this->input, $this->inputIndex, 1); - $this->inputIndex += 1; - } else { - $c = null; - } - } - - if ($c === "\r") { - return "\n"; - } - - if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { - return $c; - } - - return ' '; - } - - /** - * Is $c a letter, digit, underscore, dollar sign, or non-ASCII character. - * - * @return bool - */ - protected function isAlphaNum($c) { - return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; - } - - /** - * Perform minification, return result - * - * @uses action() - * @uses isAlphaNum() - * @uses get() - * @uses peek() - * @return string - */ - protected function min() { - if (0 == strncmp($this->peek(), "\xef", 1)) { - $this->get(); - $this->get(); - $this->get(); - } - - $this->a = "\n"; - $this->action(self::ACTION_DELETE_A_B); - - while ($this->a !== null) { - switch ($this->a) { - case ' ': - if ($this->isAlphaNum($this->b)) { - $this->action(self::ACTION_KEEP_A); - } else { - $this->action(self::ACTION_DELETE_A); - } - break; - - case "\n": - switch ($this->b) { - case '{': - case '[': - case '(': - case '+': - case '-': - case '!': - case '~': - $this->action(self::ACTION_KEEP_A); - break; - - case ' ': - $this->action(self::ACTION_DELETE_A_B); - break; - - default: - if ($this->isAlphaNum($this->b)) { - $this->action(self::ACTION_KEEP_A); - } - else { - $this->action(self::ACTION_DELETE_A); - } - } - break; - - default: - switch ($this->b) { - case ' ': - if ($this->isAlphaNum($this->a)) { - $this->action(self::ACTION_KEEP_A); - break; - } - - $this->action(self::ACTION_DELETE_A_B); - break; - - case "\n": - switch ($this->a) { - case '}': - case ']': - case ')': - case '+': - case '-': - case '"': - case "'": - $this->action(self::ACTION_KEEP_A); - break; - - default: - if ($this->isAlphaNum($this->a)) { - $this->action(self::ACTION_KEEP_A); - } - else { - $this->action(self::ACTION_DELETE_A_B); - } - } - break; - - default: - $this->action(self::ACTION_KEEP_A); - break; - } - } - } - - return $this->output; - } - - /** - * Get the next character, skipping over comments. peek() is used to see - * if a '/' is followed by a '/' or '*'. - * - * @uses get() - * @uses peek() - * @throws JSMinException On unterminated comment. - * @return string - */ - protected function next() { - $c = $this->get(); - - if ($c === '/') { - switch($this->peek()) { - case '/': - for (;;) { - $c = $this->get(); - - if (ord($c) <= self::ORD_LF) { - return $c; - } - } - - case '*': - $this->get(); - - for (;;) { - switch($this->get()) { - case '*': - if ($this->peek() === '/') { - $this->get(); - return ' '; - } - break; - - case null: - throw new JSMinException('Unterminated comment.'); - } - } - - default: - return $c; - } - } - - return $c; - } - - /** - * Get next char. If is ctrl character, translate to a space or newline. - * - * @uses get() - * @return string|null - */ - protected function peek() { - $this->lookAhead = $this->get(); - return $this->lookAhead; - } -} - -// -- Exceptions --------------------------------------------------------------- -class JSMinException extends Exception {} -?> diff --git a/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php b/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php index e1d4d019423..22d0bf0ce22 100644 --- a/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php +++ b/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php @@ -9,7 +9,10 @@ namespace Magento\Framework\Code\Minifier\Adapter\Css; use CSSmin; use Magento\Framework\Code\Minifier\AdapterInterface; -class CssMinifier implements AdapterInterface +/** + * Adapter for CSSmin library + */ +class CSSmin implements AdapterInterface { /** * 'pcre.recursion_limit' value for CSSMin minification diff --git a/lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/JShrink.php b/lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/JShrink.php new file mode 100644 index 00000000000..f0b0976ff55 --- /dev/null +++ b/lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/JShrink.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Code\Minifier\Adapter\Js; + +use JShrink\Minifier; +use Magento\Framework\Code\Minifier\AdapterInterface; + +/** + * Adapter for JShrink library + */ +class JShrink implements AdapterInterface +{ + /** + * Takes a string containing javascript and removes unneeded characters in + * order to shrink the code without altering it's functionality. + * + * @param string $content The raw javascript to be minified + * @throws \Exception + * @return bool|string + */ + public function minify($content) + { + return Minifier::minify($content); + } +} diff --git a/lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/Jsmin.php b/lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/Jsmin.php deleted file mode 100644 index fa5d3c2acb1..00000000000 --- a/lib/internal/Magento/Framework/Code/Minifier/Adapter/Js/Jsmin.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Code\Minifier\Adapter\Js; - -if (!class_exists('JSMin')) { - require_once __DIR__ . '/../../../../../../JSMin/jsmin.php'; -} -/** - * Adapter for JSMin library - */ -class Jsmin implements \Magento\Framework\Code\Minifier\AdapterInterface -{ - /** - * {@inheritdoc} - */ - public function minify($content) - { - return \JSMin::minify($content); - } -} diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JsminTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JsminTest.php index 0ebb776c2b7..d6fe67bacc6 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JsminTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JsminTest.php @@ -5,12 +5,12 @@ */ namespace Magento\Framework\Code\Test\Unit\Minifier\Adapter\Js; -class JsminTest extends \PHPUnit_Framework_TestCase +class JShrinkTest extends \PHPUnit_Framework_TestCase { public function testMinify() { $content = file_get_contents(__DIR__ . '/../../_files/js/original.js'); - $minifier = new \Magento\Framework\Code\Minifier\Adapter\Js\Jsmin(); + $minifier = new \Magento\Framework\Code\Minifier\Adapter\Js\JShrink(); $actual = $minifier->minify($content); $expected = "\nvar one='one';var two='two';"; $this->assertEquals($expected, $actual); -- GitLab