From 4a098f4883a3f7cc2634444117ac5a5d7f39b85b Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 7 Mar 2016 11:57:35 -0500 Subject: [PATCH] Build: combine intro and outro Fixes gh-2975 Close gh-2976 --- .jscsrc | 2 +- .jshintignore | 2 -- build/tasks/build.js | 9 +++++++-- src/outro.js | 2 -- src/{intro.js => wrapper.js} | 13 ++++++++++--- 5 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 src/outro.js rename src/{intro.js => wrapper.js} (85%) diff --git a/.jscsrc b/.jscsrc index c460130a4..c6dc9ee69 100644 --- 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" ] } diff --git a/.jshintignore b/.jshintignore index 1ddafd635..bc2a1e23c 100644 --- a/.jshintignore +++ b/.jshintignore @@ -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 diff --git a/build/tasks/build.js b/build/tasks/build.js index 1f1719a48..2ebb4c47e 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -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/outro.js b/src/outro.js deleted file mode 100644 index d792ffb58..000000000 --- a/src/outro.js +++ /dev/null @@ -1,2 +0,0 @@ -return jQuery; -})); diff --git a/src/intro.js b/src/wrapper.js similarity index 85% rename from src/intro.js rename to src/wrapper.js index 291849526..4ad7776d1 100644 --- a/src/intro.js +++ b/src/wrapper.js @@ -1,3 +1,4 @@ +/*jshint unused:false */ /*! * jQuery JavaScript Library v@VERSION * https://jquery.com/ @@ -11,10 +12,10 @@ * * Date: @DATE */ - -(function( global, factory ) { +( 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` @@ -35,10 +36,16 @@ } // Pass this if window is not defined yet -}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { +}( 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; +} ) ); -- 2.39.5