Skip to content

Commit e0c624c

Browse files
committed
Package: Update regexes used to match UI 1.13
Ref gh-582
1 parent e50bab0 commit e0c624c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lib/package-1-13.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,22 @@ var indexTemplate, jsBundleIntro, jsBundleOutro,
1616
indexTemplate = handlebars.compile( fs.readFileSync( __dirname + "/../template/zip/index-1-12.html", "utf8" ) );
1717
Q.longStackSupport = true;
1818

19-
jsBundleIntro = "(function( factory ) {\n" +
19+
jsBundleIntro = "( function( factory ) {\n" +
20+
" \"use strict\";\n" +
21+
" \n" +
2022
" if ( typeof define === \"function\" && define.amd ) {\n" +
2123
"\n" +
2224
" // AMD. Register as an anonymous module.\n" +
23-
" define([ \"jquery\" ], factory );\n" +
25+
" define( [ \"jquery\" ], factory );\n" +
2426
" } else {\n" +
2527
"\n" +
2628
" // Browser globals\n" +
2729
" factory( jQuery );\n" +
2830
" }\n" +
29-
"}(function( $ ) {";
31+
"} )( function( $ ) {" +
32+
" \"use strict\";";
3033

31-
jsBundleOutro = "}));";
34+
jsBundleOutro = "} );";
3235

3336
function camelCase( input ) {
3437
return input.toLowerCase().replace( /[-/](.)/g, function( match, group1 ) {
@@ -144,9 +147,9 @@ extend( Package.prototype, {
144147
name = camelCase( id.replace( /ui\//, "" ).replace( /\.js$/, "" ) );
145148
return contents
146149

147-
// Remove UMD wrapper.
148-
.replace( /\( ?function\( factory[\s\S]*?\( ?function\( [^\)]* \) \{/, "" )
149-
.replace( /\} ?\) ?\);\s*?$/, "" )
150+
// Remove UMD wrappers of UI & jQuery Color.
151+
.replace( /\( ?function\( ?(?:root, ?)?factory\b[\s\S]*?\( ?"(?:this, ?)?function\( ?[^\)]* ?\) ?\{/, "" )
152+
.replace( /\} ?\);\s*?$/, "" )
150153

151154
// Replace return exports for var =.
152155
.replace( /\nreturn/, "\nvar " + name + " =" );

0 commit comments

Comments
 (0)