reassign 1064824 node-d3 5.16.0+~cs5.28.10-1 severity 1064824 serious retitle 1064824 node-d3: fails to export map and probably other functions thanks
(I'm raising this to severity "serious" because it breaks a different package.) (For background to the discovery of this bug, see below.) The Debian version of d3.js does not export "map", which it should. This breaks the libjs-d3-tip package. In fact, the export lists are significantly different: $ grep '^exports' d3-npm/dist/d3.js | sort > /tmp/d3-npm.exports $ grep ^exports /usr/share/nodejs/d3/dist/d3.js | sort > /tmp/d3-debian.exports $ diff -u /tmp/d3-npm.exports /tmp/d3-debian.exports [520 lines, lots of differences are due to "$1" type suffixes/ $ sed -e 's/\$[0-9]*;/;/' /tmp/d3-npm.exports > /tmp/d3-npm.exports.trimmed $ sed -e 's/\$[0-9]*;/;/' /tmp/d3-debian.exports > /tmp/d3-debian.exports.trimmed $ diff -u /tmp/d3-npm.exports.trimmed /tmp/d3-debian.exports.trimmed This gives lots of differences still; stripping down to just the differences still has many, many differences: some new exports not in the original d3, and some lost exports; the list begins: +exports.Adder = Adder; -exports.bisect = bisectRight; +exports.bin = bin; +exports.bisect = bisect; +exports.bisectCenter = bisectCenter; +exports.blur2 = blur2; +exports.blur = blur; +exports.blurImage = blurImage; +exports.count = count; -exports.csvFormatRow = csvFormatRow; -exports.csvFormatValue = csvFormatValue; Now, one *might* guess that the reason for this is that d3 imports lots of d3-* modules, and these have been updated and changed since d3 v5.16.0 was released, so these changes are reflected in the new list of exports (though people assuming that the Debian version of d3 v5.16.0 reflects the upstream version will then be confused and possibly frustrated). But that doesn't explain the absence of map, which comes from (node-)d3-collection. For /usr/share/nodejs/d3-collection/dist/d3-collection.js reads: exports.entries = entries; exports.keys = keys; exports.map = map; exports.nest = nest; exports.set = set; exports.values = values; So I cannot fathom why map is not being exported by d3 itself. There may be other cases of this behaviour, but I have not investigated further. I am quite stumped by this. Background to this: I'm trying to package a new package which provides a web server to visualise some data. The package includes a few precompiled JavaScript libraries obtained from npmjs.com, and the server works fine with them. But following Debian policy, I need to replace those with the source packages. And the server then doesn't work. The JavaScript libraries which the package uses are: d3 v5.16.0, d3-tip, apparently v0.9.1, along with jQuery and bootstrap4. I have replaced all of these with the versions in the corresponding Debian packages (and I've just uploaded a new version of d3-tip, thinking that that was the cause of the bug). When visiting the served web page, the console log gives the error message: Uncaught (in promise) TypeError: t.map is not a function n http://localhost:8080/js/d3/d3-tip.min.js:1 main http://localhost:8080/js/index.js:848 async* http://localhost:8080/js/index.js:993 (This has changed from the original bug report as the minimised new version of d3-tip has t.map instead of h.map.) d3-tip.js requires d3-collection, from which it calls a map function. I tried replacing d3-tip.min.js with the pre-packaged version rather than the (newly built) Debian version, but that did not help. I reverted that change and instead replaced d3.v5.min.js (which is a copy of /usr/share/nodejs/d3/dist/d3.min.js) with the version provided by upstream, which is a verbatim copy of the npmjs.com d3.min.js, and the server then worked perfectly. So this told me that it is the Debian compiled d3 which is not working correctly. Best wishes, Julian