| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent efcbafa commit a63c556
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,36 +32,15 @@ | |||
| 32 | 32 | # library. | |
| 33 | 33 | ||
| 34 | 34 | import os | |
| 35 | - from os.path import dirname | ||
| 36 | 35 | import re | |
| 37 | 36 | import sys | |
| 38 | 37 | import string | |
| 39 | 38 | ||
| 40 | - sys.path.append(dirname(__file__) + "/../deps/v8/tools"); | ||
| 41 | - import jsmin | ||
| 42 | - | ||
| 43 | 39 | ||
| 44 | 40 | def ToCArray(filename, lines): | |
| 45 | 41 | return ','.join(str(ord(c)) for c in lines) | |
| 46 | 42 | ||
| 47 | 43 | ||
| 48 | - def CompressScript(lines, do_jsmin): | ||
| 49 | - # If we're not expecting this code to be user visible, we can run it through | ||
| 50 | - # a more aggressive minifier. | ||
| 51 | - if do_jsmin: | ||
| 52 | - minifier = JavaScriptMinifier() | ||
| 53 | - return minifier.JSMinify(lines) | ||
| 54 | - | ||
| 55 | - # Remove stuff from the source that we don't want to appear when | ||
| 56 | - # people print the source code using Function.prototype.toString(). | ||
| 57 | - # Note that we could easily compress the scripts mode but don't | ||
| 58 | - # since we want it to remain readable. | ||
| 59 | - #lines = re.sub('//.*\n', '\n', lines) # end-of-line comments | ||
| 60 | - #lines = re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', lines) # comments. | ||
| 61 | - #lines = re.sub('\s+\n+', '\n', lines) # trailing whitespace | ||
| 62 | - return lines | ||
| 63 | - | ||
| 64 | - | ||
| 65 | 44 | def ReadFile(filename): | |
| 66 | 45 | file = open(filename, "rt") | |
| 67 | 46 | try: | |
@@ -264,11 +243,9 @@ def JS2C(source, target): | |||
| 264 | 243 | for s in modules: | |
| 265 | 244 | delay = str(s).endswith('-delay.js') | |
| 266 | 245 | lines = ReadFile(str(s)) | |
| 267 | - do_jsmin = lines.find('// jsminify this file, js2c: jsmin') != -1 | ||
| 268 | 246 | ||
| 269 | 247 | lines = ExpandConstants(lines, consts) | |
| 270 | 248 | lines = ExpandMacros(lines, macros) | |
| 271 | - lines = CompressScript(lines, do_jsmin) | ||
| 272 | 249 | data = ToCArray(s, lines) | |
| 273 | 250 | ||
| 274 | 251 | # On Windows, "./foo.bar" in the .gyp file is passed as "foo.bar" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments