aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2015-03-18 11:53:17 +0200
committerMihai Bazon <mihai.bazon@gmail.com>2015-03-18 11:53:17 +0200
commit3ef092332b1e7c9bf1d17038601a33bd742dd753 (patch)
tree642eaa5395124cbb7f27955936455c943db341e4 /tools
parent540c19792f813e38a815ff1bd2228ac0eca9e502 (diff)
downloadtracifyjs-3ef092332b1e7c9bf1d17038601a33bd742dd753.tar.gz
tracifyjs-3ef092332b1e7c9bf1d17038601a33bd742dd753.zip
Support multiple --reserved-file args
Diffstat (limited to 'tools')
-rw-r--r--tools/node.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/node.js b/tools/node.js
index a8e734d9..048630de 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -194,6 +194,25 @@ exports.describe_ast = function() {
return out + "";
};
+exports.readReservedFile = function(filename, reserved) {
+ if (!reserved) {
+ reserved = { vars: [], props: [] };
+ }
+ var data = fs.readFileSync(filename, "utf8");
+ data = JSON.parse(data);
+ if (data.vars) {
+ data.vars.forEach(function(name){
+ UglifyJS.push_uniq(reserved.vars, name);
+ });
+ }
+ if (data.props) {
+ data.props.forEach(function(name){
+ UglifyJS.push_uniq(reserved.props, name);
+ });
+ }
+ return reserved;
+};
+
exports.readNameCache = function(filename, key) {
var cache = null;
if (filename) {