Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Revision history for Perl extension JavaScript::Minifier::XS.
- Fixes CVE-2026-56017, which caused Perl to SEGFAULT when calling
minify(). Thanks to CPANSec for raising the issue, and providing a
prototype fix.
- Updated author tests for "does the JS still compile?", to use "node"
instead of "jsl".

0.15 2021-10-15 20:21:23-07:00 America/Vancouver
- GH#8 - preserve newlines when collapsing whitespace; if a block of
Expand Down
2 changes: 1 addition & 1 deletion XS.xs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ Node* JsTokenizeString(JsDoc* doc, const char* string) {
/* some debugging info */
#ifdef DEBUG
{
int idx;
size_t idx;
printf("----------------------------------------------------------------\n");
printf("%s: [%s]\n", strNodeTypes[node->type], node->contents);
printf("next: [");
Expand Down
2 changes: 1 addition & 1 deletion xt/author/leaks.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BEGIN {
use Test::LeakTrace;

###############################################################################
## What CSS docs do we want to try compressing?
# What JS docs do we want to try compressing?
my $curl = which('curl');
my @libs = (
'http://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.js',
Expand Down
21 changes: 9 additions & 12 deletions xt/author/test-compile.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ use File::Which qw(which);
use JavaScript::Minifier::XS qw(minify);

###############################################################################
# Make sure we've got "curl" and "jsl" installed.
# Make sure we've got "curl" and "node" installed.
my $curl = which('curl');
my $jsl = which('jsl');
unless ($curl && $jsl) {
plan skip_all => "Test requires 'curl' and 'jsl'";
my $node = which('node');
unless ($curl && $node) {
plan skip_all => "Test requires 'curl' and 'node'";
}

###############################################################################
Expand Down Expand Up @@ -65,16 +65,13 @@ sub js_compile {
my $js = shift;
my ($out, $err);

run [$jsl, '-stdin'], \$js, \$out, \$err;
run [$node, '--check', '-'], \$js, \$out, \$err;

my $res = (split /^/, $out)[-1];
$res =~ s{(\d+\s+error.*?),.*}{$1};

unless ($res =~ /\d+\s+error/) {
fail "Unexpected output from jsl";
diag $res;
if ($err) {
fail "Unexpected output from Node";
diag $err;
}

return $res;
return $err;
}

Loading