diff --git a/build.js b/build.js index a78743665..fb5c26441 100755 --- a/build.js +++ b/build.js @@ -415,7 +415,7 @@ * @returns {String} Returns the modified source. */ function addCommandsToHeader(source, commands) { - return source.replace(/(\/\*!\n)( \*)?( *Lo-Dash [\w.-]+)(.*)/, function() { + return source.replace(/(\/\*!\n)( \*)?( *@license[\s*]+)?( *Lo-Dash [\w.-]+)(.*)/, function() { // convert unmatched groups to empty strings var parts = _.map(slice.call(arguments, 1), function(part) { return part || ''; @@ -436,7 +436,8 @@ }); // add build commands to copyright/license header return ( - parts[0] + parts[1] + parts[2] + ' (Custom Build)' + parts[3] + '\n' + + parts[0] + parts[1] + parts[2] + parts[3] + + ' (Custom Build)' + parts[4] + '\n' + parts[1] + ' Build: `lodash ' + commands.join(' ') + '`' ); }); diff --git a/build/post-compile.js b/build/post-compile.js index 4d7ba68b8..ac242eab2 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -9,11 +9,12 @@ var licenseTemplate = { 'lodash': '/*!\n' + - ' Lo-Dash @VERSION lodash.com/license\n' + + ' @license\n' + + ' Lo-Dash <%= VERSION %> lodash.com/license\n' + ' Underscore.js 1.4.3 underscorejs.org/LICENSE\n' + '*/', 'underscore': - '/*! Underscore.js @VERSION underscorejs.org/LICENSE */' + '/*! @license Underscore.js <%= VERSION %> underscorejs.org/LICENSE */' }; /*--------------------------------------------------------------------------*/ @@ -51,7 +52,7 @@ } // add copyright/license header return licenseTemplate[/call\(this\);?$/.test(source) ? 'underscore' : 'lodash'] - .replace('@VERSION', snippet[2]) + '\n;' + source; + .replace('<%= VERSION %>', snippet[2]) + '\n;' + source; } /*--------------------------------------------------------------------------*/ diff --git a/lodash.min.js b/lodash.min.js index 8eefacbd6..f22800eca 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -1,4 +1,5 @@ /*! + @license Lo-Dash 1.0.0-rc.2 lodash.com/license Underscore.js 1.4.3 underscorejs.org/LICENSE */ @@ -26,16 +27,16 @@ t[0]})(1);var Yt=!y(arguments),Zt="xx"!="x"[0]+Object("x")[0];try{var en=("[obje .apply(this,arguments)}},s.assign=cn,s.bind=J,s.bindAll=function(e){for(var t=arguments,n=1W(u,a)){for( -var f=n;--f;)if(!(s[f]||(s[f]=o(t[f])))(a))break e;u.push(a)}}return u},s.invert=x,s.invoke=function(e,t){var n=m(arguments,2),r="function"==typeof t,i=[];return H(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.keys=bn,s.map=B,s.max=j,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=A,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&L(e)?u:l(t,n),ln(e,function( -e,n,i){n=t(e,n,i),nW(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return pn(e,function( -e,n){t.push([n,e])}),t},s.partial=function(e){return f(e,m(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=Et.apply(et,arguments),o=s.length;++i=l?(clearTimeout(u),u=r,a=f,s=e.apply -(o,i)):u||(u=setTimeout(n,l)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rn?Dt(0,r+n):Pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.mixin=Q,s.noConflict=function(){return e._=st,this},s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+St(Ht -()*((+t||0)-e+1))},s.reduce=I,s.reduceRight=q,s.result=function(e,t){var n=e?e[t]:r;return N(n)?e[t]():n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:bn(e).length},s.some=R,s.sortedIndex=V,s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=s.templateSettings,u=0,a=n.interpolate||o.interpolate||mt,f="__p+='",l=n.variable||o.variable,c=l;e.replace(RegExp((n.escape||o.escape||mt).source+"|"+a.source+"|"+(a===vt?dt:mt).source+"|"+(n.evaluate||o.evaluate||mt).source+"|$","g" -),function(t,n,i,s,o,a){return i||(i=s),f+=e.slice(u,a).replace(yt,h),n&&(f+="'+__e("+n+")+'"),o&&(f+="';"+o+";__p+='"),i&&(f+="'+((__t=("+i+"))==null?'':__t)+'"),r||(r=o||ot.test(n||i)),u=a+t.length,t}),f+="';\n",c||(l="obj",r?f="with("+l+"){"+f+"}":(n=RegExp("(\\(\\s*)"+l+"\\."+l+"\\b","g"),f=f.replace(ht,"$&"+l+".").replace(n,"$1__d"))),f=(r?f.replace(at,""):f).replace(ft,"$1").replace(lt,"$1;"),f="function("+l+"){"+(c?"":l+"||("+l+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}" +var f=n;--f;)if(!(s[f]||(s[f]=o(t[f])))(a))continue e;u.push(a)}}return u},s.invert=x,s.invoke=function(e,t){var n=m(arguments,2),r="function"==typeof t,i=[];return H(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.keys=bn,s.map=B,s.max=j,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=A,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&L(e)?u:l(t,n),ln( +e,function(e,n,i){n=t(e,n,i),nW(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return pn +(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return f(e,m(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=Et.apply(et,arguments),o=s.length;++i=l?(clearTimeout(u),u=r +,a=f,s=e.apply(o,i)):u||(u=setTimeout(n,l)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rn?Dt(0,r+n):Pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.mixin=Q,s.noConflict=function(){return e._=st,this},s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0 +),e+St(Ht()*((+t||0)-e+1))},s.reduce=I,s.reduceRight=q,s.result=function(e,t){var n=e?e[t]:r;return N(n)?e[t]():n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:bn(e).length},s.some=R,s.sortedIndex=V,s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=s.templateSettings,u=0,a=n.interpolate||o.interpolate||mt,f="__p+='",l=n.variable||o.variable,c=l;e.replace(RegExp((n.escape||o.escape||mt).source+"|"+a.source+"|"+(a===vt?dt:mt).source+"|"+(n.evaluate||o.evaluate||mt).source+"|$" +,"g"),function(t,n,i,s,o,a){return i||(i=s),f+=e.slice(u,a).replace(yt,h),n&&(f+="'+__e("+n+")+'"),o&&(f+="';"+o+";__p+='"),i&&(f+="'+((__t=("+i+"))==null?'':__t)+'"),r||(r=o||ot.test(n||i)),u=a+t.length,t}),f+="';\n",c||(l="obj",r?f="with("+l+"){"+f+"}":(n=RegExp("(\\(\\s*)"+l+"\\."+l+"\\b","g"),f=f.replace(ht,"$&"+l+".").replace(n,"$1__d"))),f=(r?f.replace(at,""):f).replace(ft,"$1").replace(lt,"$1;"),f="function("+l+"){"+(c?"":l+"||("+l+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}" :(c?"":",__d="+l+"."+l+"||"+l)+";")+f+"return __p}";try{i=Function("_","return "+f)(s)}catch(p){throw p.source=f,p}return t?i(t):(i.source=f,i)},s.unescape=function(e){return e==r?"":(e+"").replace(ut,g)},s.uniqueId=function(e){return(e==r?"":e+"")+ ++nt},s.all=_,s.any=R,s.detect=P,s.foldl=I,s.foldr=q,s.include=M,s.inject=I,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(){var t=[this.__wrapped__];return Nt.apply(t,arguments),e.apply(s,t)})}),s.first=U,s.last=function(e,t,n){if(e){var i= e.length;return t==r||n?e[i-1]:m(e,Dt(0,i-t))}},s.take=U,s.head=U,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(t,n){var i=e(this.__wrapped__,t,n);return t==r||n?i:new s(i)})}),s.VERSION="1.0.0-rc.2",s.prototype.toString=function(){return this.__wrapped__+""},s.prototype.value=G,s.prototype.valueOf=G,ln(["join","pop","shift"],function(e){var t=et[e];s.prototype[e]=function(){return t.apply(this.__wrapped__,arguments)}}),ln(["push","reverse","sort","unshift"],function(e){var t=et[e]; s.prototype[e]=function(){return t.apply(this.__wrapped__,arguments),this}}),ln(["concat","slice","splice"],function(e){var t=et[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return new s(e)}}),Qt&&ln(["shift","splice"],function(e){var t=s.prototype[e];s.prototype[e]=function(){var e=this.__wrapped__,n=t.apply(this,arguments);return 0===e.length&&delete e[0],n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):Y?"object"==typeof diff --git a/lodash.underscore.min.js b/lodash.underscore.min.js index 768268b5a..cc82ef03e 100644 --- a/lodash.underscore.min.js +++ b/lodash.underscore.min.js @@ -1,4 +1,5 @@ /*! + @license Lo-Dash 1.0.0-rc.2 (Custom Build) lodash.com/license Build: `lodash underscore -m -o ./lodash.underscore.min.js` Underscore.js 1.4.3 underscorejs.org/LICENSE @@ -19,12 +20,12 @@ e.__chain__=!0),e}})}var U="object"==typeof exports&&exports,z="object"==typeof ;t||(t=q);for(n in e)if(t(e[n],n,e)===V)break;return e},Ct=function(e,t){var n;if(!e)return e;t||(t=q);for(n in e)if(nt.call(e,n)&&t(e[n],n,e)===V)break;return e},kt={"&":"&","<":"<",">":">",'"':""","'":"'"},Lt=v(kt),At=ot||function(e){return e instanceof Array||it.call(e)==pt};g(/x/)&&(g=function(e){return e instanceof Function||"[object Function]"==it.call(e)});var Ot=ft?function(e){return y(e)?ft(e):[]}:h;n.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply (this,arguments)}},n.bind=I,n.bindAll=function(e){for(var t=arguments,n=1H(r,s,n)&&i.push(s)}return i} -,n.filter=T,n.flatten=P,n.forEach=C,n.functions=d,n.groupBy=function(e,t,n){var r={},t=s(t,n);return C(e,function(e,n,i){n=t(e,n,i),(nt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.initial=function(e,t,n){if(!e)return[];var r=e.length;return f(e,0,ct(lt(0,r-(null==t||n?1:t||0)),r))},n.intersection=function(e){var t=arguments,n=t.length,r=-1,i=e?e.length:0,s=[];e:for(;++rH(s,o)){for(var u=n;--u;)if(0>H(t[u],o))break e;s.push(o)}}return s},n.invert=v,n.invoke=function(e,t){var n=f(arguments -,2),r="function"==typeof t,i=[];return C(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.keys=Ot,n.map=k,n.max=L,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return nt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!At(e))t=s(t,n),Tt(e,function(e,n,i){n=t(e,n,i),nH(t,r,1)&&(n[r]=e)}),n},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return Ct(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=et.apply(W,arguments),r=n.length,i={};++t=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rH(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return rt.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?L(A(arguments,"length")):0,r=Array(n);++tH(s,o)){for(var u=n;--u;)if(0>H(t[u],o))continue e;s.push(o)}}return s},n.invert=v,n.invoke=function(e,t){var n=f +(arguments,2),r="function"==typeof t,i=[];return C(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.keys=Ot,n.map=k,n.max=L,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return nt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!At(e))t=s(t,n),Tt(e,function(e,n,i){n=t(e,n,i),nH(t,r,1)&&(n[r]=e)}),n},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return Ct(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=et.apply(W,arguments),r=n.length,i={};++t=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rH(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return rt.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?L(A(arguments,"length")):0,r=Array(n);++tn?lt(0,r+n):ct(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},n.mixin=R,n.noConflict=function(){return e ._=$,this},n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+tt(ht()*((+t||0)-e+1))},n.reduce=O,n.reduceRight=M,n.result=function(e,t){var n=e?e[t]:null;return g(n)?e[t]():n},n.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:Ot(e).length},n.some=_,n.sortedIndex=j,n.template=function(e,t,r){e||(e="");var r=p({},r,n.templateSettings),i=0,s="__p+='",u=r.variable;e.replace(RegExp((r.escape||Q).source+"|"+(r.interpolate||Q).source+"|"+(r.evaluate||Q).source+"|$" diff --git a/test/test-build.js b/test/test-build.js index ea9c83cd6..796cefa6b 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -560,6 +560,9 @@ QUnit.module('independent builds'); (function() { + var reComment = /\/\*![\s\S]+?\*\//, + reCustom = /Custom Build/; + asyncTest('debug only', function() { var start = _.once(QUnit.start); build(['-d', '-s'], function(source, filePath) { @@ -572,6 +575,9 @@ var start = _.once(QUnit.start); build(['-d', '-s', 'backbone'], function(source, filePath) { equal(path.basename(filePath, '.js'), 'lodash.custom'); + + var comment = source.match(reComment); + ok(reCustom.test(comment)); start(); }); }); @@ -588,6 +594,9 @@ var start = _.once(QUnit.start); build(['-m', '-s', 'backbone'], function(source, filePath) { equal(path.basename(filePath, '.js'), 'lodash.custom.min'); + + var comment = source.match(reComment); + ok(reCustom.test(comment)); start(); }); });