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 <shvyo1987@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Родитель
4803d116a8
Коммит
0e2b25034e
|
@ -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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче