JavaScript-Minifier-1.17000755001750001750 015225127471 15253 5ustar00zoffixzoffix000000000000README100644001750001750 63215225127471 16175 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17This archive contains the distribution JavaScript-Minifier, version 1.17: Perl extension for minifying JavaScript code This software is copyright (c) 2026 by Peter Michaux . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v6.037. Changes100644001750001750 273115225127471 16632 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17Revision history for Perl extension JavaScript::Minifier. 1.17 2026-07-13 - Maintenance update - verified module is still working 1.16 2021-03-03 - Fixed parsing of regexp containing unescaped slash (by faf, #12) 1.15 2021-02-02 - Fixed parsing errors with regexp return (by faf, #11) 1.14 2015-04-23 - Fixed error in SYNOPSIS 1.13 2015-03-19 [Changes by vti] - Fixed Issue #4 (Error in the docs) - Updated Synopsis to use modern code 1.12 2014-10-04 - Fixed Issue #3 (warnings for empty files) 1.11 2014-01-30 - Added my dzil author plugin bundle and fixed up some packaging issues 1.10 2014-01-22 - Added missing test prereqs - Fixed up wrong year in the latest versions in the change log 1.09 2014-01-22 - Made some changes to dzil plugins and added git repos for this module 1.08 2014-01-19 - Fixed RT#76800 (preserve "\n" at the end of file) 1.07 2014-01-19 - Fixed license issue (RT#92298) - Converted to Dist::Zilla for packaging 1.06 2014-01-18 - Zoffix Znet took over maintenance - Applied user-submitted bug patches - Modified the build system - Added pod and kwalitee tests - Added examples/minify.pl - Fixed RT#85899 (superfluous perl 5.8 requirement) - Fixed RT#91292 and RT#91291 (optimizations) 1.05 2014-01-18 - This and previous 'Changes' are lost 0.01 2007-05-19 - original version; created by h2xs 1.23 with options -X -n JavaScript::Minifier LICENSE100644001750001750 4641715225127471 16375 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17This software is copyright (c) 2026 by Peter Michaux . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2026 by Peter Michaux . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Moe Ghoul, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2026 by Peter Michaux . This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End INSTALL100644001750001750 447415225127471 16376 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17This is the Perl distribution JavaScript-Minifier. Installing JavaScript-Minifier is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm JavaScript::Minifier If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan JavaScript::Minifier ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/JavaScript::Minifier Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the . ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the . ## Documentation JavaScript-Minifier documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc JavaScript::Minifier For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html dist.ini100644001750001750 62415225127471 16762 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17name = JavaScript-Minifier author = Zoffix Znet license = Perl_5 copyright_holder = Peter Michaux [@Author::ZOFFIX] -remove = Test::Synopsis -remove = PodCoverageTests -remove = Test::EOL [Encoding] encoding = bytes match = ^t/scripts [Meta::Contributors] contributor = Miller 'tmhall' Hall contributor = Вячеслав 'vti' Тихановскийxt000755001750001750 015225127471 15627 5ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17pod.t100644001750001750 40115225127471 16711 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt#!perl -T use 5.006; use strict; use warnings FATAL => 'all'; use Test::More; # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); META.yml100644001750001750 3171515225127471 16634 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17--- abstract: 'Perl extension for minifying JavaScript code' author: - 'Zoffix Znet ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' Test::More: '0' perl: '5.006' configure_requires: ExtUtils::MakeMaker: '0' perl: '5.006' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.037, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: JavaScript-Minifier provides: JavaScript::Minifier: file: lib/JavaScript/Minifier.pm version: '1.17' requires: Exporter: '0' perl: '5.006' strict: '0' warnings: '0' resources: bugtracker: https://github.com/zoffixznet/javascript-minifier/issues homepage: http://metacpan.org/release/JavaScript-Minifier repository: git://github.com/zoffixznet/javascript-minifier.git version: '1.17' x_Dist_Zilla: perl: version: '5.042002' plugins: - class: Dist::Zilla::Plugin::OurPkgVersion name: '@Author::ZOFFIX/OurPkgVersion' version: '0.21' - class: Dist::Zilla::Plugin::Pod::Spiffy name: '@Author::ZOFFIX/Pod::Spiffy' version: '1.001007' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 1 modules: [] phase: release run_under_travis: 0 skip: - ExtUtils::MakeMaker - File::Copy - IPC::Open3 - base - strict - warnings name: '@Author::ZOFFIX/PromptIfStale' version: '0.060' - class: Dist::Zilla::Plugin::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . name: '@Author::ZOFFIX/GatherDir' version: '6.037' - class: Dist::Zilla::Plugin::PruneCruft name: '@Author::ZOFFIX/PruneCruft' version: '6.037' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Author::ZOFFIX/ManifestSkip' version: '6.037' - class: Dist::Zilla::Plugin::MetaYAML name: '@Author::ZOFFIX/MetaYAML' version: '6.037' - class: Dist::Zilla::Plugin::License name: '@Author::ZOFFIX/License' version: '6.037' - class: Dist::Zilla::Plugin::Readme name: '@Author::ZOFFIX/Readme' version: '6.037' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::ZOFFIX/ExecDir' version: '6.037' - class: Dist::Zilla::Plugin::ShareDir name: '@Author::ZOFFIX/ShareDir' version: '6.037' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Author::ZOFFIX/MakeMaker' version: '6.037' - class: Dist::Zilla::Plugin::Manifest name: '@Author::ZOFFIX/Manifest' version: '6.037' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@Author::ZOFFIX/AutoPrereqs' version: '6.037' - class: Dist::Zilla::Plugin::MetaConfig name: '@Author::ZOFFIX/MetaConfig' version: '6.037' - class: Dist::Zilla::Plugin::Prereqs::AuthorDeps name: '@Author::ZOFFIX/Prereqs::AuthorDeps' version: '0.007' - class: Dist::Zilla::Plugin::MinimumPerl name: '@Author::ZOFFIX/MinimumPerl' version: '1.006' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@Author::ZOFFIX/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.037' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: 1 inherit_version: 1 meta_noindex: 1 Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000038' version: '0.006' name: '@Author::ZOFFIX/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::InstallGuide config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000038' version: '0.006' name: '@Author::ZOFFIX/InstallGuide' version: '1.200014' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: '@Author::ZOFFIX/ReadmeAnyFromPod' version: '0.163250' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: 0 fail_on_warning: author fake_home: 0 filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: test script_finder: - ':PerlExecFiles' skips: [] switch: [] name: '@Author::ZOFFIX/Test::Compile' version: '2.059' - class: Dist::Zilla::Plugin::Test::DistManifest name: '@Author::ZOFFIX/Test::DistManifest' version: '2.000006' - class: Dist::Zilla::Plugin::Test::Version name: '@Author::ZOFFIX/Test::Version' version: '1.09' - class: Dist::Zilla::Plugin::Test::Kwalitee config: Dist::Zilla::Plugin::Test::Kwalitee: filename: xt/release/kwalitee.t skiptest: [] name: '@Author::ZOFFIX/Test::Kwalitee' version: '2.13' - class: Dist::Zilla::Plugin::MetaTests name: '@Author::ZOFFIX/MetaTests' version: '6.037' - class: Dist::Zilla::Plugin::Test::CPAN::Meta::JSON name: '@Author::ZOFFIX/Test::CPAN::Meta::JSON' version: '0.004' - class: Dist::Zilla::Plugin::MojibakeTests name: '@Author::ZOFFIX/MojibakeTests' version: '0.8' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@Author::ZOFFIX/Test::NoTabs' version: '0.15' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Author::ZOFFIX/PodSyntaxTests' version: '6.037' - class: Dist::Zilla::Plugin::Test::Portability config: Dist::Zilla::Plugin::Test::Portability: options: '' name: '@Author::ZOFFIX/Test::Portability' version: '2.001003' - class: Dist::Zilla::Plugin::Test::UnusedVars name: '@Author::ZOFFIX/Test::UnusedVars' version: '2.001001' - class: Dist::Zilla::Plugin::Test::Pod::LinkCheck name: '@Author::ZOFFIX/Test::Pod::LinkCheck' version: '1.004' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes filename: xt/release/cpan-changes.t name: '@Author::ZOFFIX/Test::CPAN::Changes' version: '0.013' - class: Dist::Zilla::Plugin::Test::PodSpelling config: Dist::Zilla::Plugin::Test::PodSpelling: directories: - bin - lib spell_cmd: '' stopwords: [] wordlist: Pod::Wordlist name: '@Author::ZOFFIX/Test::PodSpelling' version: '2.007006' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000038' version: '0.006' name: '@Author::ZOFFIX/CheckSelfDependency' version: '0.011' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@Author::ZOFFIX/CheckPrereqsIndexed' version: '0.022' - class: Dist::Zilla::Plugin::Test::MinimumVersion config: Dist::Zilla::Plugin::Test::MinimumVersion: max_target_perl: '5.008008' name: '@Author::ZOFFIX/Test::MinimumVersion' version: '2.000011' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '1.001001' version_by_branch: 0 version_regexp: (?^:^v(.+)$) Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . name: '@Author::ZOFFIX/Git::NextVersion' version: '2.052' - class: Dist::Zilla::Plugin::AutoMetaResources name: '@Author::ZOFFIX/AutoMetaResources' version: '1.21' - class: Dist::Zilla::Plugin::CopyFilesFromRelease config: Dist::Zilla::Plugin::CopyFilesFromRelease: filename: - README.md match: [] name: '@Author::ZOFFIX/CopyFilesFromRelease' version: '0.007' - class: Dist::Zilla::Plugin::TestRelease name: '@Author::ZOFFIX/TestRelease' version: '6.037' - class: Dist::Zilla::Plugin::InstallRelease name: '@Author::ZOFFIX/InstallRelease' version: '0.008' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Author::ZOFFIX/ConfirmRelease' version: '6.037' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . name: '@Author::ZOFFIX/Git::Check' version: '2.052' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c signoff: 0 Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Author::ZOFFIX/Git::Commit' version: '2.052' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v1.17 tag_format: v%V tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Author::ZOFFIX/Git::Tag' version: '2.052' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . name: '@Author::ZOFFIX/Git::Push' version: '2.052' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Author::ZOFFIX/UploadToCPAN' version: '6.037' - class: Dist::Zilla::Plugin::Encoding name: Encoding version: '6.037' - class: Dist::Zilla::Plugin::Meta::Contributors name: Meta::Contributors version: '0.003' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.037' - class: Dist::Zilla::Plugin::FinderCode name: '@Author::ZOFFIX/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.037' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: '6.037' x_contributors: - "Miller 'tmhall' Hall" - "Вячеслав 'vti' Тихановский" x_generated_by_perl: v5.42.2 x_serialization_backend: 'YAML::Tiny version 1.76' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' MANIFEST100644001750001750 303615225127471 16467 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.037 Changes INSTALL LICENSE MANIFEST META.yml Makefile.PL README README.md dist.ini examples/minify.pl lib/JavaScript/Minifier.pm t/00-compile.t t/00-load.t t/01-newline-at-end.t t/JavaScript-Minifier.t t/scripts/s10-expected.js t/scripts/s10-got.js t/scripts/s10.js t/scripts/s11-expected.js t/scripts/s11-got.js t/scripts/s11.js t/scripts/s12-expected.js t/scripts/s12-got.js t/scripts/s12.js t/scripts/s13-expected.js t/scripts/s13-got.js t/scripts/s13.js t/scripts/s14-expected.js t/scripts/s14-got.js t/scripts/s14.js t/scripts/s15-expected.js t/scripts/s15-got.js t/scripts/s15.js t/scripts/s16-expected.js t/scripts/s16-got.js t/scripts/s16.js t/scripts/s2-expected.js t/scripts/s2-got.js t/scripts/s2.js t/scripts/s3-expected.js t/scripts/s3-got.js t/scripts/s3.js t/scripts/s4-expected.js t/scripts/s4-got.js t/scripts/s4.js t/scripts/s5-expected.js t/scripts/s5-got.js t/scripts/s5.js t/scripts/s6-expected.js t/scripts/s6-got.js t/scripts/s6.js t/scripts/s7-expected.js t/scripts/s7-got.js t/scripts/s7.js t/scripts/s8-expected.js t/scripts/s8-got.js t/scripts/s8.js t/scripts/s9-expected.js t/scripts/s9-got.js t/scripts/s9.js xt/author/distmeta.t xt/author/minimum-version.t xt/author/mojibake.t xt/author/no-tabs.t xt/author/pod-linkcheck.t xt/author/pod-spell.t xt/author/pod-syntax.t xt/author/portability.t xt/author/test-version.t xt/kwalitee.t xt/pod-coverage.t xt/pod.t xt/release/cpan-changes.t xt/release/dist-manifest.t xt/release/kwalitee.t xt/release/unused-vars.t README.md100644001750001750 615215225127471 16617 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17# NAME JavaScript::Minifier - Perl extension for minifying JavaScript code # SYNOPSIS To minify a JavaScript file and have the output written directly to another file use JavaScript::Minifier qw(minify); open(my $in, 'myScript.js') or die; open(my $out, '>', 'myScript-min.js') or die; minify(input => $in, outfile => $out); close($in); close($out); To minify a JavaScript string literal. Note that by omitting the outfile parameter a the minified code is returned as a string. my $minifiedJavaScript = minify(input => 'var x = 2;'); To include a copyright comment at the top of the minified code. minify(input => 'var x = 2;', copyright => 'BSD License'); To treat ';;;' as '//' so that debugging code can be removed. This is a common JavaScript convention for minification. minify(input => 'var x = 2;', stripDebug => 1); The "input" parameter is mandatory. The "output", "copyright", and "stripDebug" parameters are optional and can be used in any combination. # DESCRIPTION This module removes unnecessary whitespace from JavaScript code. The primary requirement developing this module is to not break working code: if working JavaScript is in input then working JavaScript is output. It is ok if the input has missing semi-colons, snips like '++ +' or '12 .toString()', for example. Internet Explorer conditional comments are copied to the output but the code inside these comments will not be minified. The ECMAScript specifications allow for many different whitespace characters: space, horizontal tab, vertical tab, new line, carriage return, form feed, and paragraph separator. This module understands all of these as whitespace except for vertical tab and paragraph separator. These two types of whitespace are not minimized. For static JavaScript files, it is recommended that you minify during the build stage of web deployment. If you minify on-the-fly then it might be a good idea to cache the minified file. Minifying static files on-the-fly repeatedly is wasteful. ## EXPORT Exported by default: `minifiy()` # SEE ALSO This module is inspired by Douglas Crockford's JSMin: [http://www.crockford.com/javascript/jsmin.html](http://www.crockford.com/javascript/jsmin.html) You may also be interested in the [CSS::Minifier](https://metacpan.org/pod/CSS%3A%3AMinifier) module also available on CPAN. # REPOSITORY You can obtain the latest source code and submit bug reports on the github repository for this module: [https://github.com/zoffixznet/JavaScript-Minifier](https://github.com/zoffixznet/JavaScript-Minifier) # MAINTAINER Zoffix Znet `` [https://metacpan.org/author/ZOFFIX](https://metacpan.org/author/ZOFFIX) # AUTHORS Peter Michaux, Eric Herrera, # CONTRIBUTORS Miller 'tmhall' Hall Вячеслав 'vti' Тихановский Fedor A. 'faf' Fetisov # COPYRIGHT AND LICENSE Copyright (C) 2007 by Peter Michaux This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available. t000755001750001750 015225127471 15437 5ustar00zoffixzoffix000000000000JavaScript-Minifier-1.1700-load.t100644001750001750 37615225127471 17106 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t#!perl -T use 5.006; use strict; use warnings FATAL => 'all'; use Test::More; plan tests => 1; BEGIN { use_ok( 'JavaScript::Minifier' ) || print "Bail out!\n"; } diag( "Testing JavaScript::Minifier $JavaScript::Minifier::VERSION, Perl $], $^X" ); Makefile.PL100644001750001750 235315225127471 17311 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.037 use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Perl extension for minifying JavaScript code", "AUTHOR" => "Zoffix Znet ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "JavaScript-Minifier", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "JavaScript::Minifier", "PREREQ_PM" => { "Exporter" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => 0 }, "VERSION" => "1.17", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Exporter" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); kwalitee.t100644001750001750 30615225127471 17740 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt#!/usr/bin/env perl BEGIN { unless ($ENV{RELEASE_TESTING}) { use Test::More; plan(skip_all => 'these tests are for release candidate testing'); } } use Test::Kwalitee;00-compile.t100644001750001750 262115225127471 17632 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/tuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.059 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'JavaScript/Minifier.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'}.$str.q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; scripts000755001750001750 015225127471 17126 5ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/ts9.js100644001750001750 3515225127471 20115 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts asdf asdf 12 .toString();s5.js100644001750001750 17115225127471 20132 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x = foo//a / 2//a / //a 2 /a/a;//a /regexp/ //a /regexp/;//a a +//a ++a;//a a -//a --a;a//a a;a3//a .as3.js100644001750001750 20115225127471 20122 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x = 1//@a / 2//@a / //@a 2 /a/a;//@a /regexp/ //@a /regexp/;//@a a +//@a ++a;//@a a -//@a --a;a//@a a;a3//@a .as7.js100644001750001750 44515225127471 20140 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x = 1; /*asdf*/ /*asdf*/ /*asdf*/ /*asdf*/ // aaaaa //@ a /**/ // //@ a //@ a /*@*//**//*@*/ /*@*/ /* asdfasdf asdf asdf * asdfasdfa * asdfasdfa *//**/ /* asdfasdf asdf asdf * asdfasdfa * asdfasdfa */ var x = 1; s2.js100644001750001750 10515225127471 20124 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts// missing semi-colons function () { var x = 21 var y = 33 [] }s8.js100644001750001750 1315225127471 20110 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts- -- + ++ -s4.js100644001750001750 22715225127471 20133 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x = 1/*@a*/ / 2/*@a*/ / /*@a*/ 2 /a/a;/*@a*/ 2 /*@a*/ / 2; /regexp/ /*@a*/ /regexp/;/*@a*/ a +/*@a*/++a;a -/*@a*/--a;a/*@a*/a;a3/*@a*/.as6.js100644001750001750 22615225127471 20134 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x = 1/*a*/ / 2/*a*/ / /*a*/ 2/*a*/ /a/a;/*a*/ 2 /*a*/ / 2; /regexp/ /*a*/ /regexp/;/*a*/ a +/*a*/++a;a -/*a*/--a;a/*a*/a;a3/*a*/.as16.js100644001750001750 3615225127471 20174 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction (s) { alert("Foo"); }s14.js100644001750001750 1315225127471 20165 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfoo[5] / 14s12.js100644001750001750 10415225127471 20204 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts ! ^ & * ( { [ = | : < > ? ~ s15.js100644001750001750 3715225127471 20174 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction (s) { alert("Foo"); } s13.js100644001750001750 2615225127471 20170 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts/* foo */ var x = 2;s10.js100644001750001750 6515225127471 20170 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts} } ] } /*asdf*/ ) } /*@cc_on asdf */ ) ) ] } ] ] ] )s11.js100644001750001750 7515225127471 20172 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts " a \" a \n \\\\" ' a \' a \n \\\\' /a \. a\\\\/ pod-coverage.t100644001750001750 113615225127471 20530 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt#!perl -T use 5.006; use strict; use warnings FATAL => 'all'; use Test::More; # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok({trustme=>[qr/^/]}); examples000755001750001750 015225127471 17012 5ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17minify.pl100755001750001750 315115225127471 21005 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/examples#!/usr/bin/env perl use strict; use warnings; # VERSION use lib qw{lib ../lib}; use JavaScript::Minifier qw/minify/; my $JS = get_js(); print minify(input => $JS) . "\n"; sub get_js { return <<'END_JS'; function setup_sample_form_data() { var els, i, l; els = $$('.sample_form_data'); for ( i = 0, l = els.length; i < l; i++ ) { els[i].set( 'data-sample-form-data', els[i].get('data-sample-form-data').replace('\\n', "\n") ); if ( els[i].get('value') == '' ) { els[i].set('value', els[i].get('data-sample-form-data')); } else if ( els[i].get('value') != els[i].get('data-sample-form-data') ) { els[i].removeClass('sample_form_data'); } var funct_clear_sample_data = function() { var i, l, els = this.getElements('.sample_form_data'); for ( i = 0, l = els.length; i < l; i++ ) { els[i].set('value', ''); } } els[i].getParent('form').removeEvent('submit', funct_clear_sample_data ); els[i].getParent('form').addEvent('submit', funct_clear_sample_data ); els[i].addEvent('focus', function() { if ( this.get('value') == this.get('data-sample-form-data') ) { this.set('value', ''); this.removeClass('sample_form_data'); } }); els[i].addEvent('blur', function() { if ( this.value == '' ) { this.set('value', this.get('data-sample-form-data')); this.addClass('sample_form_data'); } }); } } END_JS }s5-got.js100644001750001750 7715225127471 20706 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=foo /2 / 2 /a/a;/regexp/ /regexp/;a+ ++a;a- --a;a a;a3 .as3-got.js100644001750001750 16715225127471 20724 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1//@a /2//@a / //@a 2 /a/a;//@a /regexp/ //@a /regexp/;//@a a+//@a ++a;//@a a-//@a --a;a//@a a;a3//@a .as2-got.js100644001750001750 4015225127471 20671 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction(){var x=21 var y=33 []}s9-got.js100644001750001750 3115225127471 20700 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsasdf asdf 12 .toString();s7-got.js100644001750001750 6315225127471 20703 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1;//@ a //@ a //@ a /*@*//*@*/ /*@*/ var x=1;s4-got.js100644001750001750 20315225127471 20714 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1/*@a*/ /2/*@a*/ / /*@a*/ 2 /a/a;/*@a*/ 2/*@a*//2;/regexp/ /*@a*/ /regexp/;/*@a*/ a+/*@a*/++a;a-/*@a*/--a;a/*@a*/a;a3/*@a*/.as6-got.js100644001750001750 10115225127471 20713 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1 /2 / 2 /a/a;2/2;/regexp/ /regexp/;a+ ++a;a- --a;a a;a3 .as8-got.js100644001750001750 1115225127471 20675 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts- --+ ++-author000755001750001750 015225127471 17131 5ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xtno-tabs.t100644001750001750 51615225127471 21003 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/JavaScript/Minifier.pm', 't/00-compile.t', 't/00-load.t', 't/01-newline-at-end.t', 't/JavaScript-Minifier.t' ); notabs_ok($_) foreach @files; done_testing; s10-got.js100644001750001750 3615225127471 20755 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts}}]})}/*@cc_on asdf */))]}]]])s14-got.js100644001750001750 1115225127471 20752 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfoo[5]/14s12-got.js100644001750001750 1615225127471 20755 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts!^&*({[=|:<>?~s15-got.js100644001750001750 3315225127471 20757 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction(s){alert("Foo");} s13-got.js100644001750001750 1015225127471 20750 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=2;s11-got.js100644001750001750 6015225127471 20753 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts" a \" a \n \\\\" ' a \' a \n \\\\' /a \. a\\\\/s16-got.js100644001750001750 3215225127471 20757 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction(s){alert("Foo");}distmeta.t100644001750001750 22215225127471 21244 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests use strict; use warnings; use Test::CPAN::Meta; meta_yaml_ok(); mojibake.t100644001750001750 15115225127471 21214 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/author#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); 01-newline-at-end.t100644001750001750 123415225127471 21011 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t#!perl -T use strict; use warnings FATAL => 'all'; use Test::More; plan tests => 2; ##### ##### This test ensures that if the file contains a new line at the end ##### then that newline will be preserved ##### The read-from-file tests for this are in JavaScript-Minifier.t ##### use JavaScript::Minifier; my $js_with_new_line = <<'END'; function (s) { alert("Foo"); } END chomp( my $js_without_new_line = $js_with_new_line ); like( minify(input => $js_with_new_line), qr/\n\z/, 'Last new line was preserved', ); like( minify(input => $js_without_new_line), qr/[^\n]\z/, 'Last new line was not added because it was absent originally', );release000755001750001750 015225127471 17247 5ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xtkwalitee.t100644001750001750 27515225127471 21365 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/release# this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.13 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok(); done_testing; pod-spell.t100644001750001750 54715225127471 21343 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/authoruse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007006 use Test::Spelling 0.17; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ Hall JavaScript Michaux Miller Minifier Peter Znet Zoffix cpan lib petermichaux tmhall vti Вячеслав Тихановский pod-syntax.t100644001750001750 25115225127471 21542 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); JavaScript-Minifier.t100644001750001750 422315225127471 21573 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t#!perl -T ######################### use Test::More tests => 19; use JavaScript::Minifier qw(minify); ### This is mainly to align the tests to 's' scripts, because s1 is ### somehow missing can_ok('JavaScript::Minifier', 'minify'); ######################### sub filesMatch { my $file1 = shift; my $file2 = shift; my $a; my $b; while (1) { $a = getc($file1); $b = getc($file2); if (!defined($a) && !defined($b)) { # both files end at same place return 1; } elsif (!defined($b) || # file2 ends first !defined($a) || # file1 ends first $a ne $b) { # a and b not the same return 0; } } } sub minTest { my $filename = shift; open(INFILE, 't/scripts/' . $filename . '.js') or die("couldn't open file"); open(GOTFILE, '>t/scripts/' . $filename . '-got.js') or die("couldn't open file"); minify(input => *INFILE, outfile => *GOTFILE); close(INFILE); close(GOTFILE); open(EXPECTEDFILE, 't/scripts/' . $filename . '-expected.js') or die("couldn't open file"); open(GOTFILE, 't/scripts/' . $filename . '-got.js') or die("couldn't open file"); ok(filesMatch(GOTFILE, EXPECTEDFILE), 'testing ' . $filename); close(EXPECTEDFILE); close(GOTFILE); } minTest('s2'); # missing semi-colons minTest('s3'); # //@ minTest('s4'); # /*@*/ minTest('s5'); # // minTest('s6'); # /**/ minTest('s7'); # blocks of comments minTest('s8'); # + + - - minTest('s9'); # alphanum minTest('s10'); # }]) minTest('s11'); # string and regexp literals minTest('s12'); # other characters minTest('s13'); # comment at start minTest('s14'); # slash following square bracket # ... is division not RegExp minTest('s15'); # newline-at-end-of-file # -> not there so don't add minTest('s16'); # newline-at-end-of-file # -> it's there so leave it alone is(minify(input => 'var x = 2;'), 'var x=2;', 'string literal input and ouput'); is(minify(input => "var x = 2;\n;;;alert('hi');\nvar x = 2;", stripDebug => 1), 'var x=2;var x=2;', 'scriptDebug option'); is(minify(input => 'var x = 2;', copyright => "BSD"), '/* BSD */var x=2;', 'copyright option'); portability.t100644001750001750 13015225127471 21772 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/authoruse strict; use warnings; use Test::More; use Test::Portability::Files; run_tests(); s5-expected.js100644001750001750 7715225127471 21716 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=foo /2 / 2 /a/a;/regexp/ /regexp/;a+ ++a;a- --a;a a;a3 .as4-expected.js100644001750001750 20315225127471 21724 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1/*@a*/ /2/*@a*/ / /*@a*/ 2 /a/a;/*@a*/ 2/*@a*//2;/regexp/ /*@a*/ /regexp/;/*@a*/ a+/*@a*/++a;a-/*@a*/--a;a/*@a*/a;a3/*@a*/.as7-expected.js100644001750001750 6315225127471 21713 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1;//@ a //@ a //@ a /*@*//*@*/ /*@*/ var x=1;s8-expected.js100644001750001750 1115225127471 21705 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts- --+ ++-s6-expected.js100644001750001750 10115225127471 21723 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1 /2 / 2 /a/a;2/2;/regexp/ /regexp/;a+ ++a;a- --a;a a;a3 .as9-expected.js100644001750001750 3115225127471 21710 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsasdf asdf 12 .toString();s3-expected.js100644001750001750 16715225127471 21734 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=1//@a /2//@a / //@a 2 /a/a;//@a /regexp/ //@a /regexp/;//@a a+//@a ++a;//@a a-//@a --a;a//@a a;a3//@a .as2-expected.js100644001750001750 4015225127471 21701 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction(){var x=21 var y=33 []}test-version.t100644001750001750 63715225127471 22106 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/authoruse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; unused-vars.t100644001750001750 14215225127471 22025 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/releaseuse Test::More 0.96 tests => 1; use Test::Vars; subtest 'unused vars' => sub { all_vars_ok(); }; s15-expected.js100644001750001750 3315225127471 21767 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction(s){alert("Foo");} s12-expected.js100644001750001750 1615225127471 21765 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts!^&*({[=|:<>?~s16-expected.js100644001750001750 3215225127471 21767 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfunction(s){alert("Foo");}s14-expected.js100644001750001750 1115225127471 21762 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsfoo[5]/14s11-expected.js100644001750001750 6015225127471 21763 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts" a \" a \n \\\\" ' a \' a \n \\\\' /a \. a\\\\/s13-expected.js100644001750001750 1015225127471 21760 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scriptsvar x=2;s10-expected.js100644001750001750 3615225127471 21765 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/t/scripts}}]})}/*@cc_on asdf */))]}]]])pod-linkcheck.t100644001750001750 53715225127471 22156 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/author#!perl use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_LINKCHECK ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::LinkCheck"; if ( $@ ) { plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; } else { Test::Pod::LinkCheck->new->all_pod_ok; } cpan-changes.t100644001750001750 34415225127471 22104 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/releaseuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.013 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; JavaScript000755001750001750 015225127471 20010 5ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/libMinifier.pm100644001750001750 3532515225127471 22300 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/lib/JavaScriptpackage JavaScript::Minifier; use strict; use warnings; our $VERSION = '1.17'; # VERSION require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(minify); # string 'return' as array to handle special case of returning a regexp from a function my @return = qw(r e t u r n); #return true if the character is allowed in identifier. sub isAlphanum { return ($_[0] =~ /[\w\$\\]/ || ord($_[0]) > 126); } sub isEndspace { return ($_[0] eq "\n" || $_[0] eq "\r" || $_[0] eq "\f"); } sub isWhitespace { return ($_[0] eq ' ' || $_[0] eq "\t" || $_[0] eq "\n" || $_[0] eq "\r" || $_[0] eq "\f"); } # New line characters before or after these characters can be removed. # Not + - / in this list because they require special care. sub isInfix { $_[0] =~ /[,;:=&%*<>\?\|\n]/; } # New line characters after these characters can be removed. sub isPrefix { return ($_[0] =~ /[\{\(\[!]/ || isInfix($_[0])); } # New line characters before these characters can removed. sub isPostfix { return ($_[0] =~ /[\}\)\]]/ || isInfix($_[0])); } # ----------------------------------------------------------------------------- sub _get { my $s = shift; if ($s->{inputType} eq 'file') { my $char = getc($s->{input}); $s->{last_read_char} = $char if defined $char; return $char; } elsif ($s->{inputType} eq 'string') { if ($s->{'inputPos'} < length($s->{input})) { return $s->{last_read_char} = substr($s->{input}, $s->{inputPos}++, 1); } else { # Simulate getc() when off the end of the input string. return undef; } } else { die "no input"; } } sub _put { my $s = shift; my $x = shift; my $outfile = ($s->{outfile}); if (defined($s->{outfile})) { print $outfile $x; } else { $s->{output} .= $x; } } # ----------------------------------------------------------------------------- # print a # move b to a # move c to b # move d to c # new d # # i.e. print a and advance sub action1 { my $s = shift; if (!isWhitespace($s->{a})) { $s->{lastnws} = $s->{a}; } $s->{last} = $s->{a}; action2($s); } # sneeky output $s->{a} for comments sub action2 { my $s = shift; _put($s, $s->{a}); action3($s); } # move b to a # move c to b # move d to c # new d # # i.e. delete a sub action3 { my $s = shift; $s->{a} = $s->{b}; action4($s); } # move c to b # move d to c # new d # # i.e. delete b sub action4 { my $s = shift; $s->{b} = $s->{c}; $s->{c} = $s->{d}; $s->{d} = _get($s); } # ----------------------------------------------------------------------------- # put string and regexp literals # when this sub is called, $s->{a} is on the opening delimiter character sub putLiteral { my $s = shift; my $delimiter = $s->{a}; # ', " or / action1($s); do { while (defined($s->{a}) && $s->{a} eq '\\') { # escape character only escapes only the next one character action1($s); action1($s); } if ($s->{regexp_flag} && $s->{a} eq '[') { # note character class inside regexp, in character class inside regexp there could be unescaped delimiter $s->{charclass_flag} = 1; } elsif ($s->{regexp_flag} && $s->{a} eq ']') { $s->{charclass_flag} = 0; } action1($s); } until ($s->{last} eq $delimiter && !($s->{regexp_flag} && $s->{charclass_flag}) || !defined($s->{a})); if ($s->{last} ne $delimiter) { # ran off end of file before printing the closing delimiter die 'unterminated ' . ($delimiter eq '\'' ? 'single quoted string' : $delimiter eq '"' ? 'double quoted string' : 'regular expression') . ' literal, stopped'; } } # ----------------------------------------------------------------------------- # If $s->{a} is a whitespace then collapse all following whitespace. # If any of the whitespace is a new line then ensure $s->{a} is a new line # when this function ends. sub collapseWhitespace { my $s = shift; while (defined($s->{a}) && isWhitespace($s->{a}) && defined($s->{b}) && isWhitespace($s->{b})) { if (isEndspace($s->{a}) || isEndspace($s->{b})) { $s->{a} = "\n"; } action4($s); # delete b } } # Advance $s->{a} to non-whitespace or end of file. # Doesn't print any of this whitespace. sub skipWhitespace { my $s = shift; while (defined($s->{a}) && isWhitespace($s->{a})) { action3($s); } } # Advance $s->{a} to non-whitespace or end of file # If any of the whitespace is a new line then print one new line. sub preserveEndspace { my $s = shift; collapseWhitespace($s); if (defined($s->{a}) && isEndspace($s->{a}) && defined($s->{b}) && !isPostfix($s->{b}) ) { action1($s); } skipWhitespace($s); } sub onWhitespaceConditionalComment { my $s = shift; return (defined($s->{a}) && isWhitespace($s->{a}) && defined($s->{b}) && $s->{b} eq '/' && defined($s->{c}) && ($s->{c} eq '/' || $s->{c} eq '*') && defined($s->{d}) && $s->{d} eq '@'); } # ----------------------------------------------------------------------------- sub minify { my %h = @_; # Immediately turn hash into a hash reference so that notation is the same in this function # as others. Easier refactoring. my $s = \%h; # hash reference for "state". This module is functional programming and the state is passed between functions. # determine if the the input is a string or a file handle. my $ref = \$s->{input}; if (defined($ref) && ref($ref) eq 'SCALAR'){ $s->{inputPos} = 0; $s->{inputType} = 'string'; } else { $s->{inputType} = 'file'; } # Determine if the output is to a string or a file. if (!defined($s->{outfile})) { $s->{output} = ''; } # Print the copyright notice first if ($s->{copyright}) { _put($s, '/* ' . $s->{copyright} . ' */'); } # Initialize the buffer. do { $s->{a} = _get($s); } while (defined($s->{a}) && isWhitespace($s->{a})); $s->{b} = _get($s); $s->{c} = _get($s); $s->{d} = _get($s); $s->{regexp_flag} = 0; $s->{charclass_flag} = 0; $s->{return_flag} = 0; $s->{return_string} = ''; $s->{last} = undef; # assign for safety $s->{lastnws} = undef; # assign for safety # local variables my $ccFlag; # marks if a comment is an Internet Explorer conditional comment and should be printed to output while (defined($s->{a})) { # on this line $s->{a} should always be a non-whitespace character or undef (i.e. end of file) if (isWhitespace($s->{a})) { # check that this program is running correctly die 'minifier bug: minify while loop starting with whitespace, stopped'; } # track 'return' operator if ($s->{a} ne '/') { $s->{return_flag} = defined($return[length($s->{return_string})]) && $s->{a} eq $return[length($s->{return_string})]; $s->{return_string} = $s->{return_flag} ? $s->{return_string} . $s->{a} : ''; } # Each branch handles trailing whitespace and ensures $s->{a} is on non-whitespace or undef when branch finishes if ($s->{a} eq '/') { # a division, comment, or regexp literal if (defined($s->{b}) && $s->{b} eq '/') { # slash-slash comment $ccFlag = defined($s->{c}) && $s->{c} eq '@'; # tests in IE7 show no space allowed between slashes and at symbol do { $ccFlag ? action2($s) : action3($s); } until (!defined($s->{a}) || isEndspace($s->{a})); if (defined($s->{a})) { # $s->{a} is a new line if ($ccFlag) { action1($s); # cannot use preserveEndspace($s) here because it might not print the new line skipWhitespace($s); } elsif (defined($s->{last}) && !isEndspace($s->{last}) && !isPrefix($s->{last})) { preserveEndspace($s); } else { skipWhitespace($s); } } } elsif (defined($s->{b}) && $s->{b} eq '*') { # slash-star comment $ccFlag = defined($s->{c}) && $s->{c} eq '@'; # test in IE7 shows no space allowed between star and at symbol do { $ccFlag ? action2($s) : action3($s); } until (!defined($s->{b}) || ($s->{a} eq '*' && $s->{b} eq '/')); if (defined($s->{b})) { # $s->{a} is asterisk and $s->{b} is foreslash if ($ccFlag) { action2($s); # the * action2($s); # the / # inside the conditional comment there may be a missing terminal semi-colon preserveEndspace($s); } else { # the comment is being removed action3($s); # the * $s->{a} = ' '; # the / collapseWhitespace($s); if (defined($s->{last}) && defined($s->{b}) && ((isAlphanum($s->{last}) && (isAlphanum($s->{b})||$s->{b} eq '.')) || ($s->{last} eq '+' && $s->{b} eq '+') || ($s->{last} eq '-' && $s->{b} eq '-'))) { # for a situation like 5-/**/-2 or a/**/a # When entering this block $s->{a} is whitespace. # The comment represented whitespace that cannot be removed. Therefore replace the now gone comment with a whitespace. action1($s); } elsif (defined($s->{last}) && !isPrefix($s->{last})) { preserveEndspace($s); } else { skipWhitespace($s); } } } else { die 'unterminated comment, stopped'; } } elsif ((defined($s->{lastnws}) && ($s->{lastnws} eq ')' || $s->{lastnws} eq ']' || $s->{lastnws} eq '.' || isAlphanum($s->{lastnws}))) && (!$s->{return_flag} || length($s->{return_string}) != scalar(@return))) { # division action1($s); collapseWhitespace($s); # don't want a division to become a slash-slash comment with following conditional comment onWhitespaceConditionalComment($s) ? action1($s) : preserveEndspace($s); } else { # regexp literal $s->{regexp_flag} = 1; putLiteral($s); collapseWhitespace($s); # don't want closing delimiter to become a slash-slash comment with following conditional comment onWhitespaceConditionalComment($s) ? action1($s) : preserveEndspace($s); } } elsif ($s->{a} eq '\'' || $s->{a} eq '"' ) { # string literal $s->{regexp_flag} = 0; putLiteral($s); preserveEndspace($s); } elsif ($s->{a} eq '+' || $s->{a} eq '-') { # careful with + + and - - action1($s); collapseWhitespace($s); if (defined($s->{a}) && isWhitespace($s->{a})) { (defined($s->{b}) && $s->{b} eq $s->{last}) ? action1($s) : preserveEndspace($s); } } elsif (isAlphanum($s->{a})) { # keyword, identifiers, numbers action1($s); collapseWhitespace($s); if (defined($s->{a}) && isWhitespace($s->{a})) { # if $s->{b} is '.' could be (12 .toString()) which is property invocation. If space removed becomes decimal point and error. (defined($s->{b}) && (isAlphanum($s->{b}) || $s->{b} eq '.')) ? action1($s) : preserveEndspace($s); } } elsif ($s->{a} eq ']' || $s->{a} eq '}' || $s->{a} eq ')') { # no need to be followed by space but maybe needs following new line action1($s); preserveEndspace($s); } elsif ($s->{stripDebug} && $s->{a} eq ';' && defined($s->{b}) && $s->{b} eq ';' && defined($s->{c}) && $s->{c} eq ';') { action3($s); # delete one of the semi-colons $s->{a} = '/'; # replace the other two semi-colons $s->{b} = '/'; # so the remainder of line is removed } else { # anything else just prints and trailing whitespace discarded action1($s); skipWhitespace($s); } } if ( defined $s->{last_read_char} and $s->{last_read_char} =~ /\n/ ) { _put($s, "\n"); } if (!defined($s->{outfile})) { return $s->{output}; } } # minify() 1; __END__ =encoding utf8 =for stopwords Crockford ECMAScript JSMin stripDebug Minifying minification minifying minified minify =head1 NAME JavaScript::Minifier - Perl extension for minifying JavaScript code =head1 SYNOPSIS To minify a JavaScript file and have the output written directly to another file use JavaScript::Minifier qw(minify); open(my $in, 'myScript.js') or die; open(my $out, '>', 'myScript-min.js') or die; minify(input => $in, outfile => $out); close($in); close($out); To minify a JavaScript string literal. Note that by omitting the outfile parameter a the minified code is returned as a string. my $minifiedJavaScript = minify(input => 'var x = 2;'); To include a copyright comment at the top of the minified code. minify(input => 'var x = 2;', copyright => 'BSD License'); To treat ';;;' as '//' so that debugging code can be removed. This is a common JavaScript convention for minification. minify(input => 'var x = 2;', stripDebug => 1); The "input" parameter is mandatory. The "output", "copyright", and "stripDebug" parameters are optional and can be used in any combination. =head1 DESCRIPTION This module removes unnecessary whitespace from JavaScript code. The primary requirement developing this module is to not break working code: if working JavaScript is in input then working JavaScript is output. It is ok if the input has missing semi-colons, snips like '++ +' or '12 .toString()', for example. Internet Explorer conditional comments are copied to the output but the code inside these comments will not be minified. The ECMAScript specifications allow for many different whitespace characters: space, horizontal tab, vertical tab, new line, carriage return, form feed, and paragraph separator. This module understands all of these as whitespace except for vertical tab and paragraph separator. These two types of whitespace are not minimized. For static JavaScript files, it is recommended that you minify during the build stage of web deployment. If you minify on-the-fly then it might be a good idea to cache the minified file. Minifying static files on-the-fly repeatedly is wasteful. =head2 EXPORT Exported by default: C =head1 SEE ALSO This module is inspired by Douglas Crockford's JSMin: L You may also be interested in the L module also available on CPAN. =head1 REPOSITORY You can obtain the latest source code and submit bug reports on the github repository for this module: L =head1 MAINTAINER Zoffix Znet C<< >> L =head1 AUTHORS Peter Michaux, Epetermichaux@gmail.comE Eric Herrera, Eherrera@10east.comE =head1 CONTRIBUTORS Miller 'tmhall' Hall Вячеслав 'vti' Тихановский Fedor A. 'faf' Fetisov =head1 COPYRIGHT AND LICENSE Copyright (C) 2007 by Peter Michaux This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available. dist-manifest.t100644001750001750 12215225127471 22316 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/releaseuse strict; use warnings; use Test::More; use Test::DistManifest; manifest_ok(); minimum-version.t100644001750001750 15515225127471 22575 0ustar00zoffixzoffix000000000000JavaScript-Minifier-1.17/xt/authoruse strict; use warnings; use Test::More; use Test::MinimumVersion; all_minimum_version_ok( qq{5.008008} );