[Pkg-javascript-commits] [pdf.js] 09/414: Collapses UMD headers in bundled files.

David Prévot taffit at moszumanska.debian.org
Tue Jun 28 17:12:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 2f704f59578a1ae888e594786e8c07d1fddfc211
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Wed Dec 16 07:42:54 2015 -0600

    Collapses UMD headers in bundled files.
---
 make.js | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/make.js b/make.js
index 6d08c56..67f4a72 100644
--- a/make.js
+++ b/make.js
@@ -504,6 +504,9 @@ target.bundle = function(args) {
     // contains a license header, so the header of bundleContent can be removed.
     bundleContent = stripCommentHeaders('\n' + bundleContent);
 
+    // Removes AMD and CommonJS branches from UMD headers.
+    bundleContent = stripUMDHeaders(bundleContent);
+
     // Append external files last since we don't want to modify them.
     bundleContent += cat(EXT_SRC_FILES);
 
@@ -614,6 +617,14 @@ function stripCommentHeaders(content, filename) {
   return content;
 }
 
+function stripUMDHeaders(content) {
+  var reg = new RegExp(
+    'if \\(typeof define === \'function\' && define.amd\\) \\{[^}]*' +
+    '\\} else if \\(typeof exports !== \'undefined\'\\) \\{[^}]*' +
+    '\\} else ', 'g');
+  return content.replace(reg, '');
+}
+
 function cleanupJSSource(file) {
   var content = cat(file);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list