Minify ES Modules files

After converting the `ui/` folder to ESM, there was a significant performance
regression in terms of file size of the `resources.pak`. It turns out that we
were not minifying ESM files, but we did do that before with Closure.

Update the `copy_devtools_modules` to also invoke rjsmin to minify the
JavaScript source code.

Before:
$ du -h -B K out/Default/resources.pak
12096K	out/Default/resources.pak

After:
$ du -h -B K out/Default/resources.pak
11752K	out/Default/resources.pak

Before the original CL transforming `ui/` landed:
$ du -h -B K out/Default/resources.pak
11860K	out/Default/resources.pak

This means that after converting `ui/` to ESM, we saved 90KB. We suspect
this is because we are no longer transpiling to ES5, but instead serve
source ES6.

Bug: 1010910
Change-Id: I7dd07ff788d014e9f9a8e25e168c58c010cd00af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837814
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#702500}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8d2021d8394b9a248436fb6976070629cdffd961
diff --git a/scripts/build/copy_devtools_modules.py b/scripts/build/copy_devtools_modules.py
index 10d9ee2..a04b9e6 100755
--- a/scripts/build/copy_devtools_modules.py
+++ b/scripts/build/copy_devtools_modules.py
@@ -12,6 +12,10 @@
 import shutil
 import sys
 
+import rjsmin
+
+from modular_build import read_file, write_file
+
 
 def main(argv):
     try:
@@ -21,11 +25,13 @@
         output_path = argv[output_path_flag_index + 1]
         devtools_modules = argv[1:input_path_flag_index]
     except:
-        print 'Usage: %s module_1 module_2 ... module_N --input_path <input_path> --output_path <output_path>' % argv[0]
+        print('Usage: %s module_1 module_2 ... module_N --input_path <input_path> --output_path <output_path>' % argv[0])
         raise
 
     for file_name in devtools_modules:
-        shutil.copy(join(input_path, file_name), join(output_path, relpath(file_name, 'front_end')))
+        file_content = read_file(join(input_path, file_name))
+        minified = rjsmin.jsmin(file_content)
+        write_file(join(output_path, relpath(file_name, 'front_end')), minified)
 
 
 if __name__ == '__main__':