From e77f9a4a27e9d650c252a24059860250cfc6cb7e Mon Sep 17 00:00:00 2001 From: Graham TerMarsch Date: Tue, 23 Jun 2026 20:09:06 -0700 Subject: [PATCH 1/3] Update author test for "does the JS still compile?" to use Node. `jsl` is (long) out of date, and so I'm swapping it out for using NodeJS and it's compile `--check`. Guess this shows how long it has been since I have done a release. :o --- Changes | 2 ++ xt/author/test-compile.t | 21 +++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index ac8f62d..92a83e4 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/xt/author/test-compile.t b/xt/author/test-compile.t index 629ab9e..34adc76 100644 --- a/xt/author/test-compile.t +++ b/xt/author/test-compile.t @@ -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'"; } ############################################################################### @@ -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; } From 19b1cd20830c51d4e0f0c865b0dd999e3c6621fc Mon Sep 17 00:00:00 2001 From: Graham TerMarsch Date: Thu, 25 Jun 2026 15:55:21 -0700 Subject: [PATCH 2/3] This should really be a `size_t`, as that's what we are comparing against. Only gets used when compiling with debugging enabled, which is why it hadn't crossed my path earlier. --- XS.xs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XS.xs b/XS.xs index 27e5a6a..9e207f4 100644 --- a/XS.xs +++ b/XS.xs @@ -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: ["); From af1b30ea61db7abd654bd06ae865832dd77b972f Mon Sep 17 00:00:00 2001 From: Graham TerMarsch Date: Fri, 26 Jun 2026 20:19:42 -0700 Subject: [PATCH 3/3] Typo correction, from bad copy/paste. --- xt/author/leaks.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xt/author/leaks.t b/xt/author/leaks.t index 7fcc6c8..9b1a784 100644 --- a/xt/author/leaks.t +++ b/xt/author/leaks.t @@ -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',