From a63c556c114413a6a8030e0d51ddde4cf2f0ac94 Mon Sep 17 00:00:00 2001 From: Sakthipriyan Vairamani Date: Sun, 8 May 2016 12:56:36 +0530 Subject: [PATCH] tools: remove the minifying logic As the minifier logic is not used at all, this patch removes the code necessary for it. PR-URL: https://github.com/nodejs/node/pull/6636 Reviewed-By: Jackson Tian Reviewed-By: Ben Noordhuis --- tools/js2c.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/tools/js2c.py b/tools/js2c.py index 3e9a1c39cc496f..40c30cc0325f61 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"