Source: node-browserify-lite
Version: 0.5.0-8
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: toolchain randomness
X-Debbugs-Cc: [email protected]
Hi,
Whilst working on the Reproducible Builds effort [0] we noticed that
node-browserify-lite generates non-deterministic output.
I tracked this down to JSON.stringify not ordering its result by
default, resulting in output varying like the below (after pretty-
printing):
- "./foo": 2,
- "./bar": 1,
+ "./bar": 1,
+ "./foo": 2,
This was affecting many packages, including libjs-webrtc-adapter and
likely many more.
A patch (by myself) is attached. It is upstream blessed but a new
upstream release is also promised shortly if you want to wait for that
too.
[0] https://reproducible-builds.org/
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/index.js b/index.js
index 8a01db3..5f6cd0b 100644
--- a/index.js
+++ b/index.js
@@ -111,12 +111,13 @@ function renderBundle(options, cb) {
"})({";
modules.forEach(function(canonicalSourcePath) {
+ var thisDepMap = depMap[canonicalSourcePath];
out += aliases[canonicalSourcePath] + ":
[function(require,module,exports,global){\n";
if (canonicalSourcePath.match(/\.json$/)) {
out += "module.exports = ";
}
out += sources[canonicalSourcePath];
- out += "\n}, " + JSON.stringify(depMap[canonicalSourcePath]) + "],";
+ out += "\n}, " + JSON.stringify(thisDepMap,
Object.keys(thisDepMap).sort()) + "],";
});
out += "}, {}, " + aliases[entrySourcePath] + ");\n";
--
Pkg-javascript-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel