Skip to content

Commit

Permalink
Merge pull request #2684 from RotherOSS/issue-#1197-javascript_minifi…
Browse files Browse the repository at this point in the history
…er_xs

Issue #1197 javascript minifier xs
  • Loading branch information
bschmalhofer authored Nov 16, 2023
2 parents 7f260f0 + 91778bd commit 2c9fd03
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 490 deletions.
6 changes: 0 additions & 6 deletions COPYING-Third-Party
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ o Name: CPAN CSS::Minifier
License: GNU v2 - http://www.gnu.org/licenses/gpl.html
Note: Copyright (C) 2007 by Peter Michaux

o Name: CPAN JavaScript::Minifier
Web: https://github.com/zoffixznet/JavaScript-Minifier
License: # This library is free software; you can redistribute it
# and/or modify it under the same terms as Perl itself.
Note: Copyright (C) 2021 by Peter Michaux

o Name: CPAN YAML
Web: n/a
License: GNU v2 - http://www.gnu.org/licenses/gpl.html
Expand Down
6 changes: 0 additions & 6 deletions Kernel/System/Environment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,6 @@ sub BundleModulesDeclarationGet {
'Required' => 1,
'VersionExact' => '1.08',
},
{
'Comment' => 'needed by the loader',
'VersionExact' => '1.16',
'Required' => 1,
'Module' => 'JavaScript::Minifier'
},
{
'Comment' => 'needed by Sisimai',
'Module' => 'JSON',
Expand Down
8 changes: 4 additions & 4 deletions Kernel/System/Loader.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use utf8;

# CPAN modules
use CSS::Minifier qw();
use JavaScript::Minifier qw();
use JavaScript::Minifier::XS qw();

# OTOBO modules

Expand Down Expand Up @@ -362,7 +362,7 @@ sub GetMinifiedFile {
my $FileContents = $MainObject->FileRead(
Location => $Location,

# It would be more correct to use UTF8 mode, but then the JavaScript::Minifier
# It would be more correct to use UTF8 mode, but then the JavaScript::Minifier::XS
# will cause timeouts due to extreme slowness on some UT servers. Disable for now.
# Unicode in the files still works correctly.
#Mode => 'utf8',
Expand Down Expand Up @@ -434,7 +434,7 @@ returns a minified version of the given JavaScript Code.
Warning: this function may cause a die() if there are errors in the file,
protect against that with eval().
This function internally uses the CPAN module JavaScript::Minifier.
This function internally uses the CPAN module JavaScript::Minifier::XS.
As of version 1.05 of that module, there is an issue with regular expressions:
This will cause a die:
Expand All @@ -459,7 +459,7 @@ sub MinifyJavaScript {
return;
}

return JavaScript::Minifier::minify( input => $Param{Code} );
return JavaScript::Minifier::XS::minify( $Param{Code} );
}

=head2 CacheGenerate()
Expand Down
Loading

0 comments on commit 2c9fd03

Please sign in to comment.