Skip to content

Commit

Permalink
tools: remove the minifying logic
Browse files Browse the repository at this point in the history
As the minifier logic is not used at all, this patch removes the code
necessary for it.

PR-URL: #6636
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
thefourtheye authored and Myles Borins committed Jun 24, 2016
1 parent 6dfe7ae commit a31153c
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions tools/js2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit a31153c

Please sign in to comment.