aboutsummaryrefslogtreecommitdiff
path: root/tools/sourcemap2json.js
diff options
context:
space:
mode:
authorJez Ng <me@jezng.com>2013-06-07 15:37:47 -0700
committerJez Ng <me@jezng.com>2013-06-19 01:22:01 -0700
commit2f16717540cbeaa8e2e6b653bc31849111ccd9f2 (patch)
treea67c388de9926a2f290cbef3228e0e0ab6f4943d /tools/sourcemap2json.js
parent165befaa29b7226b28caecd2f30bae91dc20f26f (diff)
Add test for source maps.
Tweak behavior of post_build; the `post2` hook now expects a function.
Diffstat (limited to 'tools/sourcemap2json.js')
-rw-r--r--tools/sourcemap2json.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/sourcemap2json.js b/tools/sourcemap2json.js
new file mode 100644
index 00000000..5dd162b2
--- /dev/null
+++ b/tools/sourcemap2json.js
@@ -0,0 +1,15 @@
+/*
+ * Quick utility script for the Python test script to call. Could be replaced if
+ * a good Python source map library is found.
+ */
+var SourceMapConsumer = require('source-map').SourceMapConsumer;
+var fs = require('fs');
+
+var consumer = new SourceMapConsumer(fs.readFileSync(process.argv[2], 'utf-8'));
+var mappings = [];
+
+consumer.eachMapping(function(mapping) {
+ mappings.push(mapping);
+});
+
+console.log(JSON.stringify(mappings));