aboutsummaryrefslogtreecommitdiff
path: root/tools/source-maps/sourcemap2json.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/source-maps/sourcemap2json.js')
-rw-r--r--tools/source-maps/sourcemap2json.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/source-maps/sourcemap2json.js b/tools/source-maps/sourcemap2json.js
new file mode 100644
index 00000000..5dd162b2
--- /dev/null
+++ b/tools/source-maps/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));