[From nobody Wed Aug 26 21:51:11 2026
Received: (at submit) by bugs.debian.org; 19 Aug 2026 16:13:39 +0000
X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
 (2024-03-25) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-112.4 required=4.0 tests=ALL_TRUSTED,BAYES_00,
 DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,
 FOURLA,FROMDEVELOPER,PGPSIGNATURE,SPF_HELO_NONE,SPF_PASS,
 USER_IN_DKIM_WELCOMELIST autolearn=ham autolearn_force=no
 version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 50; hammy, 150; neutral, 41; spammy,
 0. spammytokens:
 hammytokens:0.000-+--Hx-spam-relays-external:sk:stravin,
 0.000-+--H*RT:sk:stravin, 0.000-+--Hx-spam-relays-external:311,
 0.000-+--H*RT:311, 0.000-+--H*RT:108
Return-path: &lt;ncts@debian.org&gt;
Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]:50644)
 by buxtehude.debian.org with esmtps
 (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
 (Exim 4.96) (envelope-from &lt;ncts@debian.org&gt;) id 1wwiv5-002W1C-0i
 for submit@bugs.debian.org; Wed, 19 Aug 2026 16:13:39 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; 
 s=smtpauto.stravinsky;
 h=X-Debian-User:To:From:Subject:Message-Id:Date:
 Content-Type:Mime-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:
 Content-Description:In-Reply-To:References;
 bh=B22WciRMinZLrGSOg35n8CmVL1d8PdQETW6HTqUBDCk=; b=bxfTHsIDBmdk5HDPe1mxgp+yVh
 bj8AtATJmdPadgblVJu7Vjv41uA+WEnbfeD07pXRhKuyAsEpTdOCJlT2OslMUr7IspnrDTZNX/YDS
 C5vjft6vL96MCY2RHXhX4yoxR+gRLQug71lE8/b9RPaXTfBdaNiv8M38LJ/jwaWl6lly9s9AbGu1N
 wvMI9SS7G6IP6YFw4uypS+xkv0qKTti9BO976XKMgh3EVQn766Mphbe1fuhGJfMNFRfb1LJjhTM7/
 YtM+F/Pb6LAJIi4rXzJUyXqLYF1Qwl8Cu8zrcnObtxqY+ZQiQEOfUBEIaDIN0fcGgEBmvX8Uhwbrq
 ygDne8nw==;
Received: from authenticated-user by stravinsky.debian.org with esmtpsa
 (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128)
 (Exim 4.96) (envelope-from &lt;ncts@debian.org&gt;) id 1wwiv3-009uYU-1f
 for submit@bugs.debian.org; Wed, 19 Aug 2026 16:13:37 +0000
Mime-Version: 1.0
Content-Type: multipart/signed;
 boundary=11913d2cf68fd26dbb0cb694b0fcaee3a7de4b1418ac05076044dda9beaa;
 micalg=pgp-sha512; protocol=&quot;application/pgp-signature&quot;
Date: Wed, 19 Aug 2026 16:13:31 +0000
Message-Id: &lt;DKT1XLR7D0A0.1KDDOCDFZVGDP@debian.org&gt;
Subject: highlight.js: Rollup change breaks hljs.registerLanguage calls
From: &quot;Blair Noctis&quot; &lt;ncts@debian.org&gt;
To: &lt;submit@bugs.debian.org&gt;
X-Mailer: aerc 0.22.0
X-Debian-User: ncts
Delivered-To: submit@bugs.debian.org

--11913d2cf68fd26dbb0cb694b0fcaee3a7de4b1418ac05076044dda9beaa
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

Source: highlight.js
Version: 10.7.3+dfsg-1
Severity: grave
Justification: renders package unusable
Tags: patch
X-Debbugs-Cc: debian-js@lists.debian.org, ncts@debian.org

Dear Maintainer,

Due to a breaking change in behavior from Rollup 2 to 3, IIFE regex replace=
ment
for `hljs.registerLanguage` calls breaks.

Rollup 2, which this version of hljs targeted, generates this:

var dummyName =3D (function () { /* ... */ }());

which is replaced by hljs to:

hljs.registerLanguage('${language.name}', function () { /* ... */ }());

while Rollup 3 generates this:

var dummyName =3D (function () { /* ... */ })();

which is replaced by hljs to:

hljs.registerLanguage('${language.name}', function () { /* ... */ })();

You can see that while the previous replacement calls the function *inside*=
,
current replacement calls the &quot;result&quot; of the `hljs.registerLanguage` call.

The following patch fixes it by calling `hljs.registerLanguage` in a separa=
te
statement.

Note, it's intended to be in the debian/patches series, not a debdiff.

--- a/tools/lib/language.js
+++ b/tools/lib/language.js
@@ -86,14 +86,14 @@

 async function compileLanguage (language, options) {
   const EXPORT_REGEX =3D /export default (.*);/;
-  const IIFE_HEADER_REGEX =3D /^(var dummyName =3D )?\(function \(\)/;
+  //const IIFE_HEADER_REGEX =3D /^(var dummyName =3D )?\(function \(\)/;
=20
   // TODO: cant we use the source we already have?
   const input =3D { ...build_config.rollup.browser.input, input: language.=
path };
   const output =3D { ...build_config.rollup.browser.output,  name: `dummyN=
ame`, file: &quot;out.js&quot; };
   var data =3D await rollupCode(input, output)
=20
-  data =3D data.replace(IIFE_HEADER_REGEX, `hljs.registerLanguage('${langu=
age.name}', function ()`)
+  data =3D `(function() {\n${data}\nhljs.registerLanguage('${language.name=
}', dummyName);\n})();` //data =3D data.replace(IIFE_HEADER_REGEX, `hljs.re=
gisterLanguage('${language.name}', function ()`)
=20
   var original =3D data;
   language.module =3D data;

--=20
    ,Sdrager
Blair Noctis

=F0=9F=87=B5=F0=9F=87=B8

--11913d2cf68fd26dbb0cb694b0fcaee3a7de4b1418ac05076044dda9beaa
Content-Type: application/pgp-signature; name=&quot;signature.asc&quot;

-----BEGIN PGP SIGNATURE-----

iIYEABYKAC4WIQSkiHwhuQf2oVaWacxWG2M00EUuRAUCaoXWLBAcbmN0c0BkZWJp
YW4ub3JnAAoJEFYbYzTQRS5E7moA/0HTHdkDttTSNKg/SJlXPWAZE+QtwdhI71qL
/TiJ4F+nAPwN+T0LcrCEc1or3XJLBTsBud9wZThVti1q5V+hZEduAA==
=Pmvl
-----END PGP SIGNATURE-----

--11913d2cf68fd26dbb0cb694b0fcaee3a7de4b1418ac05076044dda9beaa--
]