diff options
author | Jez Ng <me@jezng.com> | 2013-06-06 17:46:13 -0700 |
---|---|---|
committer | Jez Ng <me@jezng.com> | 2013-06-19 01:22:01 -0700 |
commit | 747f74e1055feaea11222978d46c421ac92602ea (patch) | |
tree | 2c153da61e78bb6a6d2ee9731a15787b01b81474 /emcc | |
parent | 86e672a4371e57238fabdde3a35eeee03c8aa77f (diff) |
Implement basic source maps. Closes #1252.
Diffstat (limited to 'emcc')
-rwxr-xr-x | emcc | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -49,7 +49,7 @@ emcc can be influenced by a few environment variables: import os, sys, shutil, tempfile, subprocess, shlex, time, re, logging from subprocess import PIPE, STDOUT -from tools import shared +from tools import shared, jsrun from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename from tools.response_file import read_response_file @@ -1585,12 +1585,17 @@ try: else: logging.debug('did not see memory initialization') + def generate_source_maps(filename, mapFileBaseName): + jsrun.run_js(shared.path_from_root('tools', 'sourcemapper.js'), + shared.NODE_JS, [filename, os.getcwd(), mapFileBaseName]) + # If we were asked to also generate HTML, do that if final_suffix == 'html': logging.debug('generating HTML') shell = open(shell_path).read() html = open(target, 'w') if not Compression.on: + if keep_js_debug: generate_source_maps(final, target) html.write(shell.replace('{{{ SCRIPT_CODE }}}', open(final).read())) else: # Compress the main code @@ -1661,6 +1666,8 @@ try: from tools.split import split_javascript_file split_javascript_file(final, unsuffixed(target), split_js_file) else: + if keep_js_debug: generate_source_maps(final, target) + # copy final JS to output shutil.move(final, target) |