[Pkg-owncloud-commits] [owncloud] 17/17: Use JSqueeze instead of JSMin
David Prévot
taffit at moszumanska.debian.org
Thu Mar 12 22:07:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 54c0d3f4a77f7adaa36efb81cea97e923b459283
Author: David Prévot <taffit at debian.org>
Date: Wed Feb 25 21:08:26 2015 -0400
Use JSqueeze instead of JSMin
---
debian/control | 1 +
.../0007-use-JSqueeze-instead-of-JSMin-13052.patch | 143 +++++++++++++++++++++
debian/patches/0008-Fix-JS.patch | 31 +++++
debian/patches/series | 2 +
4 files changed, 177 insertions(+)
diff --git a/debian/control b/debian/control
index 6f1dc7f..51dbfac 100644
--- a/debian/control
+++ b/debian/control
@@ -26,6 +26,7 @@ Depends: apache2 | httpd,
php-doctrine-dbal (>= 2.4),
php-getid3 (>= 1.9.5~),
php-opencloud,
+ php-patchwork-jsqueeze,
php-patchwork-utf8,
php-pear,
php-pimple (>= 3),
diff --git a/debian/patches/0007-use-JSqueeze-instead-of-JSMin-13052.patch b/debian/patches/0007-use-JSqueeze-instead-of-JSMin-13052.patch
new file mode 100644
index 0000000..b06664e
--- /dev/null
+++ b/debian/patches/0007-use-JSqueeze-instead-of-JSMin-13052.patch
@@ -0,0 +1,143 @@
+From: Adam Williamson <awilliam at redhat.com>
+Date: Fri, 9 Jan 2015 17:36:18 -0800
+Subject: use JSqueeze instead of JSMin (#13052)
+
+The JSMin minifier is non-free. JSqueeze is free, it's also a
+currently-maintained project following good development
+practices, and the best-performing minifier we tested. This
+requires a corresponding 3rdparty commit to drop mrclay/minify
+and add JSqueeze, and also uses a backport of the latest
+upstream version of the Assetic JSqueeze filter as the current
+version in 1.2 does not work with JSqueeze 2.x. The backported
+filter file can be dropped when our bundled copy of Assetic is
+updated to a version containing the newer JSqueezeFilter.
+
+Bug: https://github.com/owncloud/core/issues/13052
+Origin: vendor, https://github.com/AdamWill/core/commit/da866a885bbc035a12c4e98fd0eed2ec660b0d7f
+---
+ lib/private/assetic/jsqueeze2filter.php | 93 +++++++++++++++++++++++++++++++++
+ lib/private/templatelayout.php | 4 +-
+ 2 files changed, 95 insertions(+), 2 deletions(-)
+ create mode 100644 lib/private/assetic/jsqueeze2filter.php
+
+diff --git a/lib/private/assetic/jsqueeze2filter.php b/lib/private/assetic/jsqueeze2filter.php
+new file mode 100644
+index 0000000..8ea5033
+--- /dev/null
++++ b/lib/private/assetic/jsqueeze2filter.php
+@@ -0,0 +1,93 @@
++<?php
++
++/**
++ * ownCloud
++ *
++ * Copyright (C) 2014 Robin McCorkell <rmccorkell at karoshi.org.uk>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
++ * License as published by the Free Software Foundation; either
++ * version 3 of the License, or any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
++ *
++ * You should have received a copy of the GNU Affero General Public
++ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
++ *
++ * This file is just a copy of Assetic's JSqueezeFilter following
++ * https://github.com/kriswallsmith/assetic/pull/698, with the class
++ * renamed to JSqueeze2Filter, namespace changed, and use statements
++ * adjusted. It can be dropped as soon as OC's bundled Assetic is updated
++ * to a version containing the JSqueezeFilter that works with JSqueeze 2.x.
++ */
++
++namespace OC\Assetic;
++
++use Assetic\Filter\FilterInterface;
++use Assetic\Asset\AssetInterface;
++
++/**
++ * JSqueeze filter.
++ *
++ * @link https://github.com/nicolas-grekas/JSqueeze
++ * @author Nicolas Grekas <p at tchwork.com>
++ */
++class JSqueeze2Filter implements FilterInterface
++{
++ private $singleLine = true;
++ private $keepImportantComments = true;
++ private $className;
++ private $specialVarRx = false;
++ private $defaultRx;
++
++ function __construct() {
++ // JSqueeze is namespaced since 2.x, this works with both 1.x and 2.x
++ if (class_exists('\\Patchwork\\JSqueeze')) {
++ $this->className = '\\Patchwork\\JSqueeze';
++ $this->defaultRx = \Patchwork\JSqueeze::SPECIAL_VAR_PACKER;
++ } else {
++ $this->className = '\\JSqueeze';
++ $this->defaultRx = \JSqueeze::SPECIAL_VAR_RX;
++ }
++ }
++
++ public function setSingleLine($bool)
++ {
++ $this->singleLine = (bool) $bool;
++ }
++
++ // call setSpecialVarRx(true) to enable global var/method/property
++ // renaming with the default regex (for 1.x or 2.x)
++ public function setSpecialVarRx($specialVarRx)
++ {
++ if (true === $specialVarRx) {
++ $this->specialVarRx = $this->defaultRx;
++ } else {
++ $this->specialVarRx = $specialVarRx;
++ }
++ }
++
++ public function keepImportantComments($bool)
++ {
++ $this->keepImportantComments = (bool) $bool;
++ }
++
++ public function filterLoad(AssetInterface $asset)
++ {
++ }
++
++ public function filterDump(AssetInterface $asset)
++ {
++ $parser = new $this->className();
++ $asset->setContent($parser->squeeze(
++ $asset->getContent(),
++ $this->singleLine,
++ $this->keepImportantComments,
++ $this->specialVarRx
++ ));
++ }
++}
+diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php
+index 99b10e4..ff53ebc 100644
+--- a/lib/private/templatelayout.php
++++ b/lib/private/templatelayout.php
+@@ -5,7 +5,7 @@ use Assetic\AssetWriter;
+ use Assetic\Filter\CssImportFilter;
+ use Assetic\Filter\CssMinFilter;
+ use Assetic\Filter\CssRewriteFilter;
+-use Assetic\Filter\JSMinFilter;
++use OC\Assetic\JSqueeze2Filter; // see note in jsqueeze2filter.php
+ use OC\Assetic\SeparatorFilter; // waiting on upstream
+
+ /**
+@@ -173,7 +173,7 @@ class OC_TemplateLayout extends OC_Template {
+ ), $root, $file);
+ }
+ return new FileAsset($root . '/' . $file, array(
+- new JSMinFilter(),
++ new JSqueeze2Filter(),
+ new SeparatorFilter(';')
+ ), $root, $file);
+ }, $jsFiles);
diff --git a/debian/patches/0008-Fix-JS.patch b/debian/patches/0008-Fix-JS.patch
new file mode 100644
index 0000000..02533b3
--- /dev/null
+++ b/debian/patches/0008-Fix-JS.patch
@@ -0,0 +1,31 @@
+From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
+Date: Thu, 26 Feb 2015 16:50:23 -0400
+Subject: Fix JS
+
+The current minifier provides something broken for it.
+---
+ apps/files_texteditor/js/vendor/ace/src-noconflict/ace.js | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/apps/files_texteditor/js/vendor/ace/src-noconflict/ace.js b/apps/files_texteditor/js/vendor/ace/src-noconflict/ace.js
+index a1beaab..546f8f0 100644
+--- a/apps/files_texteditor/js/vendor/ace/src-noconflict/ace.js
++++ b/apps/files_texteditor/js/vendor/ace/src-noconflict/ace.js
+@@ -8666,14 +8666,15 @@ var Document = function(text) {
+ this.createAnchor = function(row, column) {
+ return new Anchor(this, row, column);
+ };
+- if ("aaa".split(/a/).length == 0)
++ if ("aaa".split(/a/).length == 0) {
+ this.$split = function(text) {
+ return text.replace(/\r\n|\r/g, "\n").split("\n");
+ }
+- else
++ } else {
+ this.$split = function(text) {
+ return text.split(/\r\n|\r|\n/);
+ };
++ }
+
+
+ this.$detectNewLine = function(text) {
diff --git a/debian/patches/series b/debian/patches/series
index 393d9aa..6c9b06c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,5 @@
path/0004-Adapt-aws-sdk-path.patch
path/0005-Adapt-google-api-php-client-path.patch
path/0006-Adapt-Dropbox-path.patch
+0007-use-JSqueeze-instead-of-JSMin-13052.patch
+0008-Fix-JS.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list