From 1ade3669faad6fee62fd1f3a7675cf075c2893d5 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Fri, 20 Oct 2017 17:09:10 -0700 Subject: include individual module files for aliases --- Makefile | 32 ++++++++++++++++++++++++-------- dist/async.min.map | 3 +-- support/build.test.js | 3 +-- support/es.test.js | 7 +++++++ support/get-alias.js | 12 ++++++++++++ support/list-aliases.js | 25 +++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 support/get-alias.js create mode 100644 support/list-aliases.js diff --git a/Makefile b/Makefile index b9d413c..880d739 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ PACKAGE = asyncjs REQUIRE_NAME = async UGLIFY = uglifyjs XYZ = support/xyz.sh --repo git@github.com:caolan/async.git +COPY_ES = sed -E "s/(import.+)lodash/\1lodash-es/g" BUILDDIR = build BUILD_ES = build-es @@ -22,8 +23,10 @@ LINT_FILES = lib/ mocha_test/ $(shell find perf/ -maxdepth 2 -type f) $(shell fi UMD_BUNDLE = $(BUILDDIR)/dist/async.js UMD_BUNDLE_MIN = $(BUILDDIR)/dist/async.min.js UMD_BUNDLE_MAP = $(BUILDDIR)/dist/async.min.map -ES_MODULES = $(patsubst lib/%.js, build-es/%.js, $(JS_SRC)) -CJS_MODULES = $(patsubst lib/%.js, build/%.js, $(JS_SRC)) +ALIAS_ES = $(shell node $(SCRIPTS)/list-aliases.js build-es/) +ES_MODULES = $(patsubst lib/%.js, build-es/%.js, $(JS_SRC)) $(ALIAS_ES) +ALIAS_CJS = $(shell node $(SCRIPTS)/list-aliases.js build/) +CJS_MODULES = $(patsubst lib/%.js, build/%.js, $(JS_SRC)) $(ALIAS_CJS) all: clean lint build test @@ -54,12 +57,20 @@ $(BUILDDIR)/%.js: lib/%.js mkdir -p "$(@D)" node $(SCRIPTS)/build/compile-module.js --file $< --output $@ + +define COMPILE_ALIAS +$A: $(shell node $(SCRIPTS)/get-alias.js $A) + mkdir -p "$$(@D)" + node $(SCRIPTS)/build/compile-module.js --file $$< --output $$@ +endef +$(foreach A,$(ALIAS_CJS),$(eval $(COMPILE_ALIAS))) + $(UMD_BUNDLE): $(ES_MODULES) package.json mkdir -p "$(@D)" node $(SCRIPTS)/build/aggregate-bundle.js # Create the minified UMD versions and copy them to dist/ for bower -build-dist: $(DIST) $(UMD_BUNDLE) $(UMD_BUNDLE_MIN) $(DIST)/async.js $(DIST)/async.min.js $(DIST)/async.min.map +build-dist: $(DIST) $(DIST)/async.js $(DIST)/async.min.js $(DIST)/async.min.map $(DIST): mkdir -p $@ @@ -71,22 +82,27 @@ $(UMD_BUNDLE_MIN): $(UMD_BUNDLE) --source-map-url async.min.map \ -o $@ -$(UMD_BUNDLE_MAP): $(UMD_BUNDLE_MIN) - $(DIST)/async.js: $(UMD_BUNDLE) cp $< $@ $(DIST)/async.min.js: $(UMD_BUNDLE_MIN) cp $< $@ -$(DIST)/async.min.map: $(UMD_BUNDLE_MAP) - cp $< $@ +$(DIST)/async.min.map: $(UMD_BUNDLE_MIN) + cp $(UMD_BUNDLE_MAP) $@ build-es: $(ES_MODULES) $(BUILD_ES)/%.js: lib/%.js mkdir -p "$(@D)" - sed -E "s/(import.+)lodash/\1lodash-es/g" $< > $@ + $(COPY_ES) $< > $@ + +define COPY_ES_ALIAS +$A: $(shell node $(SCRIPTS)/get-alias.js $A) + mkdir -p "$$(@D)" + $(COPY_ES) $$< > $$@ +endef +$(foreach A,$(ALIAS_ES),$(eval $(COPY_ES_ALIAS))) test-build: $(UMD_BUNDLE) $(UMD_BUNDLE_MIN) mocha support/build.test.js diff --git a/dist/async.min.map b/dist/async.min.map index 21a5431..33dd00d 100644 --- a/dist/async.min.map +++ b/dist/async.min.map @@ -1,2 +1 @@ -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.async=n.async||{})}(this,function(n){"use strict";function t(n,t){t|=0;for(var e=Math.max(n.length-t,0),r=Array(e),u=0;u-1&&n%1==0&&n<=Tt}function d(n){return null!=n&&v(n.length)&&!y(n)}function m(){}function g(n){return function(){if(null!==n){var t=n;n=null,t.apply(this,arguments)}}}function b(n,t){for(var e=-1,r=Array(n);++e-1&&n%1==0&&nu?0:u+t),e=e>u?u:e,e<0&&(e+=u),u=t>e?0:e-t>>>0,t>>>=0;for(var i=Array(u);++r=r?n:Z(n,t,e)}function tn(n,t){for(var e=n.length;e--&&J(t,n[e],0)>-1;);return e}function en(n,t){for(var e=-1,r=n.length;++e-1;);return e}function rn(n){return n.split("")}function un(n){return Je.test(n)}function on(n){return n.match(hr)||[]}function cn(n){return un(n)?on(n):rn(n)}function fn(n){return null==n?"":Y(n)}function an(n,t,e){if(n=fn(n),n&&(e||void 0===t))return n.replace(yr,"");if(!n||!(t=Y(t)))return n;var r=cn(n),u=cn(t),i=en(r,u),o=tn(r,u)+1;return nn(r,i,o).join("")}function ln(n){return n=n.toString().replace(gr,""),n=n.match(vr)[2].replace(" ",""),n=n?n.split(dr):[],n=n.map(function(n){return an(n.replace(mr,""))})}function sn(n,t){var e={};N(n,function(n,t){function r(t,e){var r=K(u,function(n){return t[n]});r.push(e),a(n).apply(null,r)}var u,i=f(n),o=!i&&1===n.length||i&&0===n.length;if(Vt(n))u=n.slice(0,-1),n=n[n.length-1],e[t]=u.concat(u.length>0?r:n);else if(o)e[t]=n;else{if(u=ln(n),0===n.length&&!i&&0===u.length)throw new Error("autoInject task functions require explicit parameters.");i||u.pop(),e[t]=u.concat(r)}}),qe(e,t)}function pn(){this.head=this.tail=null,this.length=0}function hn(n,t){n.length=1,n.head=n.tail=t}function yn(n,t,e){function r(n,t,e){if(null!=e&&"function"!=typeof e)throw new Error("task callback must be a function");if(s.started=!0,Vt(n)||(n=[n]),0===n.length&&s.idle())return lt(function(){s.drain()});for(var r=0,u=n.length;r0&&c.splice(i,1),u.callback.apply(u,arguments),null!=t&&s.error(t,u.data)}o<=s.concurrency-s.buffer&&s.unsaturated(),s.idle()&&s.drain(),s.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var i=a(n),o=0,c=[],f=!1,l=!1,s={_tasks:new pn,concurrency:t,payload:e,saturated:m,unsaturated:m,buffer:t/4,empty:m,drain:m,error:m,started:!1,paused:!1,push:function(n,t){r(n,!1,t)},kill:function(){s.drain=m,s._tasks.empty()},unshift:function(n,t){r(n,!0,t)},remove:function(n){s._tasks.remove(n)},process:function(){if(!l){for(l=!0;!s.paused&&o2&&(i=t(arguments,1)),u[e]=i,r(n)})},function(n){r(n,u)})}function Dn(n,t){qn(Ie,n,t)}function Rn(n,t,e){qn(z(t),n,e)}function Cn(n,t){if(t=g(t||m),!Vt(n))return t(new TypeError("First argument to race must be an array of functions"));if(!n.length)return t();for(var e=0,r=n.length;er?1:0}var u=a(t);_e(n,function(n,t){u(n,function(e,r){return e?t(e):void t(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,K(t.sort(r),Fn("value")))})}function Xn(n,t,e){var r=a(n);return ct(function(u,i){function o(){var t=n.name||"anonymous",r=new Error('Callback function "'+t+'" timed out.');r.code="ETIMEDOUT",e&&(r.info=e),f=!0,i(r)}var c,f=!1;u.push(function(){f||(i.apply(null,arguments),clearTimeout(c))}),c=setTimeout(o,t),r.apply(null,u)})}function Yn(n,t,e,r){for(var u=-1,i=tu(nu((t-n)/(e||1)),0),o=Array(i);i--;)o[r?i:++u]=n,n+=e;return o}function Zn(n,t,e,r){var u=a(e);Ue(Yn(0,n,1),t,u,r)}function nt(n,t,e,r){arguments.length<=3&&(r=e,e=t,t=Vt(n)?[]:{}),r=g(r||m);var u=a(e);Ie(n,function(n,e,r){u(t,n,e,r)},function(n){r(n,t)})}function tt(n,e){var r,u=null;e=e||m,Fr(n,function(n,e){a(n)(function(n,i){r=arguments.length>2?t(arguments,1):i,u=n,e(!n)})},function(){e(u,r)})}function et(n){return function(){return(n.unmemoized||n).apply(null,arguments)}}function rt(n,e,r){r=U(r||m);var u=a(e);if(!n())return r(null);var i=function(e){if(e)return r(e);if(n())return u(i);var o=t(arguments,1);r.apply(null,[null].concat(o))};u(i)}function ut(n,t,e){rt(function(){return!n.apply(this,arguments)},t,e)}var it,ot=function(n){var e=t(arguments,1);return function(){var r=t(arguments);return n.apply(null,e.concat(r))}},ct=function(n){return function(){var e=t(arguments),r=e.pop();n.call(this,e,r)}},ft="function"==typeof setImmediate&&setImmediate,at="object"==typeof process&&"function"==typeof process.nextTick;it=ft?setImmediate:at?process.nextTick:r;var lt=u(it),st="function"==typeof Symbol,pt="object"==typeof global&&global&&global.Object===Object&&global,ht="object"==typeof self&&self&&self.Object===Object&&self,yt=pt||ht||Function("return this")(),vt=yt.Symbol,dt=Object.prototype,mt=dt.hasOwnProperty,gt=dt.toString,bt=vt?vt.toStringTag:void 0,jt=Object.prototype,St=jt.toString,kt="[object Null]",Lt="[object Undefined]",Ot=vt?vt.toStringTag:void 0,wt="[object AsyncFunction]",xt="[object Function]",Et="[object GeneratorFunction]",At="[object Proxy]",Tt=9007199254740991,Bt={},Ft="function"==typeof Symbol&&Symbol.iterator,It=function(n){return Ft&&n[Ft]&&n[Ft]()},_t="[object Arguments]",Mt=Object.prototype,Ut=Mt.hasOwnProperty,zt=Mt.propertyIsEnumerable,Pt=S(function(){return arguments}())?S:function(n){return j(n)&&Ut.call(n,"callee")&&!zt.call(n,"callee")},Vt=Array.isArray,qt="object"==typeof n&&n&&!n.nodeType&&n,Dt=qt&&"object"==typeof module&&module&&!module.nodeType&&module,Rt=Dt&&Dt.exports===qt,Ct=Rt?yt.Buffer:void 0,$t=Ct?Ct.isBuffer:void 0,Wt=$t||k,Nt=9007199254740991,Qt=/^(?:0|[1-9]\d*)$/,Gt="[object Arguments]",Ht="[object Array]",Jt="[object Boolean]",Kt="[object Date]",Xt="[object Error]",Yt="[object Function]",Zt="[object Map]",ne="[object Number]",te="[object Object]",ee="[object RegExp]",re="[object Set]",ue="[object String]",ie="[object WeakMap]",oe="[object ArrayBuffer]",ce="[object DataView]",fe="[object Float32Array]",ae="[object Float64Array]",le="[object Int8Array]",se="[object Int16Array]",pe="[object Int32Array]",he="[object Uint8Array]",ye="[object Uint8ClampedArray]",ve="[object Uint16Array]",de="[object Uint32Array]",me={};me[fe]=me[ae]=me[le]=me[se]=me[pe]=me[he]=me[ye]=me[ve]=me[de]=!0,me[Gt]=me[Ht]=me[oe]=me[Jt]=me[ce]=me[Kt]=me[Xt]=me[Yt]=me[Zt]=me[ne]=me[te]=me[ee]=me[re]=me[ue]=me[ie]=!1;var ge="object"==typeof n&&n&&!n.nodeType&&n,be=ge&&"object"==typeof module&&module&&!module.nodeType&&module,je=be&&be.exports===ge,Se=je&&pt.process,ke=function(){try{return Se&&Se.binding("util")}catch(n){}}(),Le=ke&&ke.isTypedArray,Oe=Le?w(Le):O,we=Object.prototype,xe=we.hasOwnProperty,Ee=Object.prototype,Ae=A(Object.keys,Object),Te=Object.prototype,Be=Te.hasOwnProperty,Fe=V(P,1/0),Ie=function(n,t,e){var r=d(n)?q:Fe;r(n,a(t),e)},_e=D(R),Me=l(_e),Ue=C(R),ze=V(Ue,1),Pe=l(ze),Ve=W(),qe=function(n,e,r){function u(n,t){j.push(function(){f(n,t)})}function i(){if(0===j.length&&0===v)return r(null,y);for(;j.length&&v2&&(u=t(arguments,1)),e){var i={};N(y,function(n,t){i[t]=n}),i[n]=u,d=!0,b=Object.create(null),r(e,i)}else y[n]=u,c(n)});v++;var i=a(e[e.length-1]);e.length>1?i(y,u):i(u)}}function l(){for(var n,t=0;S.length;)n=S.pop(),t++,$(s(n),function(n){0===--k[n]&&S.push(n)});if(t!==h)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function s(t){var e=[];return N(n,function(n,r){Vt(n)&&J(n,t,0)>=0&&e.push(r)}),e}"function"==typeof e&&(r=e,e=null),r=g(r||m);var p=B(n),h=p.length;if(!h)return r(null);e||(e=h);var y={},v=0,d=!1,b=Object.create(null),j=[],S=[],k={};N(n,function(t,e){if(!Vt(t))return u(e,[t]),void S.push(e);var r=t.slice(0,t.length-1),i=r.length;return 0===i?(u(e,t),void S.push(e)):(k[e]=i,void $(r,function(c){if(!n[c])throw new Error("async.auto task `"+e+"` has a non-existent dependency `"+c+"` in "+r.join(", "));o(c,function(){i--,0===i&&u(e,t)})}))}),l(),i()},De="[object Symbol]",Re=1/0,Ce=vt?vt.prototype:void 0,$e=Ce?Ce.toString:void 0,We="\\ud800-\\udfff",Ne="\\u0300-\\u036f\\ufe20-\\ufe23",Qe="\\u20d0-\\u20f0",Ge="\\ufe0e\\ufe0f",He="\\u200d",Je=RegExp("["+He+We+Ne+Qe+Ge+"]"),Ke="\\ud800-\\udfff",Xe="\\u0300-\\u036f\\ufe20-\\ufe23",Ye="\\u20d0-\\u20f0",Ze="\\ufe0e\\ufe0f",nr="["+Ke+"]",tr="["+Xe+Ye+"]",er="\\ud83c[\\udffb-\\udfff]",rr="(?:"+tr+"|"+er+")",ur="[^"+Ke+"]",ir="(?:\\ud83c[\\udde6-\\uddff]){2}",or="[\\ud800-\\udbff][\\udc00-\\udfff]",cr="\\u200d",fr=rr+"?",ar="["+Ze+"]?",lr="(?:"+cr+"(?:"+[ur,ir,or].join("|")+")"+ar+fr+")*",sr=ar+fr+lr,pr="(?:"+[ur+tr+"?",tr,ir,or,nr].join("|")+")",hr=RegExp(er+"(?="+er+")|"+pr+sr,"g"),yr=/^\s+|\s+$/g,vr=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,dr=/,/,mr=/(=.+)?(\s*)$/,gr=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;pn.prototype.removeLink=function(n){return n.prev?n.prev.next=n.next:this.head=n.next,n.next?n.next.prev=n.prev:this.tail=n.prev,n.prev=n.next=null,this.length-=1,n},pn.prototype.empty=function(){for(;this.head;)this.shift();return this},pn.prototype.insertAfter=function(n,t){t.prev=n,t.next=n.next,n.next?n.next.prev=t:this.tail=t,n.next=t,this.length+=1},pn.prototype.insertBefore=function(n,t){t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:this.head=t,n.prev=t,this.length+=1},pn.prototype.unshift=function(n){this.head?this.insertBefore(this.head,n):hn(this,n)},pn.prototype.push=function(n){this.tail?this.insertAfter(this.tail,n):hn(this,n)},pn.prototype.shift=function(){return this.head&&this.removeLink(this.head)},pn.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},pn.prototype.toArray=function(){for(var n=Array(this.length),t=this.head,e=0;e=u.priority;)u=u.next;for(var i=0,o=n.length;i