aboutsummaryrefslogtreecommitdiff
path: root/tools/js_optimizer.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-25 13:00:23 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-25 13:00:23 -0700
commit50d86717964d0121878630d873b9b7e0b4c84712 (patch)
treee2061a8b281b39ff2d9e19a24d11230d21fb5d7e /tools/js_optimizer.py
parentcf9f27864fc3bbf99adce808568e8cc691ee31b7 (diff)
allow mixing minifier extra info with general extra info in js optimizer
Diffstat (limited to 'tools/js_optimizer.py')
-rw-r--r--tools/js_optimizer.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py
index 4e7d5474..acb87460 100644
--- a/tools/js_optimizer.py
+++ b/tools/js_optimizer.py
@@ -74,7 +74,7 @@ class Minifier:
f = open(temp_file, 'w')
f.write(shell)
f.write('\n')
- f.write('// EXTRA_INFO:' + self.serialize())
+ f.write('// EXTRA_INFO:' + json.dumps(self.serialize()))
f.close()
output = subprocess.Popen(self.js_engine +
@@ -91,10 +91,10 @@ class Minifier:
def serialize(self):
- return json.dumps({
+ return {
'names': self.names,
'globals': self.globs
- })
+ }
start_funcs_marker = '// EMSCRIPTEN_START_FUNCS\n'
end_funcs_marker = '// EMSCRIPTEN_END_FUNCS\n'
@@ -256,9 +256,12 @@ EMSCRIPTEN_FUNCS();
f.write(chunk)
f.write(suffix_marker)
if minify_globals:
- assert not extra_info
+ if extra_info:
+ for key, value in extra_info.iteritems():
+ assert key not in minify_info or value == minify_info[key], [key, value, minify_info[key]]
+ minify_info[key] = value
f.write('\n')
- f.write('// EXTRA_INFO:' + minify_info)
+ f.write('// EXTRA_INFO:' + json.dumps(minify_info))
elif extra_info:
f.write('\n')
f.write('// EXTRA_INFO:' + json.dumps(extra_info))