debian/0000755000000000000000000000000011753550655007202 5ustar debian/rules0000755000000000000000000000115411753550076010260 0ustar #!/usr/bin/make -f include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/ant.mk DEB_COMPRESS_EXCLUDE := .class JAVA_HOME := /usr/lib/jvm/default-java DEB_JARS := jargs DEB_ANT_BUILD_TARGET := build.jar DEB_CLEAN_BUILD_TARGET := clean DEB_DH_INSTALLCHANGELOGS_ARGS := doc/CHANGELOG LIBRARY=yui-compressor VERSION=2.4.7 RHINO_VERSION=1.7R2-4 install/yui-compressor:: # Launch tests (cd tests; bash ./suite.sh) # Rename JAR file cp build/yuicompressor-${VERSION}.jar build/yui-compressor.jar get-orig-source: debian/fetch-upstream ${VERSION} ${DEB_UPSTREAM_VERSION} ${RHINO_VERSION} debian/watch0000644000000000000000000000016111555244074010224 0ustar # No watch file # Upstream download site http://yuilibrary.com/downloads/ # doesn't provide a way for scanning. debian/changelog0000644000000000000000000000542111753550452011051 0ustar yui-compressor (2.4.7-1) unstable; urgency=low * New upstream release. * Bump Standards-Version to 3.9.3.1 (no changes needed). * d/control: Add missing librhino-java in Build-Depends. * d/rules: js.jar is not needed in DEB_JARS (only used for cssmin testsuite). * d/control: Wrap-and-sort fields. -- Damien Raude-Morvan Sat, 12 May 2012 22:56:01 +0200 yui-compressor (2.4.6+rhino17R2-1) unstable; urgency=low * Re-add some part of embedded Rhino source code: (Closes: #630542). - d/copyright: Readd copyright notice. - d/control: Drop Depends and Build-Depends on rhino. - d/fetch-upstream: Update script to download rhino source code. -- Damien Raude-Morvan Mon, 04 Jul 2011 23:26:08 +0200 yui-compressor (2.4.6+debian1-1) unstable; urgency=low * New source tarball without embedded Rhino source code: - Update d/copyright since there is no more Rhino source code in this tarball. - d/patches/{parser,token,decompiler,tokenstream}.patch: Dropped. * d/patches/fix_testsuite.diff: Fix test suite to use /usr/share/java/js.jar * d/patches/rhino17R3.diff: Use Rhino AST API to plug-in this compressor. -- Damien Raude-Morvan Sun, 12 Jun 2011 22:04:43 +0200 yui-compressor (2.4.6-1) unstable; urgency=low * New upstream release (Closes: #622856). * Bump Standards-Version to 3.9.2 (no changes needed). * Switch to 3.0 (quilt) source format. * d/watch: Upstream has broken scanning. Disable uscan for now. * d/copyright: Update copyright years and paste full licence text. -- Damien Raude-Morvan Mon, 25 Apr 2011 11:50:28 +0200 yui-compressor (2.4.2-2) unstable; urgency=low * Add Depends on a Java runtime (Closes: #565645) * Depends on libjargs-java instead of embedding it inside yui-compressor (see use-system-libraries.patch) * Update Vcs-* fields to reflect package name change (yuicompressor -> yui-compressor) * Create extended manpage from help output - remove docbook debian/yui-compressor.1.xml - remove Build-Depends on docbook2x * Use java-wrappers for bin/yui-compressor launcher script -- Damien Raude-Morvan Sun, 17 Jan 2010 19:51:06 +0100 yui-compressor (2.4.2-1) unstable; urgency=low [ Dominik Smatana ] * Initial release (closes: #519938) [ Michael Gilbert ] * Download the required rhino source files in the orig tarball fetching script. * Add patches for build file to use system rhino and jargs libraries. * Apply yui-compressor patches to the included rhino source. * Add a README.source to describe the patch system. * Add a launcher shell script. * Add a manpage for the shell script. -- Michael Gilbert Thu, 07 Jan 2010 21:34:14 -0500 debian/compat0000644000000000000000000000000211276115006010363 0ustar 7 debian/docs0000644000000000000000000000001311276115006010032 0ustar doc/README debian/fetch-upstream0000644000000000000000000000230311604430734012040 0ustar #!/bin/sh set -e echo $# if test "$#" != "3" ; then echo "usage: $0 " exit 1 fi version="$1" orig_tarball_version="$2" rhino_version="$3" curdir="$PWD" # download cd /tmp wget -N http://yui.zenfs.com/releases/yuicompressor/yuicompressor-$version.zip unzip -xq yuicompressor-$version.zip rm yuicompressor-$version.zip # cleanup rm -rf yuicompressor-$version/build rm -rf yuicompressor-$version/lib rm -rf yuicompressor-$version/src/org/mozilla/javascript/* # download rhino source debsnap --verbose rhino $rhino_version rhino_tar_version="$(echo $rhino_version | cut -d - -f 1)" rhino_dir_version="$(echo $rhino_tar_version | sed "s/\./_/")" (cd source-rhino/; tar xvzf rhino_$rhino_tar_version.orig.tar.gz) cp -r source-rhino/rhino$rhino_dir_version/src/org/mozilla/* yuicompressor-$version/src/org/mozilla/ # repack mv yuicompressor-$version yui-compressor-$version tar czf yui-compressor_$orig_tarball_version.orig.tar.gz yui-compressor-$version rm -rf yui-compressor-$version rm -rf source-rhino mv yui-compressor_$orig_tarball_version.orig.tar.gz $curdir echo "Done: successfully created yui-compressor_$version.orig.tar.gz." debian/source/0000755000000000000000000000000011753550655010502 5ustar debian/source/format0000644000000000000000000000001411555244074011703 0ustar 3.0 (quilt) debian/bin/0000755000000000000000000000000011753550655007752 5ustar debian/bin/yui-compressor0000644000000000000000000000040211324657057012667 0ustar #!/bin/sh YUI_JAR=/usr/share/yui-compressor/yui-compressor.jar # Include the wrappers utility script . /usr/lib/java-wrappers/java-wrappers.sh # We need a java5 runtime find_java_runtime java5 # Run YUI Compressor run_java -jar $YUI_JAR $extra_args "$@" debian/patches/0000755000000000000000000000000011753550655010631 5ustar debian/patches/token.patch0000644000000000000000000000107311604427562012766 0ustar YUI patch for the Rhino library's Token.java =================================================================== --- a/src/org/mozilla/javascript/Token.java.orig 2009-12-25 00:39:07.000000000 -0500 +++ b/src/org/mozilla/javascript/Token.java 2009-12-25 00:39:39.000000000 -0500 @@ -258,7 +258,11 @@ LETEXPR = 157, WITHEXPR = 158, DEBUGGER = 159, - LAST_TOKEN = 159; + + CONDCOMMENT = 160, + KEEPCOMMENT = 161, + + LAST_TOKEN = 162; public static String name(int token) { debian/patches/tokenstream.patch0000644000000000000000000002001111604427562014173 0ustar YUI patch for the Rhino library's TokenStream.java =================================================================== --- a/src/org/mozilla/javascript/TokenStream.java +++ b/src/org/mozilla/javascript/TokenStream.java @@ -526,7 +526,7 @@ stringBufferTop = 0; c = getChar(); - strLoop: while (c != quoteChar) { + while (c != quoteChar) { if (c == '\n' || c == EOF_CHAR) { ungetChar(c); parser.addError("msg.unterminated.string.lit"); @@ -535,89 +535,47 @@ if (c == '\\') { // We've hit an escaped character - int escapeVal; c = getChar(); + switch (c) { - case 'b': c = '\b'; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - - // \v a late addition to the ECMA spec, - // it is not in Java, so use 0xb - case 'v': c = 0xb; break; - - case 'u': - // Get 4 hex digits; if the u escape is not - // followed by 4 hex digits, use 'u' + the - // literal character sequence that follows. - int escapeStart = stringBufferTop; - addToString('u'); - escapeVal = 0; - for (int i = 0; i != 4; ++i) { - c = getChar(); - escapeVal = Kit.xDigitToInt(c, escapeVal); - if (escapeVal < 0) { - continue strLoop; - } + + case '\\': // backslash + case 'b': // backspace + case 'f': // form feed + case 'n': // line feed + case 'r': // carriage return + case 't': // horizontal tab + case 'v': // vertical tab + case 'd': // octal sequence + case 'u': // unicode sequence + case 'x': // hexadecimal sequence + // Only keep the '\' character for those + // characters that need to be escaped... + // Don't escape quoting characters... + addToString('\\'); addToString(c); - } - // prepare for replace of stored 'u' sequence - // by escape value - stringBufferTop = escapeStart; - c = escapeVal; - break; - case 'x': - // Get 2 hex digits, defaulting to 'x'+literal - // sequence, as above. - c = getChar(); - escapeVal = Kit.xDigitToInt(c, 0); - if (escapeVal < 0) { - addToString('x'); - continue strLoop; - } else { - int c1 = c; - c = getChar(); - escapeVal = Kit.xDigitToInt(c, escapeVal); - if (escapeVal < 0) { - addToString('x'); - addToString(c1); - continue strLoop; - } else { - // got 2 hex digits - c = escapeVal; - } - } - break; + break; - case '\n': - // Remove line terminator after escape to follow - // SpiderMonkey and C/C++ - c = getChar(); - continue strLoop; - - default: - if ('0' <= c && c < '8') { - int val = c - '0'; - c = getChar(); - if ('0' <= c && c < '8') { - val = 8 * val + c - '0'; - c = getChar(); - if ('0' <= c && c < '8' && val <= 037) { - // c is 3rd char of octal sequence only - // if the resulting val <= 0377 - val = 8 * val + c - '0'; - c = getChar(); - } + case '\n': + // Remove line terminator after escape + break; + + default: + if (isDigit(c)) { + // Octal representation of a character. + // Preserve the escaping (see Y! bug #1637286) + addToString('\\'); } - ungetChar(c); - c = val; - } + addToString(c); + break; } + + } else { + + addToString(c); } - addToString(c); + c = getChar(); } @@ -760,16 +718,35 @@ } if (matchChar('*')) { boolean lookForSlash = false; + StringBuffer sb = new StringBuffer(); for (;;) { c = getChar(); if (c == EOF_CHAR) { parser.addError("msg.unterminated.comment"); return Token.ERROR; - } else if (c == '*') { + } + sb.append((char) c); + if (c == '*') { lookForSlash = true; } else if (c == '/') { if (lookForSlash) { - continue retry; + sb.delete(sb.length()-2, sb.length()); + String s1 = sb.toString(); + String s2 = s1.trim(); + if (s1.startsWith("!")) { + // Remove the leading '!' + this.string = s1.substring(1); + return Token.KEEPCOMMENT; + } else if (s2.startsWith("@cc_on") || + s2.startsWith("@if") || + s2.startsWith("@elif") || + s2.startsWith("@else") || + s2.startsWith("@end")) { + this.string = s1; + return Token.CONDCOMMENT; + } else { + continue retry; + } } } else { lookForSlash = false; debian/patches/parser.patch0000644000000000000000000000304511604427562013143 0ustar YUI patch for the Rhino library's Parser.java =================================================================== --- a/src/org/mozilla/javascript/Parser.java +++ b/src/org/mozilla/javascript/Parser.java @@ -169,11 +169,30 @@ { int tt = currentFlaggedToken; if (tt == Token.EOF) { - tt = ts.getToken(); + + while ((tt = ts.getToken()) == Token.CONDCOMMENT || tt == Token.KEEPCOMMENT) { + if (tt == Token.CONDCOMMENT) { + /* Support for JScript conditional comments */ + decompiler.addJScriptConditionalComment(ts.getString()); + } else { + /* Support for preserved comments */ + decompiler.addPreservedComment(ts.getString()); + } + } + if (tt == Token.EOL) { do { tt = ts.getToken(); - } while (tt == Token.EOL); + + if (tt == Token.CONDCOMMENT) { + /* Support for JScript conditional comments */ + decompiler.addJScriptConditionalComment(ts.getString()); + } else if (tt == Token.KEEPCOMMENT) { + /* Support for preserved comments */ + decompiler.addPreservedComment(ts.getString()); + } + + } while (tt == Token.EOL || tt == Token.CONDCOMMENT || tt == Token.KEEPCOMMENT); tt |= TI_AFTER_EOL; } currentFlaggedToken = tt; debian/patches/decompiler.patch0000644000000000000000000000127511604427562013775 0ustar YUI patch for the Rhino library's Decompiler.java =================================================================== --- a/src/org/mozilla/javascript/Decompiler.java.orig 2008-11-14 10:13:36.000000000 -0500 +++ b/src/org/mozilla/javascript/Decompiler.java 2008-11-14 10:13:36.000000000 -0500 @@ -166,6 +166,18 @@ appendString('/' + regexp + '/' + flags); } + void addJScriptConditionalComment(String str) + { + addToken(Token.CONDCOMMENT); + appendString(str); + } + + void addPreservedComment(String str) + { + addToken(Token.KEEPCOMMENT); + appendString(str); + } + void addNumber(double n) { addToken(Token.NUMBER); debian/patches/series0000644000000000000000000000015211604427562012037 0ustar fix_testsuite.diff use-system-libraries.patch decompiler.patch parser.patch token.patch tokenstream.patch debian/patches/fix_testsuite.diff0000644000000000000000000000062411575220755014361 0ustar Description: Use /usr/share/java/js.jar Author: Damien Raude-Morvan Last-Update: 2011-06-12 Forwarded: not-needed --- a/tests/suite.sh +++ b/tests/suite.sh @@ -18,7 +18,7 @@ if [ "$2" == "cssminjs" ]; then actual="$( - java -jar ../lib/rhino-1.6R7.jar suite.rhino $testfile + java -jar /usr/share/java/js.jar suite.rhino $testfile )" else debian/patches/use-system-libraries.patch0000644000000000000000000000263311753550132015734 0ustar Description: - use Debian's jargs ard rhino libraries during build - don't embed jargs inside yui-compressor jar Author: Michael Gilbert Author: Damien Raude-Morvan Last-Update: 2010-01-17 --- a/build.xml +++ b/build.xml @@ -23,8 +23,7 @@ target="1.5" source="1.5"> - - + @@ -33,13 +32,12 @@ - - + debian/yui-compressor.10000644000000000000000000000262311324655530012257 0ustar .TH YUI-COMPRESSOR "1" "January 2010" "yui-compressor " "User Commands" .SH NAME yui-compressor \- JavaScript/CSS minifier .SH SYNOPSIS .B yui-compressor \fR[\fIoptions\fR] [\fIinput file\fR] .SH DESCRIPTION Global Options .TP \fB\-h\fR, \fB\-\-help\fR Displays this information .TP \fB\-\-type\fR Specifies the type of the input file .TP \fB\-\-charset\fR Read the input file using .TP \fB\-\-line\-break\fR Insert a line break after the specified column number .TP \fB\-v\fR, \fB\-\-verbose\fR Display informational messages and warnings .TP \fB\-o\fR Place the output into . Defaults to stdout. .PP JavaScript Options .TP \fB\-\-nomunge\fR Minify only, do not obfuscate .TP \fB\-\-preserve\-semi\fR Preserve all semicolons .TP \fB\-\-disable\-optimizations\fR Disable all micro optimizations .PP If no input file is specified, it defaults to stdin. In this case, the 'type' option is required. Otherwise, the 'type' option is required only if the input file extension is neither 'js' nor 'css'. .SH EXAMPLES The following example demonstrates how to use yui-compressor .TP .B yui-compressor -o compressed.js original.js .SH SEE ALSO .BR /usr/share/doc/yui-compressor/README.gz .SH AUTHOR This manual page was written by Damien Raude-Morvan and Michael Gilbert , for the Debian GNU/Linux system (but may be used by others). debian/manpages0000644000000000000000000000003011324655530010701 0ustar debian/yui-compressor.1 debian/control0000644000000000000000000000252411753550250010577 0ustar Source: yui-compressor Section: java Priority: optional Maintainer: Debian Java Maintainers Uploaders: Dominik Smatana , Damien Raude-Morvan , Michael Gilbert Build-Depends: ant, cdbs, debhelper (>= 7), default-jdk Build-Depends-Indep: libjargs-java, librhino-java Homepage: http://yuilibrary.com/projects/yuicompressor/ Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/yui-compressor/ Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/yui-compressor/ Standards-Version: 3.9.3.1 Package: yui-compressor Architecture: all Depends: default-jre-headless | java5-runtime-headless, java-wrappers, libjargs-java, ${misc:Depends} Description: JavaScript/CSS minifier The YUI Compressor is a JavaScript compressor which, in addition to removing comments and white-spaces, obfuscates local variables using the smallest possible variable name. This obfuscation is safe, even when using constructs such as 'eval' or 'with' (although the compression is not optimal is those cases) Compared to jsmin, the average savings is around 20%. . The YUI Compressor is also able to safely compress CSS files. The decision on which compressor is being used is made on the file extension (js or css). debian/yui-compressor.install0000644000000000000000000000012611324655530013561 0ustar build/yui-compressor.jar /usr/share/yui-compressor debian/bin/yui-compressor /usr/bin debian/copyright0000644000000000000000000001237311753547735011150 0ustar Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=174 Upstream-Name: YUI Compressor Upstream-Contact: Julien Lecomte Source: http://yuilibrary.com/projects/yuicompressor/ Files: * Copyright: Copyright 2007-2011, Yahoo! Inc. All rights reserved. License: BSD Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. . * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . * Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Files: src/com/yahoo/platform/yui/compressor/CssCompressor.java Copyright: Copyright 2007-2009, Yahoo! Inc. All rights reserved. License: BSD This code is a port of Isaac Schlueter's cssmin utility. . Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. . * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . * Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Files: src/org/* Copyright: Copyright 1997-1999, Netscape Communications Corporation. License: MPL-1.1 | GPL-2+ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ . Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. . The Original Code is Rhino code, released May 6, 1999. . The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by the Initial Developer are Copyright (C) 1997-1999 the Initial Developer. All Rights Reserved. . Contributor(s): Mike Ang Igor Bukanov Bob Jervis Mike McCabe . Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replacing them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. Files: debian/* Copyright: Copyright 2009, Dominik Smatana Copyright: Copyright 2009-2011, Damien Raude-Morvan License: GPL-3 On Debian systems the full text of the GNU General Public License version 3 can be found in the '/usr/share/common-licenses/GPL-3' file.