diff --git a/tools/js2c.py b/tools/js2c.py index 3e9a1c39cc..40c30cc032 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -32,36 +32,15 @@ # library. import os -from os.path import dirname import re import sys import string -sys.path.append(dirname(__file__) + "/../deps/v8/tools"); -import jsmin - def ToCArray(filename, lines): return ','.join(str(ord(c)) for c in lines) -def CompressScript(lines, do_jsmin): - # If we're not expecting this code to be user visible, we can run it through - # a more aggressive minifier. - if do_jsmin: - minifier = JavaScriptMinifier() - return minifier.JSMinify(lines) - - # Remove stuff from the source that we don't want to appear when - # people print the source code using Function.prototype.toString(). - # Note that we could easily compress the scripts mode but don't - # since we want it to remain readable. - #lines = re.sub('//.*\n', '\n', lines) # end-of-line comments - #lines = re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', lines) # comments. - #lines = re.sub('\s+\n+', '\n', lines) # trailing whitespace - return lines - - def ReadFile(filename): file = open(filename, "rt") try: @@ -264,11 +243,9 @@ def JS2C(source, target): for s in modules: delay = str(s).endswith('-delay.js') lines = ReadFile(str(s)) - do_jsmin = lines.find('// jsminify this file, js2c: jsmin') != -1 lines = ExpandConstants(lines, consts) lines = ExpandMacros(lines, macros) - lines = CompressScript(lines, do_jsmin) data = ToCArray(s, lines) # On Windows, "./foo.bar" in the .gyp file is passed as "foo.bar"