diff options
-rw-r--r-- | emlink.py | 2 | ||||
-rw-r--r-- | tools/js_optimizer.py | 10 | ||||
-rw-r--r-- | tools/shared.py | 4 |
3 files changed, 10 insertions, 6 deletions
@@ -69,7 +69,7 @@ class AsmModule(): replacements[func] = rep #print replacements - temp = shared.Building.js_optimizer(self.filename, ['asm', 'relocate']) + temp = shared.Building.js_optimizer(self.filename, ['asm', 'relocate'], extra_info={ 'replacements': replacements }) relocated_funcs = AsmModule(temp) shared.try_delete(temp) main.extra_funcs_js = relocated_funcs.funcs_js diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py index 7cefe90a..8a0464ea 100644 --- a/tools/js_optimizer.py +++ b/tools/js_optimizer.py @@ -113,7 +113,7 @@ def run_on_chunk(command): if DEBUG and not shared.WINDOWS: print >> sys.stderr, '.' # Skip debug progress indicator on Windows, since it doesn't buffer well with multiple threads printing to console. return filename -def run_on_js(filename, passes, js_engine, jcache, source_map=False): +def run_on_js(filename, passes, js_engine, jcache, source_map=False, extra_info=None): if isinstance(jcache, bool) and jcache: jcache = shared.JCache if jcache: shared.JCache.ensure() @@ -251,8 +251,12 @@ EMSCRIPTEN_FUNCS(); f.write(chunk) f.write(suffix_marker) if minify_globals: + assert not extra_info f.write('\n') f.write('// EXTRA_INFO:' + minify_info) + elif extra_info: + f.write('\n') + f.write('// EXTRA_INFO:' + json.dumps(extra_info)) f.close() return temp_file filenames = [write_chunk(chunks[i], i) for i in range(len(chunks))] @@ -331,6 +335,6 @@ EMSCRIPTEN_FUNCS(); return filename -def run(filename, passes, js_engine, jcache, source_map=False): - return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, jcache, source_map)) +def run(filename, passes, js_engine, jcache, source_map=False, extra_info=None): + return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, jcache, source_map, extra_info)) diff --git a/tools/shared.py b/tools/shared.py index 5819f39e..52ca0292 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -1210,8 +1210,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e return opts @staticmethod - def js_optimizer(filename, passes, jcache=False, debug=False): - return js_optimizer.run(filename, passes, listify(NODE_JS), jcache, debug) + def js_optimizer(filename, passes, jcache=False, debug=False, extra_info=None): + return js_optimizer.run(filename, passes, listify(NODE_JS), jcache, debug, extra_info) @staticmethod def closure_compiler(filename, pretty=True): |