Le 02/09/2026 à 01:06, Thorsten Glaser a écrit :
On Mon, 31 Aug 2026, Thorsten Glaser wrote:

On Mon, 31 Aug 2026, Santiago Vila wrote:

During a rebuild of all packages in unstable, this package failed to build.

Might be to just add node-babel-plugin-add-module-exports to B-D…

Turns out to be a bit more.

For one:

| Error: [BABEL]
| /tmp/buildd/dygraphs-2.2.2/disttmp/auto_tests/data/data.js:
| @babel/preset-env: The 'bugfixes' option has been removed, and now
| bugfix plugins are always enabled. Please remove it from your config.
| (While processing: "/usr/share/nodejs/@babel/preset-env/lib/index.js")

That is easy enough to work around (check babeljs version, use one
config for ≤7 and another for ≥8) but then I get this from browserify:

| SyntaxError: 'import' and 'export' may appear only with 'sourceType:
| module' (57:0) while parsing
| /tmp/buildd/dygraphs-2.2.2/disttmp/src/dygraph.js while parsing file:
| /tmp/buildd/dygraphs-2.2.2/disttmp/src/dygraph.js

But in contrast to the last successful build in sid, the browserify
version has not changed, so node-babel7 8.x has broken more things.

Does anyone from its maintainers team know what?

Mid-term, the fix will be to convert the JS once, clean it up manually
to avoid the extra corner cases handled by the babelified code (the code
pretty much is pre-ES6 already with a few exceptions, const, let, and
import), but that needs more time and more JS knowledge than I have.

Frustrated (the last babeljs update also broke things),
//mirabilos

Hi,

Following https://wiki.debian.org/Javascript/KnownPatches here is a proposed debdiff

Best regards,
Xavier
diff --git a/debian/changelog b/debian/changelog
index 01f23bb..cb3a527 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+dygraphs (2.2.2-2) UNRELEASED; urgency=medium
+
+  * Add patch to fix FTBFS with Babel 8 (Closes: #1146315)
+  * Add missing build dependency on node-babel-plugin-add-module-exports
+
+ -- Xavier Guimard <[email protected]>  Wed, 02 Sep 2026 06:48:36 +0200
+
 dygraphs (2.2.2-1) unstable; urgency=medium
 
   * “Could we please keep Debian unensloppified, tyvm?” upload
diff --git a/debian/control b/debian/control
index bc99833..de1a55f 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,7 @@ Build-Depends: debhelper-compat (= 13),
  libjs-jquery,
  libjs-jquery-ui,
  mksh,
+ node-babel-plugin-add-module-exports,
  node-babel7,
  node-browser-pack,
  node-browserify,
diff --git a/debian/patches/babel8-compat.patch 
b/debian/patches/babel8-compat.patch
new file mode 100644
index 0000000..e4592f2
--- /dev/null
+++ b/debian/patches/babel8-compat.patch
@@ -0,0 +1,97 @@
+Description: make the Babel configuration work with Babel 7 and Babel 8
+ Babel 8 breaks the existing babel.config.json in two ways:
+ .
+  * the @babel/preset-env "bugfixes" option was removed (the bugfix
+    plugins are now always enabled), and passing it is a hard error;
+  * the default value of the caller's supportsStaticESM flag changed
+    from false to true, so modules="auto" now keeps the ESM syntax
+    instead of transpiling it to CommonJS, which makes browserify
+    (which consumes this output) fail with
+    "'import' and 'export' may appear only with 'sourceType: module'".
+ .
+ Replace the static JSON configuration with a JavaScript one that looks
+ at the Babel version, and ask for CommonJS explicitly: under Babel 7
+ this produces byte-identical output to the previous configuration.
+Author: Xavier Guimard <[email protected]>
+Bug-Debian: https://bugs.debian.org/1146315
+Forwarded: not-needed
+Last-Update: 2026-09-02
+
+--- /dev/null
++++ b/babel.config.cjs
+@@ -0,0 +1,32 @@
++// Babel configuration, shared between Babel 7 and Babel 8.
++//
++// Babel 8 removed the preset-env “bugfixes” option (the bugfix plugins
++// are unconditionally enabled now) and it changed the default of the
++// caller’s supportsStaticESM flag to true, which makes modules="auto"
++// keep ESM syntax instead of transpiling it; browserify, which consumes
++// the output of this configuration, needs CommonJS, so ask for it.
++module.exports = function (api) {
++      const babel8 = parseInt(api.version, 10) >= 8;
++
++      api.cache.using(function () { return babel8; });
++
++      const presetEnv = {
++              exclude: [
++                      "@babel/plugin-transform-typeof-symbol"
++              ],
++              modules: "commonjs"
++      };
++      if (!babel8) {
++              presetEnv.bugfixes = true;
++      }
++
++      return {
++              plugins: [
++                      "@babel/plugin-transform-strict-mode",
++                      "add-module-exports"
++              ],
++              presets: [
++                      ["@babel/env", presetEnv]
++              ]
++      };
++};
+--- a/babel.config.json
++++ /dev/null
+@@ -1,18 +0,0 @@
+-{
+-  "plugins": [
+-    "@babel/plugin-transform-strict-mode",
+-    "add-module-exports"
+-  ],
+-  "presets": [
+-    [
+-      "@babel/env",
+-      {
+-        "bugfixes": true,
+-        "exclude": [
+-          "@babel/plugin-transform-typeof-symbol"
+-        ],
+-        "modules": "auto"
+-      }
+-    ]
+-  ]
+-}
+--- a/scripts/build-js.sh
++++ b/scripts/build-js.sh
+@@ -19,7 +19,7 @@
+       # Debian packaging
+       babel_js=babeljs
+ fi
+-babelrc=$PWD/babel.config.json
++babelrc=$PWD/babel.config.cjs
+ set -x
+ 
+ # obtain dygraphs version…
+--- a/scripts/generate-coverage.sh
++++ b/scripts/generate-coverage.sh
+@@ -13,7 +13,7 @@
+ else
+       babel_js=babeljs
+ fi
+-babelrc=$PWD/babel.config.json
++babelrc=$PWD/babel.config.cjs
+ set -x
+ 
+ rm -rf disttmp
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..1d28f35
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+babel8-compat.patch
-- 
Pkg-javascript-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel

Reply via email to