mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 19:06:09 +00:00
Identify app.js source map using a special comment
If we're going to minify third party code, the size heuristic may not hold anymore. (imported from commit 78ada1fee1446e78b3b1ad299ee3e975d1cd9002)
This commit is contained in:
committed by
Zev Benjamin
parent
5aafdc7cf9
commit
371d0dbaa0
@@ -12,13 +12,11 @@ class ClosureSourceMapCompressor(SubProcessCompressor):
|
|||||||
# easily get either the input file names or the output file
|
# easily get either the input file names or the output file
|
||||||
# name. So we just pick a unique arbitrary name. This is
|
# name. So we just pick a unique arbitrary name. This is
|
||||||
# okay because we can figure out from the source map file
|
# okay because we can figure out from the source map file
|
||||||
# contents which JavaScript files it corresponds to.
|
# contents which JavaScript files it corresponds to. But we
|
||||||
|
# use a special comment to identify app.js, so that automatic
|
||||||
|
# source mapping works.
|
||||||
|
|
||||||
# As a hack to make things easier, assume that any large input
|
if 'MINIFY-FILE-ID: zephyr.js' in js:
|
||||||
# corresponds to app.js. This is like 60 times bigger than
|
|
||||||
# any other input file, at present.
|
|
||||||
|
|
||||||
if len(js) > 100000:
|
|
||||||
source_map_name = 'app.js.map'
|
source_map_name = 'app.js.map'
|
||||||
else:
|
else:
|
||||||
source_map_name = sha1(js).hexdigest() + '.map'
|
source_map_name = sha1(js).hexdigest() + '.map'
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
// zephyr/lib/minify.py will look for this comment in order to tell when it's
|
||||||
|
// producing app.js:
|
||||||
|
//
|
||||||
|
// MINIFY-FILE-ID: zephyr.js
|
||||||
|
|
||||||
var all_msg_list = new MessageList();
|
var all_msg_list = new MessageList();
|
||||||
var home_msg_list = new MessageList('zhome', new narrow.Filter([["in", "home"]]));
|
var home_msg_list = new MessageList('zhome', new narrow.Filter([["in", "home"]]));
|
||||||
var narrowed_msg_list;
|
var narrowed_msg_list;
|
||||||
|
|||||||
Reference in New Issue
Block a user