]> source.dussan.org Git - jquery.git/commitdiff
Build: combine intro and outro
authorTimmy Willison <timmywillisn@gmail.com>
Mon, 7 Mar 2016 16:57:35 +0000 (11:57 -0500)
committerTimmy Willison <timmywillisn@gmail.com>
Wed, 9 Mar 2016 16:42:42 +0000 (11:42 -0500)
Fixes gh-2975
Close gh-2976

.jscsrc
.jshintignore
build/tasks/build.js
src/intro.js [deleted file]
src/outro.js [deleted file]
src/wrapper.js [new file with mode: 0644]

diff --git a/.jscsrc b/.jscsrc
index c460130a49527c393f9cd32d6287b9a880fac4a6..c6dc9ee6927bcf05206fbdce26d5f3fecfaad025 100644 (file)
--- a/.jscsrc
+++ b/.jscsrc
@@ -5,6 +5,6 @@
        // and https://github.com/jscs-dev/node-jscs/issues/1686
        "requireCapitalizedComments": null,
 
-       "excludeFiles": [ "external", "src/intro.js", "src/outro.js",
+       "excludeFiles": [ "external",
                "test/node_smoke_tests/lib/ensure_iterability.js", "node_modules" ]
 }
index 1ddafd635a18124198ef31a421424fb88b460b24..bc2a1e23c5b9f42572aa4605c61d42820ee19d83 100644 (file)
@@ -1,6 +1,4 @@
 external
-src/intro.js
-src/outro.js
 test/data/jquery-1.9.1.js
 test/data/badcall.js
 test/data/badjson.js
index 1f1719a48c87d505efa3a68062d641c8bdc8c74e..2ebb4c47e7bd97013dc87edac6f11ae044a90494 100644 (file)
@@ -12,6 +12,11 @@ module.exports = function( grunt ) {
                requirejs = require( "requirejs" ),
                srcFolder = __dirname + "/../../src/",
                rdefineEnd = /\}\s*?\);[^}\w]*$/,
+               read = function( fileName ) {
+                       return grunt.file.read( srcFolder + fileName );
+               },
+               globals = read( "exports/global.js" ),
+               wrapper = read( "wrapper.js" ).split( /\/\/ \@CODE\n\/\/[^\n]+/ ),
                config = {
                        baseUrl: "src",
                        name: "jquery",
@@ -28,8 +33,8 @@ module.exports = function( grunt ) {
                        // Avoid breaking semicolons inserted by r.js
                        skipSemiColonInsertion: true,
                        wrap: {
-                               startFile: "src/intro.js",
-                               endFile: [ "src/exports/global.js", "src/outro.js" ]
+                               start: wrapper[ 0 ].replace( /\/\*jshint .* \*\/\n/, "" ),
+                               end: globals + wrapper[ 1 ]
                        },
                        rawText: {},
                        onBuildWrite: convert
diff --git a/src/intro.js b/src/intro.js
deleted file mode 100644 (file)
index 2918495..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*!
- * jQuery JavaScript Library v@VERSION
- * https://jquery.com/
- *
- * Includes Sizzle.js
- * https://sizzlejs.com/
- *
- * Copyright jQuery Foundation and other contributors
- * Released under the MIT license
- * https://jquery.org/license
- *
- * Date: @DATE
- */
-
-(function( global, factory ) {
-
-       if ( typeof module === "object" && typeof module.exports === "object" ) {
-               // For CommonJS and CommonJS-like environments where a proper `window`
-               // is present, execute the factory and get jQuery.
-               // For environments that do not have a `window` with a `document`
-               // (such as Node.js), expose a factory as module.exports.
-               // This accentuates the need for the creation of a real `window`.
-               // e.g. var jQuery = require("jquery")(window);
-               // See ticket #14549 for more info.
-               module.exports = global.document ?
-                       factory( global, true ) :
-                       function( w ) {
-                               if ( !w.document ) {
-                                       throw new Error( "jQuery requires a window with a document" );
-                               }
-                               return factory( w );
-                       };
-       } else {
-               factory( global );
-       }
-
-// Pass this if window is not defined yet
-}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
-
-// Support: Firefox 18+
-// Can't be in strict mode, several libs including ASP.NET trace
-// the stack via arguments.caller.callee and Firefox dies if
-// you try to trace through "use strict" call chains. (#13335)
-//"use strict";
diff --git a/src/outro.js b/src/outro.js
deleted file mode 100644 (file)
index d792ffb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-return jQuery;
-}));
diff --git a/src/wrapper.js b/src/wrapper.js
new file mode 100644 (file)
index 0000000..4ad7776
--- /dev/null
@@ -0,0 +1,51 @@
+/*jshint unused:false */
+/*!
+ * jQuery JavaScript Library v@VERSION
+ * https://jquery.com/
+ *
+ * Includes Sizzle.js
+ * https://sizzlejs.com/
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license
+ * https://jquery.org/license
+ *
+ * Date: @DATE
+ */
+( function( global, factory ) {
+
+       if ( typeof module === "object" && typeof module.exports === "object" ) {
+
+               // For CommonJS and CommonJS-like environments where a proper `window`
+               // is present, execute the factory and get jQuery.
+               // For environments that do not have a `window` with a `document`
+               // (such as Node.js), expose a factory as module.exports.
+               // This accentuates the need for the creation of a real `window`.
+               // e.g. var jQuery = require("jquery")(window);
+               // See ticket #14549 for more info.
+               module.exports = global.document ?
+                       factory( global, true ) :
+                       function( w ) {
+                               if ( !w.document ) {
+                                       throw new Error( "jQuery requires a window with a document" );
+                               }
+                               return factory( w );
+                       };
+       } else {
+               factory( global );
+       }
+
+// Pass this if window is not defined yet
+}( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
+
+// Support: Firefox 18+
+// Can't be in strict mode, several libs including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+//"use strict";
+
+// @CODE
+// build.js inserts compiled jQuery here
+
+return jQuery;
+} ) );