rbbt-rest 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/workflow.rb +12 -1
- data/lib/rbbt/rest/workflow/jobs.rb +3 -0
- data/share/views/layout/coda.haml +3 -1
- data/share/views/layout/header.haml +3 -2
- data/share/views/public/plugins/mithril/js/mithril.js +1024 -0
- data/share/views/public/plugins/mithril/js/mithril.min.js +8 -0
- data/share/views/public/plugins/mithril/js/mithril.min.js.map +1 -0
- data/share/views/public/plugins/requirejs/js/require.js +2083 -0
- data/share/views/tools/protein_tool.haml +15 -7
- metadata +6 -2
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
Mithril v0.1.30
|
3
|
+
http://github.com/lhorie/mithril.js
|
4
|
+
(c) Leo Horie
|
5
|
+
License: MIT
|
6
|
+
*/
|
7
|
+
var m=function a(b,c){function d(a){C=a.document,D=a.location,F=a.cancelAnimationFrame||a.clearTimeout,E=a.requestAnimationFrame||a.setTimeout}function e(){var a,b=[].slice.call(arguments),c=!(null==b[1]||K.call(b[1])!==G||"tag"in b[1]||"subtree"in b[1]),d=c?b[1]:{},e="class"in d?"class":"className",f={tag:"div",attrs:{}},g=[];if(K.call(b[0])!=I)throw new Error("selector in m(selector, attrs, children) should be a string");for(;a=L.exec(b[0]);)if(""===a[1]&&a[2])f.tag=a[2];else if("#"===a[1])f.attrs.id=a[2];else if("."===a[1])g.push(a[2]);else if("["===a[3][0]){var h=M.exec(a[3]);f.attrs[h[1]]=h[3]||(h[2]?"":!0)}g.length>0&&(f.attrs[e]=g.join(" "));var i=c?b[2]:b[1];f.children=K.call(i)===H?i:b.slice(c?2:1);for(var j in d)j===e?""!==d[j]&&(f.attrs[j]=(f.attrs[j]||"")+" "+d[j]):f.attrs[j]=d[j];return f}function f(a,b,d,e,j,l,m,n,o,p,q){if((null==j||null==j.toString())&&(j=""),"retain"===j.subtree)return l;var r=K.call(l),s=K.call(j);if(null==l||r!==s){if(null!=l)if(d&&d.nodes){var t=n-e,u=t+(s===H?j:l.nodes).length;i(d.nodes.slice(t,u),d.slice(t,u))}else l.nodes&&i(l.nodes,l);l=new j.constructor,l.tag&&(l={}),l.nodes=[]}if(s===H){for(var v=0,w=j.length;w>v;v++)K.call(j[v])===H&&(j=j.concat.apply([],j),v--);for(var x=[],y=l.length===j.length,z=0,A=1,B=2,D=3,E={},F=[],L=!1,v=0;v<l.length;v++)l[v]&&l[v].attrs&&null!=l[v].attrs.key&&(L=!0,E[l[v].attrs.key]={action:A,index:v});if(L){j.indexOf(null)>-1&&(j=j.filter(function(a){return null!=a}));var M=!1;if(j.length!=l.length)M=!0;else for(var O,P,v=0;O=l[v],P=j[v];v++)if(O.attrs&&P.attrs&&O.attrs.key!=P.attrs.key){M=!0;break}if(M){for(var v=0,w=j.length;w>v;v++)if(j[v]&&j[v].attrs)if(null!=j[v].attrs.key){var Q=j[v].attrs.key;E[Q]=E[Q]?{action:D,index:v,from:E[Q].index,element:l.nodes[E[Q].index]||C.createElement("div")}:{action:B,index:v}}else F.push({index:v,element:a.childNodes[v]||C.createElement("div")});var R=[];for(var S in E)R.push(E[S]);for(var T,U=R.sort(g),V=new Array(l.length),v=0;T=U[v];v++){if(T.action===A&&(i(l[T.index].nodes,l[T.index]),V.splice(T.index,1)),T.action===B){var W=C.createElement("div");W.key=j[T.index].attrs.key,a.insertBefore(W,a.childNodes[T.index]||null),V.splice(T.index,0,{attrs:{key:j[T.index].attrs.key},nodes:[W]})}T.action===D&&(a.childNodes[T.index]!==T.element&&null!==T.element&&a.insertBefore(T.element,a.childNodes[T.index]||null),V[T.index]=l[T.from])}for(var v=0,w=F.length;w>v;v++){var T=F[v];a.insertBefore(T.element,a.childNodes[T.index]||null),V[T.index]=l[T.index]}l=V,l.nodes=new Array(a.childNodes.length);for(var X,v=0;X=a.childNodes[v];v++)l.nodes[v]=X}}for(var v=0,Y=0,w=j.length;w>v;v++){var Z=f(a,b,l,n,j[v],l[Y],m,n+z||z,o,p,q);Z!==c&&(Z.nodes.intact||(y=!1),z+=Z.$trusted?(Z.match(/<[^\/]|\>\s*[^<]/g)||[]).length:K.call(Z)===H?Z.length:1,l[Y++]=Z)}if(!y){for(var v=0,w=j.length;w>v;v++)null!=l[v]&&x.push.apply(x,l[v].nodes);for(var $,v=0;$=l.nodes[v];v++)null!=$.parentNode&&x.indexOf($)<0&&i([$],[l[v]]);j.length<l.length&&(l.length=j.length),l.nodes=x}}else if(null!=j&&s===G){j.attrs||(j.attrs={}),l.attrs||(l.attrs={});var _=Object.keys(j.attrs),ab=_.length>("key"in j.attrs?1:0);if((j.tag!=l.tag||_.join()!=Object.keys(l.attrs).join()||j.attrs.id!=l.attrs.id)&&(l.nodes.length&&i(l.nodes),l.configContext&&typeof l.configContext.onunload===J&&l.configContext.onunload()),K.call(j.tag)!=I)return;var $,bb=0===l.nodes.length;if(j.attrs.xmlns?p=j.attrs.xmlns:"svg"===j.tag?p="http://www.w3.org/2000/svg":"math"===j.tag&&(p="http://www.w3.org/1998/Math/MathML"),bb?($=j.attrs.is?p===c?C.createElement(j.tag,j.attrs.is):C.createElementNS(p,j.tag,j.attrs.is):p===c?C.createElement(j.tag):C.createElementNS(p,j.tag),l={tag:j.tag,attrs:ab?h($,j.tag,j.attrs,{},p):j.attrs,children:null!=j.children&&j.children.length>0?f($,j.tag,c,c,j.children,l.children,!0,0,j.attrs.contenteditable?$:o,p,q):j.children,nodes:[$]},l.children&&!l.children.nodes&&(l.children.nodes=[]),"select"===j.tag&&j.attrs.value&&h($,j.tag,{value:j.attrs.value},{},p),a.insertBefore($,a.childNodes[n]||null)):($=l.nodes[0],ab&&h($,j.tag,j.attrs,l.attrs,p),l.children=f($,j.tag,c,c,j.children,l.children,!1,0,j.attrs.contenteditable?$:o,p,q),l.nodes.intact=!0,m===!0&&null!=$&&a.insertBefore($,a.childNodes[n]||null)),typeof j.attrs.config===J){var cb=l.configContext=l.configContext||{},db=function(a,b){return function(){return a.attrs.config.apply(a,b)}};q.push(db(j,[$,!bb,cb,l]))}}else if(typeof s!=J){var x;0===l.nodes.length?(j.$trusted?x=k(a,n,j):(x=[C.createTextNode(j)],a.nodeName.match(N)||a.insertBefore(x[0],a.childNodes[n]||null)),l="string number boolean".indexOf(typeof j)>-1?new j.constructor(j):j,l.nodes=x):l.valueOf()!==j.valueOf()||m===!0?(x=l.nodes,o&&o===C.activeElement||(j.$trusted?(i(x,l),x=k(a,n,j)):"textarea"===b?a.value=j:o?o.innerHTML=j:((1===x[0].nodeType||x.length>1)&&(i(l.nodes,l),x=[C.createTextNode(j)]),a.insertBefore(x[0],a.childNodes[n]||null),x[0].nodeValue=j)),l=new j.constructor(j),l.nodes=x):l.nodes.intact=!0}return l}function g(a,b){return a.action-b.action||a.index-b.index}function h(a,b,c,d,e){for(var f in c){var g=c[f],h=d[f];if(f in d&&h===g)"value"===f&&"input"===b&&a.value!=g&&(a.value=g);else{d[f]=g;try{if("config"===f||"key"==f)continue;if(typeof g===J&&0===f.indexOf("on"))a[f]=l(g,a);else if("style"===f&&null!=g&&K.call(g)===G){for(var i in g)(null==h||h[i]!==g[i])&&(a.style[i]=g[i]);for(var i in h)i in g||(a.style[i]="")}else null!=e?"href"===f?a.setAttributeNS("http://www.w3.org/1999/xlink","href",g):"className"===f?a.setAttribute("class",g):a.setAttribute(f,g):f in a&&"list"!==f&&"style"!==f&&"form"!==f&&"type"!==f?("input"!==b||a[f]!==g)&&(a[f]=g):a.setAttribute(f,g)}catch(j){if(j.message.indexOf("Invalid argument")<0)throw j}}}return d}function i(a,b){for(var c=a.length-1;c>-1;c--)if(a[c]&&a[c].parentNode){try{a[c].parentNode.removeChild(a[c])}catch(d){}b=[].concat(b),b[c]&&j(b[c])}0!=a.length&&(a.length=0)}function j(a){if(a.configContext&&typeof a.configContext.onunload===J&&a.configContext.onunload(),a.children)if(K.call(a.children)===H)for(var b,c=0;b=a.children[c];c++)j(b);else a.children.tag&&j(a.children)}function k(a,b,c){var d=a.childNodes[b];if(d){var e=1!=d.nodeType,f=C.createElement("span");e?(a.insertBefore(f,d||null),f.insertAdjacentHTML("beforebegin",c),a.removeChild(f)):d.insertAdjacentHTML("beforebegin",c)}else a.insertAdjacentHTML("beforeend",c);for(var g=[];a.childNodes[b]!==d;)g.push(a.childNodes[b]),b++;return g}function l(a,b){return function(c){c=c||event,e.redraw.strategy("diff"),e.startComputation();try{return a.call(b,c)}finally{ab()}}}function m(a){var b=Q.indexOf(a);return 0>b?Q.push(a)-1:b}function n(a){var b=function(){return arguments.length&&(a=arguments[0]),a};return b.toJSON=function(){return a},b}function o(){for(var a,b="all"===e.redraw.strategy(),c=0;a=T[c];c++)V[c]&&e.render(a,U[c].view?U[c].view(V[c]):$(),b);Y&&(Y(),Y=null),W=null,X=new Date,e.redraw.strategy("diff")}function p(a){return a.slice(db[e.route.mode].length)}function q(a,b,c){bb={};var d=c.indexOf("?");-1!==d&&(bb=u(c.substr(d+1,c.length)),c=c.substr(0,d));for(var f in b){if(f===c)return e.module(a,b[f]),!0;var g=new RegExp("^"+f.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(g.test(c))return c.replace(g,function(){for(var c=f.match(/:[^\/]+/g)||[],d=[].slice.call(arguments,1,-2),g=0,h=c.length;h>g;g++)bb[c[g].replace(/:|\./g,"")]=decodeURIComponent(d[g]);e.module(a,b[f])}),!0}}function r(a){if(a=a||event,!a.ctrlKey&&!a.metaKey&&2!==a.which){a.preventDefault?a.preventDefault():a.returnValue=!1;var b=a.currentTarget||this,c="pathname"===e.route.mode&&b.search?u(b.search.slice(1)):{};e.route(b[e.route.mode].slice(db[e.route.mode].length),c)}}function s(){"hash"!=e.route.mode&&D.hash?D.hash=D.hash:b.scrollTo(0,0)}function t(a,b){var c=[];for(var d in a){var e=b?b+"["+d+"]":d,f=a[d],g=K.call(f),h=null!=f&&g===G?t(f,e):g===H?f.map(function(a){return encodeURIComponent(e+"[]")+"="+encodeURIComponent(a)}).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(f);c.push(h)}return c.join("&")}function u(a){for(var b=a.split("&"),c={},d=0,e=b.length;e>d;d++){var f=b[d].split("=");c[decodeURIComponent(f[0])]=f[1]?decodeURIComponent(f[1]):""}return c}function v(a){var b=m(a);i(a.childNodes,R[b]),R[b]=c}function w(a){var b=e.prop();return a.then(b),b.then=function(b,c){return w(a.then(b,c))},b}function x(a,b){function c(a){l=a||j,n.map(function(a){l===i&&a.resolve(m)||a.reject(m)})}function d(a,b,c,d){if((null!=m&&K.call(m)===G||typeof m===J)&&typeof a===J)try{var f=0;a.call(m,function(a){f++||(m=a,b())},function(a){f++||(m=a,c())})}catch(g){e.deferred.onerror(g),m=g,c()}else d()}function f(){var j;try{j=m&&m.then}catch(n){return e.deferred.onerror(n),m=n,l=h,f()}d(j,function(){l=g,f()},function(){l=h,f()},function(){try{l===g&&typeof a===J?m=a(m):l===h&&"function"==typeof b&&(m=b(m),l=g)}catch(f){return e.deferred.onerror(f),m=f,c()}m===k?(m=TypeError(),c()):d(j,function(){c(i)},c,function(){c(l===g&&i)})})}var g=1,h=2,i=3,j=4,k=this,l=0,m=0,n=[];k.promise={},k.resolve=function(a){return l||(m=a,l=g,f()),this},k.reject=function(a){return l||(m=a,l=h,f()),this},k.promise.then=function(a,b){var c=new x(a,b);return l===i?c.resolve(m):l===j?c.reject(m):n.push(c),c.promise}}function y(a){return a}function z(a){if(!a.dataType||"jsonp"!==a.dataType.toLowerCase()){var d=new b.XMLHttpRequest;if(d.open(a.method,a.url,!0,a.user,a.password),d.onreadystatechange=function(){4===d.readyState&&(d.status>=200&&d.status<300?a.onload({type:"load",target:d}):a.onerror({type:"error",target:d}))},a.serialize===JSON.stringify&&a.data&&"GET"!==a.method&&d.setRequestHeader("Content-Type","application/json; charset=utf-8"),a.deserialize===JSON.parse&&d.setRequestHeader("Accept","application/json, text/*"),typeof a.config===J){var e=a.config(d,a);null!=e&&(d=e)}var f="GET"!==a.method&&a.data?a.data:"";if(f&&K.call(f)!=I&&f.constructor!=b.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return d.send(f),d}var g="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),h=C.createElement("script");b[g]=function(d){h.parentNode.removeChild(h),a.onload({type:"load",target:{responseText:d}}),b[g]=c},h.onerror=function(){return h.parentNode.removeChild(h),a.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),b[g]=c,!1},h.onload=function(){return!1},h.src=a.url+(a.url.indexOf("?")>0?"&":"?")+(a.callbackKey?a.callbackKey:"callback")+"="+g+"&"+t(a.data||{}),C.body.appendChild(h)}function A(a,b,c){if("GET"===a.method&&"jsonp"!=a.dataType){var d=a.url.indexOf("?")<0?"?":"&",e=t(b);a.url=a.url+(e?d+e:"")}else a.data=c(b);return a}function B(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;d<c.length;d++){var e=c[d].slice(1);a=a.replace(c[d],b[e]),delete b[e]}return a}var C,D,E,F,G="[object Object]",H="[object Array]",I="[object String]",J="function",K={}.toString,L=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,M=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,N=/^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;d(b);var O,P={appendChild:function(a){O===c&&(O=C.createElement("html")),C.documentElement&&C.documentElement!==a?C.replaceChild(a,C.documentElement):C.appendChild(a),this.childNodes=C.childNodes},insertBefore:function(a){this.appendChild(a)},childNodes:[]},Q=[],R={};e.render=function(a,b,d){var e=[];if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var g=m(a),h=a===C,j=h||a===C.documentElement?P:a;h&&"html"!=b.tag&&(b={tag:"html",attrs:{},children:b}),R[g]===c&&i(j.childNodes),d===!0&&v(a),R[g]=f(j,null,c,c,b,R[g],!1,0,null,c,e);for(var k=0,l=e.length;l>k;k++)e[k]()},e.trust=function(a){return a=new String(a),a.$trusted=!0,a},e.prop=function(a){return(null!=a&&K.call(a)===G||typeof a===J)&&typeof a.then===J?w(a):n(a)};var S,T=[],U=[],V=[],W=null,X=0,Y=null,Z=16;e.module=function(a,b){if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var c=T.indexOf(a);0>c&&(c=T.length);var d=!1;if(V[c]&&typeof V[c].onunload===J){var f={preventDefault:function(){d=!0}};V[c].onunload(f)}if(!d){e.redraw.strategy("all"),e.startComputation(),T[c]=a;var g=S=b=b||{},h=new(b.controller||function(){});return g===S&&(V[c]=h,U[c]=b),ab(),V[c]}},e.redraw=function(a){W&&a!==!0?(new Date-X>Z||E===b.requestAnimationFrame)&&(W>0&&F(W),W=E(o,Z)):(o(),W=E(function(){W=null},Z))},e.redraw.strategy=e.prop();var $=function(){return""},_=0;e.startComputation=function(){_++},e.endComputation=function(){_=Math.max(_-1,0),0===_&&e.redraw()};var ab=function(){"none"==e.redraw.strategy()?(_--,e.redraw.strategy("diff")):e.endComputation()};e.withAttr=function(a,b){return function(c){c=c||event;var d=c.currentTarget||this;b(a in d?d[a]:d.getAttribute(a))}};var bb,cb,db={pathname:"",hash:"#",search:"?"},eb=function(){};return e.route=function(){if(0===arguments.length)return cb;if(3===arguments.length&&K.call(arguments[1])===I){var a=arguments[0],c=arguments[1],d=arguments[2];eb=function(b){var f=cb=p(b);q(a,d,f)||e.route(c,!0)};var f="hash"===e.route.mode?"onhashchange":"onpopstate";b[f]=function(){var a=D[e.route.mode];"pathname"===e.route.mode&&(a+=D.search),cb!=p(a)&&eb(a)},Y=s,b[f]()}else if(arguments[0].addEventListener){{var g=arguments[0];arguments[1],arguments[2]}g.href=("pathname"!==e.route.mode?D.pathname:"")+db[e.route.mode]+this.attrs.href,g.removeEventListener("click",r),g.addEventListener("click",r)}else if(K.call(arguments[0])===I){var h=cb;cb=arguments[0];var i=arguments[1]||{},j=cb.indexOf("?"),k=j>-1?u(cb.slice(j+1)):{};for(var l in i)k[l]=i[l];var m=t(k),n=j>-1?cb.slice(0,j):cb;m&&(cb=n+(-1===n.indexOf("?")?"?":"&")+m);var o=(3===arguments.length?arguments[2]:arguments[1])===!0||h===arguments[0];b.history.pushState?(Y=function(){b.history[o?"replaceState":"pushState"](null,C.title,db[e.route.mode]+cb),s()},eb(db[e.route.mode]+cb)):D[e.route.mode]=cb}},e.route.param=function(a){if(!bb)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return bb[a]},e.route.mode="search",e.deferred=function(){var a=new x;return a.promise=w(a.promise),a},e.deferred.onerror=function(a){if("[object Error]"===K.call(a)&&!a.constructor.toString().match(/ Error/))throw a},e.sync=function(a){function b(a,b){return function(e){return g[a]=e,b||(c="reject"),0===--f&&(d.promise(g),d[c](g)),e}}var c="resolve",d=e.deferred(),f=a.length,g=new Array(f);if(a.length>0)for(var h=0;h<a.length;h++)a[h].then(b(h,!0),b(h,!1));else d.resolve([]);return d.promise},e.request=function(a){a.background!==!0&&e.startComputation();var b=e.deferred(),c=a.dataType&&"jsonp"===a.dataType.toLowerCase(),d=a.serialize=c?y:a.serialize||JSON.stringify,f=a.deserialize=c?y:a.deserialize||JSON.parse,g=a.extract||function(a){return 0===a.responseText.length&&f===JSON.parse?null:a.responseText};return a.url=B(a.url,a.data),a=A(a,a.data,d),a.onload=a.onerror=function(c){try{c=c||event;var d=("load"===c.type?a.unwrapSuccess:a.unwrapError)||y,h=d(f(g(c.target,a)));if("load"===c.type)if(K.call(h)===H&&a.type)for(var i=0;i<h.length;i++)h[i]=new a.type(h[i]);else a.type&&(h=new a.type(h));b["load"===c.type?"resolve":"reject"](h)}catch(c){e.deferred.onerror(c),b.reject(c)}a.background!==!0&&e.endComputation()},z(a),b.promise(a.initialValue),b.promise},e.deps=function(a){return d(b=a||b),b},e.deps.factory=a,e}("undefined"!=typeof window?window:{});"undefined"!=typeof module&&null!==module&&module.exports?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m});
|
8
|
+
//# sourceMappingURL=mithril.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mithril.min.js","sources":["mithril.js"],"names":["m","app","window","undefined","initialize","$document","document","$location","location","$cancelAnimationFrame","cancelAnimationFrame","clearTimeout","$requestAnimationFrame","requestAnimationFrame","setTimeout","match","args","slice","call","arguments","hasAttrs","type","OBJECT","attrs","classAttrName","cell","tag","classes","STRING","Error","parser","exec","id","push","pair","attrParser","length","join","children","ARRAY","attrName","build","parentElement","parentTag","parentCache","parentIndex","data","cached","shouldReattach","index","editable","namespace","configs","toString","subtree","cachedType","dataType","nodes","offset","end","clear","constructor","i","len","concat","apply","intact","subArrayCount","DELETION","INSERTION","MOVE","existing","unkeyed","shouldMaintainIdentities","key","action","indexOf","filter","x","keysDiffer","cachedCell","dataCell","from","element","createElement","childNodes","actions","prop","change","changes","sort","sortChanges","newCached","Array","splice","dummy","insertBefore","child","cacheCount","item","$trusted","node","parentNode","dataAttrKeys","Object","keys","hasKeys","configContext","onunload","FUNCTION","isNew","xmlns","is","createElementNS","setAttributes","contenteditable","value","context","callback","injectHTML","createTextNode","nodeName","voidElements","valueOf","activeElement","innerHTML","nodeType","nodeValue","a","b","dataAttrs","cachedAttrs","dataAttr","cachedAttr","autoredraw","rule","style","setAttributeNS","setAttribute","e","message","removeChild","unload","nextSibling","isElement","placeholder","insertAdjacentHTML","object","event","redraw","strategy","startComputation","endFirstComputation","getCellCacheKey","nodeCache","gettersetter","store","toJSON","root","forceRedraw","roots","controllers","render","modules","view","blank","computePostRedrawHook","lastRedrawId","lastRedrawCallTime","Date","normalizeRoute","route","modes","mode","routeByValue","router","path","routeParams","queryStart","parseQueryString","substr","module","matcher","RegExp","replace","test","values","decodeURIComponent","routeUnobtrusive","ctrlKey","metaKey","which","preventDefault","returnValue","currentTarget","this","search","setScroll","hash","scrollTo","buildQueryString","prefix","str","valueType","map","encodeURIComponent","pairs","split","params","reset","cacheKey","cellCache","propify","promise","then","resolve","reject","Deferred","successCallback","failureCallback","finish","state","REJECTED","next","deferred","RESOLVED","promiseValue","thennable","notThennableCallback","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","ajax","options","toLowerCase","xhr","XMLHttpRequest","open","method","url","user","password","onreadystatechange","readyState","status","onload","target","serialize","JSON","stringify","setRequestHeader","deserialize","parse","config","maybeXhr","FormData","send","callbackKey","getTime","Math","round","random","script","resp","responseText","error","src","body","appendChild","bindData","xhrOptions","querystring","parameterizeUrl","tokens","html","documentNode","documentElement","replaceChild","forceRecreation","isDocumentRoot","trust","String","topModule","FRAME_BUDGET","isPrevented","currentModule","controller","force","pendingRequests","endComputation","max","withAttr","withAttrCallback","getAttribute","currentRoute","pathname","redirect","defaultRoute","source","listener","addEventListener","href","removeEventListener","oldRoute","queryIndex","currentPath","shouldReplaceHistoryEntry","history","pushState","title","param","sync","synchronizer","pos","resolved","results","outstanding","request","background","isJSONP","extract","unwrap","unwrapSuccess","unwrapError","response","initialValue","deps","mock","factory","exports","define","amd"],"mappings":";;;;;;AAAA,GAAIA,GAAI,QAAUC,GAAIC,EAAQC,GAU7B,QAASC,GAAWF,GACnBG,EAAYH,EAAOI,SACnBC,EAAYL,EAAOM,SACnBC,EAAwBP,EAAOQ,sBAAwBR,EAAOS,aAC9DC,EAAyBV,EAAOW,uBAAyBX,EAAOY,WAmBjE,QAASd,KACR,GAKIe,GALAC,KAAUC,MAAMC,KAAKC,WACrBC,IAAsB,MAAXJ,EAAK,IAAcK,EAAKH,KAAKF,EAAK,MAAQM,GAAY,OAASN,GAAK,IAAS,WAAaA,GAAK,IAC1GO,EAAQH,EAAWJ,EAAK,MACxBQ,EAAgB,SAAWD,GAAQ,QAAU,YAC7CE,GAAQC,IAAK,MAAOH,UACbI,IACX,IAAIN,EAAKH,KAAKF,EAAK,KAAOY,EAAQ,KAAM,IAAIC,OAAM,8DAClD,MAAOd,EAAQe,EAAOC,KAAKf,EAAK,KAC/B,GAAiB,KAAbD,EAAM,IAAaA,EA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KuT,KAAclS,GAAS4O,EAAW9P,KAC/C,IAAK,GAAIyC,GAAI,EAAGA,EAAI2Q,EAASrS,OAAQ0B,IAAK2Q,EAAS3Q,GAAK,GAAIqN,GAAW9P,KAAKoT,EAAS3Q,QAE7EqN,GAAW9P,OAAMoT,EAAW,GAAItD,GAAW9P,KAAKoT,GAE1DzG,GAAoB,SAAXrF,EAAEtH,KAAkB,UAAY,UAAUoT,GAEpD,MAAO9L,GACN3I,EAAEgO,SAASM,QAAQ3F,GACnBqF,EAASR,OAAO7E,GAEbwI,EAAWgD,cAAe,GAAMnU,EAAEsS,kBAEvCzD,EAAKsC,GACLnD,EAASX,QAAQ8D,EAAWuD,cACrB1G,EAASX,SAIjBrN,EAAE2U,KAAO,SAASC,GAEjB,MADAxU,GAAWF,EAAS0U,GAAQ1U,GACrBA,GAGRF,EAAE2U,KAAKE,QAAU5U,EAEVD,GACY,mBAAVE,QAAwBA,UAEb,oBAAVmL,SAAoC,OAAXA,QAAmBA,OAAOyJ,QAASzJ,OAAOyJ,QAAU9U,EAC7D,kBAAX+U,SAAyBA,OAAOC,KAAKD,OAAO,WAAY,MAAO/U"}
|
@@ -0,0 +1,2083 @@
|
|
1
|
+
/** vim: et:ts=4:sw=4:sts=4
|
2
|
+
* @license RequireJS 2.1.16 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
|
3
|
+
* Available via the MIT or new BSD license.
|
4
|
+
* see: http://github.com/jrburke/requirejs for details
|
5
|
+
*/
|
6
|
+
//Not using strict: uneven strict support in browsers, #392, and causes
|
7
|
+
//problems with requirejs.exec()/transpiler plugins that may not be strict.
|
8
|
+
/*jslint regexp: true, nomen: true, sloppy: true */
|
9
|
+
/*global window, navigator, document, importScripts, setTimeout, opera */
|
10
|
+
|
11
|
+
var requirejs, require, define;
|
12
|
+
(function (global) {
|
13
|
+
var req, s, head, baseElement, dataMain, src,
|
14
|
+
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
15
|
+
version = '2.1.16',
|
16
|
+
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
17
|
+
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
18
|
+
jsSuffixRegExp = /\.js$/,
|
19
|
+
currDirRegExp = /^\.\//,
|
20
|
+
op = Object.prototype,
|
21
|
+
ostring = op.toString,
|
22
|
+
hasOwn = op.hasOwnProperty,
|
23
|
+
ap = Array.prototype,
|
24
|
+
apsp = ap.splice,
|
25
|
+
isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
|
26
|
+
isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
|
27
|
+
//PS3 indicates loaded and complete, but need to wait for complete
|
28
|
+
//specifically. Sequence is 'loading', 'loaded', execution,
|
29
|
+
// then 'complete'. The UA check is unfortunate, but not sure how
|
30
|
+
//to feature test w/o causing perf issues.
|
31
|
+
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
|
32
|
+
/^complete$/ : /^(complete|loaded)$/,
|
33
|
+
defContextName = '_',
|
34
|
+
//Oh the tragedy, detecting opera. See the usage of isOpera for reason.
|
35
|
+
isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
|
36
|
+
contexts = {},
|
37
|
+
cfg = {},
|
38
|
+
globalDefQueue = [],
|
39
|
+
useInteractive = false;
|
40
|
+
|
41
|
+
function isFunction(it) {
|
42
|
+
return ostring.call(it) === '[object Function]';
|
43
|
+
}
|
44
|
+
|
45
|
+
function isArray(it) {
|
46
|
+
return ostring.call(it) === '[object Array]';
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Helper function for iterating over an array. If the func returns
|
51
|
+
* a true value, it will break out of the loop.
|
52
|
+
*/
|
53
|
+
function each(ary, func) {
|
54
|
+
if (ary) {
|
55
|
+
var i;
|
56
|
+
for (i = 0; i < ary.length; i += 1) {
|
57
|
+
if (ary[i] && func(ary[i], i, ary)) {
|
58
|
+
break;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Helper function for iterating over an array backwards. If the func
|
66
|
+
* returns a true value, it will break out of the loop.
|
67
|
+
*/
|
68
|
+
function eachReverse(ary, func) {
|
69
|
+
if (ary) {
|
70
|
+
var i;
|
71
|
+
for (i = ary.length - 1; i > -1; i -= 1) {
|
72
|
+
if (ary[i] && func(ary[i], i, ary)) {
|
73
|
+
break;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
function hasProp(obj, prop) {
|
80
|
+
return hasOwn.call(obj, prop);
|
81
|
+
}
|
82
|
+
|
83
|
+
function getOwn(obj, prop) {
|
84
|
+
return hasProp(obj, prop) && obj[prop];
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Cycles over properties in an object and calls a function for each
|
89
|
+
* property value. If the function returns a truthy value, then the
|
90
|
+
* iteration is stopped.
|
91
|
+
*/
|
92
|
+
function eachProp(obj, func) {
|
93
|
+
var prop;
|
94
|
+
for (prop in obj) {
|
95
|
+
if (hasProp(obj, prop)) {
|
96
|
+
if (func(obj[prop], prop)) {
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Simple function to mix in properties from source into target,
|
105
|
+
* but only if target does not already have a property of the same name.
|
106
|
+
*/
|
107
|
+
function mixin(target, source, force, deepStringMixin) {
|
108
|
+
if (source) {
|
109
|
+
eachProp(source, function (value, prop) {
|
110
|
+
if (force || !hasProp(target, prop)) {
|
111
|
+
if (deepStringMixin && typeof value === 'object' && value &&
|
112
|
+
!isArray(value) && !isFunction(value) &&
|
113
|
+
!(value instanceof RegExp)) {
|
114
|
+
|
115
|
+
if (!target[prop]) {
|
116
|
+
target[prop] = {};
|
117
|
+
}
|
118
|
+
mixin(target[prop], value, force, deepStringMixin);
|
119
|
+
} else {
|
120
|
+
target[prop] = value;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
});
|
124
|
+
}
|
125
|
+
return target;
|
126
|
+
}
|
127
|
+
|
128
|
+
//Similar to Function.prototype.bind, but the 'this' object is specified
|
129
|
+
//first, since it is easier to read/figure out what 'this' will be.
|
130
|
+
function bind(obj, fn) {
|
131
|
+
return function () {
|
132
|
+
return fn.apply(obj, arguments);
|
133
|
+
};
|
134
|
+
}
|
135
|
+
|
136
|
+
function scripts() {
|
137
|
+
return document.getElementsByTagName('script');
|
138
|
+
}
|
139
|
+
|
140
|
+
function defaultOnError(err) {
|
141
|
+
throw err;
|
142
|
+
}
|
143
|
+
|
144
|
+
//Allow getting a global that is expressed in
|
145
|
+
//dot notation, like 'a.b.c'.
|
146
|
+
function getGlobal(value) {
|
147
|
+
if (!value) {
|
148
|
+
return value;
|
149
|
+
}
|
150
|
+
var g = global;
|
151
|
+
each(value.split('.'), function (part) {
|
152
|
+
g = g[part];
|
153
|
+
});
|
154
|
+
return g;
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Constructs an error with a pointer to an URL with more information.
|
159
|
+
* @param {String} id the error ID that maps to an ID on a web page.
|
160
|
+
* @param {String} message human readable error.
|
161
|
+
* @param {Error} [err] the original error, if there is one.
|
162
|
+
*
|
163
|
+
* @returns {Error}
|
164
|
+
*/
|
165
|
+
function makeError(id, msg, err, requireModules) {
|
166
|
+
var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
|
167
|
+
e.requireType = id;
|
168
|
+
e.requireModules = requireModules;
|
169
|
+
if (err) {
|
170
|
+
e.originalError = err;
|
171
|
+
}
|
172
|
+
return e;
|
173
|
+
}
|
174
|
+
|
175
|
+
if (typeof define !== 'undefined') {
|
176
|
+
//If a define is already in play via another AMD loader,
|
177
|
+
//do not overwrite.
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
|
181
|
+
if (typeof requirejs !== 'undefined') {
|
182
|
+
if (isFunction(requirejs)) {
|
183
|
+
//Do not overwrite an existing requirejs instance.
|
184
|
+
return;
|
185
|
+
}
|
186
|
+
cfg = requirejs;
|
187
|
+
requirejs = undefined;
|
188
|
+
}
|
189
|
+
|
190
|
+
//Allow for a require config object
|
191
|
+
if (typeof require !== 'undefined' && !isFunction(require)) {
|
192
|
+
//assume it is a config object.
|
193
|
+
cfg = require;
|
194
|
+
require = undefined;
|
195
|
+
}
|
196
|
+
|
197
|
+
function newContext(contextName) {
|
198
|
+
var inCheckLoaded, Module, context, handlers,
|
199
|
+
checkLoadedTimeoutId,
|
200
|
+
config = {
|
201
|
+
//Defaults. Do not set a default for map
|
202
|
+
//config to speed up normalize(), which
|
203
|
+
//will run faster if there is no default.
|
204
|
+
waitSeconds: 7,
|
205
|
+
baseUrl: './',
|
206
|
+
paths: {},
|
207
|
+
bundles: {},
|
208
|
+
pkgs: {},
|
209
|
+
shim: {},
|
210
|
+
config: {}
|
211
|
+
},
|
212
|
+
registry = {},
|
213
|
+
//registry of just enabled modules, to speed
|
214
|
+
//cycle breaking code when lots of modules
|
215
|
+
//are registered, but not activated.
|
216
|
+
enabledRegistry = {},
|
217
|
+
undefEvents = {},
|
218
|
+
defQueue = [],
|
219
|
+
defined = {},
|
220
|
+
urlFetched = {},
|
221
|
+
bundlesMap = {},
|
222
|
+
requireCounter = 1,
|
223
|
+
unnormalizedCounter = 1;
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Trims the . and .. from an array of path segments.
|
227
|
+
* It will keep a leading path segment if a .. will become
|
228
|
+
* the first path segment, to help with module name lookups,
|
229
|
+
* which act like paths, but can be remapped. But the end result,
|
230
|
+
* all paths that use this function should look normalized.
|
231
|
+
* NOTE: this method MODIFIES the input array.
|
232
|
+
* @param {Array} ary the array of path segments.
|
233
|
+
*/
|
234
|
+
function trimDots(ary) {
|
235
|
+
var i, part;
|
236
|
+
for (i = 0; i < ary.length; i++) {
|
237
|
+
part = ary[i];
|
238
|
+
if (part === '.') {
|
239
|
+
ary.splice(i, 1);
|
240
|
+
i -= 1;
|
241
|
+
} else if (part === '..') {
|
242
|
+
// If at the start, or previous value is still ..,
|
243
|
+
// keep them so that when converted to a path it may
|
244
|
+
// still work when converted to a path, even though
|
245
|
+
// as an ID it is less than ideal. In larger point
|
246
|
+
// releases, may be better to just kick out an error.
|
247
|
+
if (i === 0 || (i == 1 && ary[2] === '..') || ary[i - 1] === '..') {
|
248
|
+
continue;
|
249
|
+
} else if (i > 0) {
|
250
|
+
ary.splice(i - 1, 2);
|
251
|
+
i -= 2;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Given a relative module name, like ./something, normalize it to
|
259
|
+
* a real name that can be mapped to a path.
|
260
|
+
* @param {String} name the relative name
|
261
|
+
* @param {String} baseName a real name that the name arg is relative
|
262
|
+
* to.
|
263
|
+
* @param {Boolean} applyMap apply the map config to the value. Should
|
264
|
+
* only be done if this normalization is for a dependency ID.
|
265
|
+
* @returns {String} normalized name
|
266
|
+
*/
|
267
|
+
function normalize(name, baseName, applyMap) {
|
268
|
+
var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
|
269
|
+
foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
|
270
|
+
baseParts = (baseName && baseName.split('/')),
|
271
|
+
map = config.map,
|
272
|
+
starMap = map && map['*'];
|
273
|
+
|
274
|
+
//Adjust any relative paths.
|
275
|
+
if (name) {
|
276
|
+
name = name.split('/');
|
277
|
+
lastIndex = name.length - 1;
|
278
|
+
|
279
|
+
// If wanting node ID compatibility, strip .js from end
|
280
|
+
// of IDs. Have to do this here, and not in nameToUrl
|
281
|
+
// because node allows either .js or non .js to map
|
282
|
+
// to same file.
|
283
|
+
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
284
|
+
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
285
|
+
}
|
286
|
+
|
287
|
+
// Starts with a '.' so need the baseName
|
288
|
+
if (name[0].charAt(0) === '.' && baseParts) {
|
289
|
+
//Convert baseName to array, and lop off the last part,
|
290
|
+
//so that . matches that 'directory' and not name of the baseName's
|
291
|
+
//module. For instance, baseName of 'one/two/three', maps to
|
292
|
+
//'one/two/three.js', but we want the directory, 'one/two' for
|
293
|
+
//this normalization.
|
294
|
+
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
295
|
+
name = normalizedBaseParts.concat(name);
|
296
|
+
}
|
297
|
+
|
298
|
+
trimDots(name);
|
299
|
+
name = name.join('/');
|
300
|
+
}
|
301
|
+
|
302
|
+
//Apply map config if available.
|
303
|
+
if (applyMap && map && (baseParts || starMap)) {
|
304
|
+
nameParts = name.split('/');
|
305
|
+
|
306
|
+
outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
|
307
|
+
nameSegment = nameParts.slice(0, i).join('/');
|
308
|
+
|
309
|
+
if (baseParts) {
|
310
|
+
//Find the longest baseName segment match in the config.
|
311
|
+
//So, do joins on the biggest to smallest lengths of baseParts.
|
312
|
+
for (j = baseParts.length; j > 0; j -= 1) {
|
313
|
+
mapValue = getOwn(map, baseParts.slice(0, j).join('/'));
|
314
|
+
|
315
|
+
//baseName segment has config, find if it has one for
|
316
|
+
//this name.
|
317
|
+
if (mapValue) {
|
318
|
+
mapValue = getOwn(mapValue, nameSegment);
|
319
|
+
if (mapValue) {
|
320
|
+
//Match, update name to the new value.
|
321
|
+
foundMap = mapValue;
|
322
|
+
foundI = i;
|
323
|
+
break outerLoop;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|
327
|
+
}
|
328
|
+
|
329
|
+
//Check for a star map match, but just hold on to it,
|
330
|
+
//if there is a shorter segment match later in a matching
|
331
|
+
//config, then favor over this star map.
|
332
|
+
if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
|
333
|
+
foundStarMap = getOwn(starMap, nameSegment);
|
334
|
+
starI = i;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
if (!foundMap && foundStarMap) {
|
339
|
+
foundMap = foundStarMap;
|
340
|
+
foundI = starI;
|
341
|
+
}
|
342
|
+
|
343
|
+
if (foundMap) {
|
344
|
+
nameParts.splice(0, foundI, foundMap);
|
345
|
+
name = nameParts.join('/');
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
// If the name points to a package's name, use
|
350
|
+
// the package main instead.
|
351
|
+
pkgMain = getOwn(config.pkgs, name);
|
352
|
+
|
353
|
+
return pkgMain ? pkgMain : name;
|
354
|
+
}
|
355
|
+
|
356
|
+
function removeScript(name) {
|
357
|
+
if (isBrowser) {
|
358
|
+
each(scripts(), function (scriptNode) {
|
359
|
+
if (scriptNode.getAttribute('data-requiremodule') === name &&
|
360
|
+
scriptNode.getAttribute('data-requirecontext') === context.contextName) {
|
361
|
+
scriptNode.parentNode.removeChild(scriptNode);
|
362
|
+
return true;
|
363
|
+
}
|
364
|
+
});
|
365
|
+
}
|
366
|
+
}
|
367
|
+
|
368
|
+
function hasPathFallback(id) {
|
369
|
+
var pathConfig = getOwn(config.paths, id);
|
370
|
+
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
|
371
|
+
//Pop off the first array value, since it failed, and
|
372
|
+
//retry
|
373
|
+
pathConfig.shift();
|
374
|
+
context.require.undef(id);
|
375
|
+
|
376
|
+
//Custom require that does not do map translation, since
|
377
|
+
//ID is "absolute", already mapped/resolved.
|
378
|
+
context.makeRequire(null, {
|
379
|
+
skipMap: true
|
380
|
+
})([id]);
|
381
|
+
|
382
|
+
return true;
|
383
|
+
}
|
384
|
+
}
|
385
|
+
|
386
|
+
//Turns a plugin!resource to [plugin, resource]
|
387
|
+
//with the plugin being undefined if the name
|
388
|
+
//did not have a plugin prefix.
|
389
|
+
function splitPrefix(name) {
|
390
|
+
var prefix,
|
391
|
+
index = name ? name.indexOf('!') : -1;
|
392
|
+
if (index > -1) {
|
393
|
+
prefix = name.substring(0, index);
|
394
|
+
name = name.substring(index + 1, name.length);
|
395
|
+
}
|
396
|
+
return [prefix, name];
|
397
|
+
}
|
398
|
+
|
399
|
+
/**
|
400
|
+
* Creates a module mapping that includes plugin prefix, module
|
401
|
+
* name, and path. If parentModuleMap is provided it will
|
402
|
+
* also normalize the name via require.normalize()
|
403
|
+
*
|
404
|
+
* @param {String} name the module name
|
405
|
+
* @param {String} [parentModuleMap] parent module map
|
406
|
+
* for the module name, used to resolve relative names.
|
407
|
+
* @param {Boolean} isNormalized: is the ID already normalized.
|
408
|
+
* This is true if this call is done for a define() module ID.
|
409
|
+
* @param {Boolean} applyMap: apply the map config to the ID.
|
410
|
+
* Should only be true if this map is for a dependency.
|
411
|
+
*
|
412
|
+
* @returns {Object}
|
413
|
+
*/
|
414
|
+
function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
|
415
|
+
var url, pluginModule, suffix, nameParts,
|
416
|
+
prefix = null,
|
417
|
+
parentName = parentModuleMap ? parentModuleMap.name : null,
|
418
|
+
originalName = name,
|
419
|
+
isDefine = true,
|
420
|
+
normalizedName = '';
|
421
|
+
|
422
|
+
//If no name, then it means it is a require call, generate an
|
423
|
+
//internal name.
|
424
|
+
if (!name) {
|
425
|
+
isDefine = false;
|
426
|
+
name = '_@r' + (requireCounter += 1);
|
427
|
+
}
|
428
|
+
|
429
|
+
nameParts = splitPrefix(name);
|
430
|
+
prefix = nameParts[0];
|
431
|
+
name = nameParts[1];
|
432
|
+
|
433
|
+
if (prefix) {
|
434
|
+
prefix = normalize(prefix, parentName, applyMap);
|
435
|
+
pluginModule = getOwn(defined, prefix);
|
436
|
+
}
|
437
|
+
|
438
|
+
//Account for relative paths if there is a base name.
|
439
|
+
if (name) {
|
440
|
+
if (prefix) {
|
441
|
+
if (pluginModule && pluginModule.normalize) {
|
442
|
+
//Plugin is loaded, use its normalize method.
|
443
|
+
normalizedName = pluginModule.normalize(name, function (name) {
|
444
|
+
return normalize(name, parentName, applyMap);
|
445
|
+
});
|
446
|
+
} else {
|
447
|
+
// If nested plugin references, then do not try to
|
448
|
+
// normalize, as it will not normalize correctly. This
|
449
|
+
// places a restriction on resourceIds, and the longer
|
450
|
+
// term solution is not to normalize until plugins are
|
451
|
+
// loaded and all normalizations to allow for async
|
452
|
+
// loading of a loader plugin. But for now, fixes the
|
453
|
+
// common uses. Details in #1131
|
454
|
+
normalizedName = name.indexOf('!') === -1 ?
|
455
|
+
normalize(name, parentName, applyMap) :
|
456
|
+
name;
|
457
|
+
}
|
458
|
+
} else {
|
459
|
+
//A regular module.
|
460
|
+
normalizedName = normalize(name, parentName, applyMap);
|
461
|
+
|
462
|
+
//Normalized name may be a plugin ID due to map config
|
463
|
+
//application in normalize. The map config values must
|
464
|
+
//already be normalized, so do not need to redo that part.
|
465
|
+
nameParts = splitPrefix(normalizedName);
|
466
|
+
prefix = nameParts[0];
|
467
|
+
normalizedName = nameParts[1];
|
468
|
+
isNormalized = true;
|
469
|
+
|
470
|
+
url = context.nameToUrl(normalizedName);
|
471
|
+
}
|
472
|
+
}
|
473
|
+
|
474
|
+
//If the id is a plugin id that cannot be determined if it needs
|
475
|
+
//normalization, stamp it with a unique ID so two matching relative
|
476
|
+
//ids that may conflict can be separate.
|
477
|
+
suffix = prefix && !pluginModule && !isNormalized ?
|
478
|
+
'_unnormalized' + (unnormalizedCounter += 1) :
|
479
|
+
'';
|
480
|
+
|
481
|
+
return {
|
482
|
+
prefix: prefix,
|
483
|
+
name: normalizedName,
|
484
|
+
parentMap: parentModuleMap,
|
485
|
+
unnormalized: !!suffix,
|
486
|
+
url: url,
|
487
|
+
originalName: originalName,
|
488
|
+
isDefine: isDefine,
|
489
|
+
id: (prefix ?
|
490
|
+
prefix + '!' + normalizedName :
|
491
|
+
normalizedName) + suffix
|
492
|
+
};
|
493
|
+
}
|
494
|
+
|
495
|
+
function getModule(depMap) {
|
496
|
+
var id = depMap.id,
|
497
|
+
mod = getOwn(registry, id);
|
498
|
+
|
499
|
+
if (!mod) {
|
500
|
+
mod = registry[id] = new context.Module(depMap);
|
501
|
+
}
|
502
|
+
|
503
|
+
return mod;
|
504
|
+
}
|
505
|
+
|
506
|
+
function on(depMap, name, fn) {
|
507
|
+
var id = depMap.id,
|
508
|
+
mod = getOwn(registry, id);
|
509
|
+
|
510
|
+
if (hasProp(defined, id) &&
|
511
|
+
(!mod || mod.defineEmitComplete)) {
|
512
|
+
if (name === 'defined') {
|
513
|
+
fn(defined[id]);
|
514
|
+
}
|
515
|
+
} else {
|
516
|
+
mod = getModule(depMap);
|
517
|
+
if (mod.error && name === 'error') {
|
518
|
+
fn(mod.error);
|
519
|
+
} else {
|
520
|
+
mod.on(name, fn);
|
521
|
+
}
|
522
|
+
}
|
523
|
+
}
|
524
|
+
|
525
|
+
function onError(err, errback) {
|
526
|
+
var ids = err.requireModules,
|
527
|
+
notified = false;
|
528
|
+
|
529
|
+
if (errback) {
|
530
|
+
errback(err);
|
531
|
+
} else {
|
532
|
+
each(ids, function (id) {
|
533
|
+
var mod = getOwn(registry, id);
|
534
|
+
if (mod) {
|
535
|
+
//Set error on module, so it skips timeout checks.
|
536
|
+
mod.error = err;
|
537
|
+
if (mod.events.error) {
|
538
|
+
notified = true;
|
539
|
+
mod.emit('error', err);
|
540
|
+
}
|
541
|
+
}
|
542
|
+
});
|
543
|
+
|
544
|
+
if (!notified) {
|
545
|
+
req.onError(err);
|
546
|
+
}
|
547
|
+
}
|
548
|
+
}
|
549
|
+
|
550
|
+
/**
|
551
|
+
* Internal method to transfer globalQueue items to this context's
|
552
|
+
* defQueue.
|
553
|
+
*/
|
554
|
+
function takeGlobalQueue() {
|
555
|
+
//Push all the globalDefQueue items into the context's defQueue
|
556
|
+
if (globalDefQueue.length) {
|
557
|
+
//Array splice in the values since the context code has a
|
558
|
+
//local var ref to defQueue, so cannot just reassign the one
|
559
|
+
//on context.
|
560
|
+
apsp.apply(defQueue,
|
561
|
+
[defQueue.length, 0].concat(globalDefQueue));
|
562
|
+
globalDefQueue = [];
|
563
|
+
}
|
564
|
+
}
|
565
|
+
|
566
|
+
handlers = {
|
567
|
+
'require': function (mod) {
|
568
|
+
if (mod.require) {
|
569
|
+
return mod.require;
|
570
|
+
} else {
|
571
|
+
return (mod.require = context.makeRequire(mod.map));
|
572
|
+
}
|
573
|
+
},
|
574
|
+
'exports': function (mod) {
|
575
|
+
mod.usingExports = true;
|
576
|
+
if (mod.map.isDefine) {
|
577
|
+
if (mod.exports) {
|
578
|
+
return (defined[mod.map.id] = mod.exports);
|
579
|
+
} else {
|
580
|
+
return (mod.exports = defined[mod.map.id] = {});
|
581
|
+
}
|
582
|
+
}
|
583
|
+
},
|
584
|
+
'module': function (mod) {
|
585
|
+
if (mod.module) {
|
586
|
+
return mod.module;
|
587
|
+
} else {
|
588
|
+
return (mod.module = {
|
589
|
+
id: mod.map.id,
|
590
|
+
uri: mod.map.url,
|
591
|
+
config: function () {
|
592
|
+
return getOwn(config.config, mod.map.id) || {};
|
593
|
+
},
|
594
|
+
exports: mod.exports || (mod.exports = {})
|
595
|
+
});
|
596
|
+
}
|
597
|
+
}
|
598
|
+
};
|
599
|
+
|
600
|
+
function cleanRegistry(id) {
|
601
|
+
//Clean up machinery used for waiting modules.
|
602
|
+
delete registry[id];
|
603
|
+
delete enabledRegistry[id];
|
604
|
+
}
|
605
|
+
|
606
|
+
function breakCycle(mod, traced, processed) {
|
607
|
+
var id = mod.map.id;
|
608
|
+
|
609
|
+
if (mod.error) {
|
610
|
+
mod.emit('error', mod.error);
|
611
|
+
} else {
|
612
|
+
traced[id] = true;
|
613
|
+
each(mod.depMaps, function (depMap, i) {
|
614
|
+
var depId = depMap.id,
|
615
|
+
dep = getOwn(registry, depId);
|
616
|
+
|
617
|
+
//Only force things that have not completed
|
618
|
+
//being defined, so still in the registry,
|
619
|
+
//and only if it has not been matched up
|
620
|
+
//in the module already.
|
621
|
+
if (dep && !mod.depMatched[i] && !processed[depId]) {
|
622
|
+
if (getOwn(traced, depId)) {
|
623
|
+
mod.defineDep(i, defined[depId]);
|
624
|
+
mod.check(); //pass false?
|
625
|
+
} else {
|
626
|
+
breakCycle(dep, traced, processed);
|
627
|
+
}
|
628
|
+
}
|
629
|
+
});
|
630
|
+
processed[id] = true;
|
631
|
+
}
|
632
|
+
}
|
633
|
+
|
634
|
+
function checkLoaded() {
|
635
|
+
var err, usingPathFallback,
|
636
|
+
waitInterval = config.waitSeconds * 1000,
|
637
|
+
//It is possible to disable the wait interval by using waitSeconds of 0.
|
638
|
+
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
|
639
|
+
noLoads = [],
|
640
|
+
reqCalls = [],
|
641
|
+
stillLoading = false,
|
642
|
+
needCycleCheck = true;
|
643
|
+
|
644
|
+
//Do not bother if this call was a result of a cycle break.
|
645
|
+
if (inCheckLoaded) {
|
646
|
+
return;
|
647
|
+
}
|
648
|
+
|
649
|
+
inCheckLoaded = true;
|
650
|
+
|
651
|
+
//Figure out the state of all the modules.
|
652
|
+
eachProp(enabledRegistry, function (mod) {
|
653
|
+
var map = mod.map,
|
654
|
+
modId = map.id;
|
655
|
+
|
656
|
+
//Skip things that are not enabled or in error state.
|
657
|
+
if (!mod.enabled) {
|
658
|
+
return;
|
659
|
+
}
|
660
|
+
|
661
|
+
if (!map.isDefine) {
|
662
|
+
reqCalls.push(mod);
|
663
|
+
}
|
664
|
+
|
665
|
+
if (!mod.error) {
|
666
|
+
//If the module should be executed, and it has not
|
667
|
+
//been inited and time is up, remember it.
|
668
|
+
if (!mod.inited && expired) {
|
669
|
+
if (hasPathFallback(modId)) {
|
670
|
+
usingPathFallback = true;
|
671
|
+
stillLoading = true;
|
672
|
+
} else {
|
673
|
+
noLoads.push(modId);
|
674
|
+
removeScript(modId);
|
675
|
+
}
|
676
|
+
} else if (!mod.inited && mod.fetched && map.isDefine) {
|
677
|
+
stillLoading = true;
|
678
|
+
if (!map.prefix) {
|
679
|
+
//No reason to keep looking for unfinished
|
680
|
+
//loading. If the only stillLoading is a
|
681
|
+
//plugin resource though, keep going,
|
682
|
+
//because it may be that a plugin resource
|
683
|
+
//is waiting on a non-plugin cycle.
|
684
|
+
return (needCycleCheck = false);
|
685
|
+
}
|
686
|
+
}
|
687
|
+
}
|
688
|
+
});
|
689
|
+
|
690
|
+
if (expired && noLoads.length) {
|
691
|
+
//If wait time expired, throw error of unloaded modules.
|
692
|
+
err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
|
693
|
+
err.contextName = context.contextName;
|
694
|
+
return onError(err);
|
695
|
+
}
|
696
|
+
|
697
|
+
//Not expired, check for a cycle.
|
698
|
+
if (needCycleCheck) {
|
699
|
+
each(reqCalls, function (mod) {
|
700
|
+
breakCycle(mod, {}, {});
|
701
|
+
});
|
702
|
+
}
|
703
|
+
|
704
|
+
//If still waiting on loads, and the waiting load is something
|
705
|
+
//other than a plugin resource, or there are still outstanding
|
706
|
+
//scripts, then just try back later.
|
707
|
+
if ((!expired || usingPathFallback) && stillLoading) {
|
708
|
+
//Something is still waiting to load. Wait for it, but only
|
709
|
+
//if a timeout is not already in effect.
|
710
|
+
if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
|
711
|
+
checkLoadedTimeoutId = setTimeout(function () {
|
712
|
+
checkLoadedTimeoutId = 0;
|
713
|
+
checkLoaded();
|
714
|
+
}, 50);
|
715
|
+
}
|
716
|
+
}
|
717
|
+
|
718
|
+
inCheckLoaded = false;
|
719
|
+
}
|
720
|
+
|
721
|
+
Module = function (map) {
|
722
|
+
this.events = getOwn(undefEvents, map.id) || {};
|
723
|
+
this.map = map;
|
724
|
+
this.shim = getOwn(config.shim, map.id);
|
725
|
+
this.depExports = [];
|
726
|
+
this.depMaps = [];
|
727
|
+
this.depMatched = [];
|
728
|
+
this.pluginMaps = {};
|
729
|
+
this.depCount = 0;
|
730
|
+
|
731
|
+
/* this.exports this.factory
|
732
|
+
this.depMaps = [],
|
733
|
+
this.enabled, this.fetched
|
734
|
+
*/
|
735
|
+
};
|
736
|
+
|
737
|
+
Module.prototype = {
|
738
|
+
init: function (depMaps, factory, errback, options) {
|
739
|
+
options = options || {};
|
740
|
+
|
741
|
+
//Do not do more inits if already done. Can happen if there
|
742
|
+
//are multiple define calls for the same module. That is not
|
743
|
+
//a normal, common case, but it is also not unexpected.
|
744
|
+
if (this.inited) {
|
745
|
+
return;
|
746
|
+
}
|
747
|
+
|
748
|
+
this.factory = factory;
|
749
|
+
|
750
|
+
if (errback) {
|
751
|
+
//Register for errors on this module.
|
752
|
+
this.on('error', errback);
|
753
|
+
} else if (this.events.error) {
|
754
|
+
//If no errback already, but there are error listeners
|
755
|
+
//on this module, set up an errback to pass to the deps.
|
756
|
+
errback = bind(this, function (err) {
|
757
|
+
this.emit('error', err);
|
758
|
+
});
|
759
|
+
}
|
760
|
+
|
761
|
+
//Do a copy of the dependency array, so that
|
762
|
+
//source inputs are not modified. For example
|
763
|
+
//"shim" deps are passed in here directly, and
|
764
|
+
//doing a direct modification of the depMaps array
|
765
|
+
//would affect that config.
|
766
|
+
this.depMaps = depMaps && depMaps.slice(0);
|
767
|
+
|
768
|
+
this.errback = errback;
|
769
|
+
|
770
|
+
//Indicate this module has be initialized
|
771
|
+
this.inited = true;
|
772
|
+
|
773
|
+
this.ignore = options.ignore;
|
774
|
+
|
775
|
+
//Could have option to init this module in enabled mode,
|
776
|
+
//or could have been previously marked as enabled. However,
|
777
|
+
//the dependencies are not known until init is called. So
|
778
|
+
//if enabled previously, now trigger dependencies as enabled.
|
779
|
+
if (options.enabled || this.enabled) {
|
780
|
+
//Enable this module and dependencies.
|
781
|
+
//Will call this.check()
|
782
|
+
this.enable();
|
783
|
+
} else {
|
784
|
+
this.check();
|
785
|
+
}
|
786
|
+
},
|
787
|
+
|
788
|
+
defineDep: function (i, depExports) {
|
789
|
+
//Because of cycles, defined callback for a given
|
790
|
+
//export can be called more than once.
|
791
|
+
if (!this.depMatched[i]) {
|
792
|
+
this.depMatched[i] = true;
|
793
|
+
this.depCount -= 1;
|
794
|
+
this.depExports[i] = depExports;
|
795
|
+
}
|
796
|
+
},
|
797
|
+
|
798
|
+
fetch: function () {
|
799
|
+
if (this.fetched) {
|
800
|
+
return;
|
801
|
+
}
|
802
|
+
this.fetched = true;
|
803
|
+
|
804
|
+
context.startTime = (new Date()).getTime();
|
805
|
+
|
806
|
+
var map = this.map;
|
807
|
+
|
808
|
+
//If the manager is for a plugin managed resource,
|
809
|
+
//ask the plugin to load it now.
|
810
|
+
if (this.shim) {
|
811
|
+
context.makeRequire(this.map, {
|
812
|
+
enableBuildCallback: true
|
813
|
+
})(this.shim.deps || [], bind(this, function () {
|
814
|
+
return map.prefix ? this.callPlugin() : this.load();
|
815
|
+
}));
|
816
|
+
} else {
|
817
|
+
//Regular dependency.
|
818
|
+
return map.prefix ? this.callPlugin() : this.load();
|
819
|
+
}
|
820
|
+
},
|
821
|
+
|
822
|
+
load: function () {
|
823
|
+
var url = this.map.url;
|
824
|
+
|
825
|
+
//Regular dependency.
|
826
|
+
if (!urlFetched[url]) {
|
827
|
+
urlFetched[url] = true;
|
828
|
+
context.load(this.map.id, url);
|
829
|
+
}
|
830
|
+
},
|
831
|
+
|
832
|
+
/**
|
833
|
+
* Checks if the module is ready to define itself, and if so,
|
834
|
+
* define it.
|
835
|
+
*/
|
836
|
+
check: function () {
|
837
|
+
if (!this.enabled || this.enabling) {
|
838
|
+
return;
|
839
|
+
}
|
840
|
+
|
841
|
+
var err, cjsModule,
|
842
|
+
id = this.map.id,
|
843
|
+
depExports = this.depExports,
|
844
|
+
exports = this.exports,
|
845
|
+
factory = this.factory;
|
846
|
+
|
847
|
+
if (!this.inited) {
|
848
|
+
this.fetch();
|
849
|
+
} else if (this.error) {
|
850
|
+
this.emit('error', this.error);
|
851
|
+
} else if (!this.defining) {
|
852
|
+
//The factory could trigger another require call
|
853
|
+
//that would result in checking this module to
|
854
|
+
//define itself again. If already in the process
|
855
|
+
//of doing that, skip this work.
|
856
|
+
this.defining = true;
|
857
|
+
|
858
|
+
if (this.depCount < 1 && !this.defined) {
|
859
|
+
if (isFunction(factory)) {
|
860
|
+
//If there is an error listener, favor passing
|
861
|
+
//to that instead of throwing an error. However,
|
862
|
+
//only do it for define()'d modules. require
|
863
|
+
//errbacks should not be called for failures in
|
864
|
+
//their callbacks (#699). However if a global
|
865
|
+
//onError is set, use that.
|
866
|
+
if ((this.events.error && this.map.isDefine) ||
|
867
|
+
req.onError !== defaultOnError) {
|
868
|
+
try {
|
869
|
+
exports = context.execCb(id, factory, depExports, exports);
|
870
|
+
} catch (e) {
|
871
|
+
err = e;
|
872
|
+
}
|
873
|
+
} else {
|
874
|
+
exports = context.execCb(id, factory, depExports, exports);
|
875
|
+
}
|
876
|
+
|
877
|
+
// Favor return value over exports. If node/cjs in play,
|
878
|
+
// then will not have a return value anyway. Favor
|
879
|
+
// module.exports assignment over exports object.
|
880
|
+
if (this.map.isDefine && exports === undefined) {
|
881
|
+
cjsModule = this.module;
|
882
|
+
if (cjsModule) {
|
883
|
+
exports = cjsModule.exports;
|
884
|
+
} else if (this.usingExports) {
|
885
|
+
//exports already set the defined value.
|
886
|
+
exports = this.exports;
|
887
|
+
}
|
888
|
+
}
|
889
|
+
|
890
|
+
if (err) {
|
891
|
+
err.requireMap = this.map;
|
892
|
+
err.requireModules = this.map.isDefine ? [this.map.id] : null;
|
893
|
+
err.requireType = this.map.isDefine ? 'define' : 'require';
|
894
|
+
return onError((this.error = err));
|
895
|
+
}
|
896
|
+
|
897
|
+
} else {
|
898
|
+
//Just a literal value
|
899
|
+
exports = factory;
|
900
|
+
}
|
901
|
+
|
902
|
+
this.exports = exports;
|
903
|
+
|
904
|
+
if (this.map.isDefine && !this.ignore) {
|
905
|
+
defined[id] = exports;
|
906
|
+
|
907
|
+
if (req.onResourceLoad) {
|
908
|
+
req.onResourceLoad(context, this.map, this.depMaps);
|
909
|
+
}
|
910
|
+
}
|
911
|
+
|
912
|
+
//Clean up
|
913
|
+
cleanRegistry(id);
|
914
|
+
|
915
|
+
this.defined = true;
|
916
|
+
}
|
917
|
+
|
918
|
+
//Finished the define stage. Allow calling check again
|
919
|
+
//to allow define notifications below in the case of a
|
920
|
+
//cycle.
|
921
|
+
this.defining = false;
|
922
|
+
|
923
|
+
if (this.defined && !this.defineEmitted) {
|
924
|
+
this.defineEmitted = true;
|
925
|
+
this.emit('defined', this.exports);
|
926
|
+
this.defineEmitComplete = true;
|
927
|
+
}
|
928
|
+
|
929
|
+
}
|
930
|
+
},
|
931
|
+
|
932
|
+
callPlugin: function () {
|
933
|
+
var map = this.map,
|
934
|
+
id = map.id,
|
935
|
+
//Map already normalized the prefix.
|
936
|
+
pluginMap = makeModuleMap(map.prefix);
|
937
|
+
|
938
|
+
//Mark this as a dependency for this plugin, so it
|
939
|
+
//can be traced for cycles.
|
940
|
+
this.depMaps.push(pluginMap);
|
941
|
+
|
942
|
+
on(pluginMap, 'defined', bind(this, function (plugin) {
|
943
|
+
var load, normalizedMap, normalizedMod,
|
944
|
+
bundleId = getOwn(bundlesMap, this.map.id),
|
945
|
+
name = this.map.name,
|
946
|
+
parentName = this.map.parentMap ? this.map.parentMap.name : null,
|
947
|
+
localRequire = context.makeRequire(map.parentMap, {
|
948
|
+
enableBuildCallback: true
|
949
|
+
});
|
950
|
+
|
951
|
+
//If current map is not normalized, wait for that
|
952
|
+
//normalized name to load instead of continuing.
|
953
|
+
if (this.map.unnormalized) {
|
954
|
+
//Normalize the ID if the plugin allows it.
|
955
|
+
if (plugin.normalize) {
|
956
|
+
name = plugin.normalize(name, function (name) {
|
957
|
+
return normalize(name, parentName, true);
|
958
|
+
}) || '';
|
959
|
+
}
|
960
|
+
|
961
|
+
//prefix and name should already be normalized, no need
|
962
|
+
//for applying map config again either.
|
963
|
+
normalizedMap = makeModuleMap(map.prefix + '!' + name,
|
964
|
+
this.map.parentMap);
|
965
|
+
on(normalizedMap,
|
966
|
+
'defined', bind(this, function (value) {
|
967
|
+
this.init([], function () { return value; }, null, {
|
968
|
+
enabled: true,
|
969
|
+
ignore: true
|
970
|
+
});
|
971
|
+
}));
|
972
|
+
|
973
|
+
normalizedMod = getOwn(registry, normalizedMap.id);
|
974
|
+
if (normalizedMod) {
|
975
|
+
//Mark this as a dependency for this plugin, so it
|
976
|
+
//can be traced for cycles.
|
977
|
+
this.depMaps.push(normalizedMap);
|
978
|
+
|
979
|
+
if (this.events.error) {
|
980
|
+
normalizedMod.on('error', bind(this, function (err) {
|
981
|
+
this.emit('error', err);
|
982
|
+
}));
|
983
|
+
}
|
984
|
+
normalizedMod.enable();
|
985
|
+
}
|
986
|
+
|
987
|
+
return;
|
988
|
+
}
|
989
|
+
|
990
|
+
//If a paths config, then just load that file instead to
|
991
|
+
//resolve the plugin, as it is built into that paths layer.
|
992
|
+
if (bundleId) {
|
993
|
+
this.map.url = context.nameToUrl(bundleId);
|
994
|
+
this.load();
|
995
|
+
return;
|
996
|
+
}
|
997
|
+
|
998
|
+
load = bind(this, function (value) {
|
999
|
+
this.init([], function () { return value; }, null, {
|
1000
|
+
enabled: true
|
1001
|
+
});
|
1002
|
+
});
|
1003
|
+
|
1004
|
+
load.error = bind(this, function (err) {
|
1005
|
+
this.inited = true;
|
1006
|
+
this.error = err;
|
1007
|
+
err.requireModules = [id];
|
1008
|
+
|
1009
|
+
//Remove temp unnormalized modules for this module,
|
1010
|
+
//since they will never be resolved otherwise now.
|
1011
|
+
eachProp(registry, function (mod) {
|
1012
|
+
if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
|
1013
|
+
cleanRegistry(mod.map.id);
|
1014
|
+
}
|
1015
|
+
});
|
1016
|
+
|
1017
|
+
onError(err);
|
1018
|
+
});
|
1019
|
+
|
1020
|
+
//Allow plugins to load other code without having to know the
|
1021
|
+
//context or how to 'complete' the load.
|
1022
|
+
load.fromText = bind(this, function (text, textAlt) {
|
1023
|
+
/*jslint evil: true */
|
1024
|
+
var moduleName = map.name,
|
1025
|
+
moduleMap = makeModuleMap(moduleName),
|
1026
|
+
hasInteractive = useInteractive;
|
1027
|
+
|
1028
|
+
//As of 2.1.0, support just passing the text, to reinforce
|
1029
|
+
//fromText only being called once per resource. Still
|
1030
|
+
//support old style of passing moduleName but discard
|
1031
|
+
//that moduleName in favor of the internal ref.
|
1032
|
+
if (textAlt) {
|
1033
|
+
text = textAlt;
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
//Turn off interactive script matching for IE for any define
|
1037
|
+
//calls in the text, then turn it back on at the end.
|
1038
|
+
if (hasInteractive) {
|
1039
|
+
useInteractive = false;
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
//Prime the system by creating a module instance for
|
1043
|
+
//it.
|
1044
|
+
getModule(moduleMap);
|
1045
|
+
|
1046
|
+
//Transfer any config to this other module.
|
1047
|
+
if (hasProp(config.config, id)) {
|
1048
|
+
config.config[moduleName] = config.config[id];
|
1049
|
+
}
|
1050
|
+
|
1051
|
+
try {
|
1052
|
+
req.exec(text);
|
1053
|
+
} catch (e) {
|
1054
|
+
return onError(makeError('fromtexteval',
|
1055
|
+
'fromText eval for ' + id +
|
1056
|
+
' failed: ' + e,
|
1057
|
+
e,
|
1058
|
+
[id]));
|
1059
|
+
}
|
1060
|
+
|
1061
|
+
if (hasInteractive) {
|
1062
|
+
useInteractive = true;
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
//Mark this as a dependency for the plugin
|
1066
|
+
//resource
|
1067
|
+
this.depMaps.push(moduleMap);
|
1068
|
+
|
1069
|
+
//Support anonymous modules.
|
1070
|
+
context.completeLoad(moduleName);
|
1071
|
+
|
1072
|
+
//Bind the value of that module to the value for this
|
1073
|
+
//resource ID.
|
1074
|
+
localRequire([moduleName], load);
|
1075
|
+
});
|
1076
|
+
|
1077
|
+
//Use parentName here since the plugin's name is not reliable,
|
1078
|
+
//could be some weird string with no path that actually wants to
|
1079
|
+
//reference the parentName's path.
|
1080
|
+
plugin.load(map.name, localRequire, load, config);
|
1081
|
+
}));
|
1082
|
+
|
1083
|
+
context.enable(pluginMap, this);
|
1084
|
+
this.pluginMaps[pluginMap.id] = pluginMap;
|
1085
|
+
},
|
1086
|
+
|
1087
|
+
enable: function () {
|
1088
|
+
enabledRegistry[this.map.id] = this;
|
1089
|
+
this.enabled = true;
|
1090
|
+
|
1091
|
+
//Set flag mentioning that the module is enabling,
|
1092
|
+
//so that immediate calls to the defined callbacks
|
1093
|
+
//for dependencies do not trigger inadvertent load
|
1094
|
+
//with the depCount still being zero.
|
1095
|
+
this.enabling = true;
|
1096
|
+
|
1097
|
+
//Enable each dependency
|
1098
|
+
each(this.depMaps, bind(this, function (depMap, i) {
|
1099
|
+
var id, mod, handler;
|
1100
|
+
|
1101
|
+
if (typeof depMap === 'string') {
|
1102
|
+
//Dependency needs to be converted to a depMap
|
1103
|
+
//and wired up to this module.
|
1104
|
+
depMap = makeModuleMap(depMap,
|
1105
|
+
(this.map.isDefine ? this.map : this.map.parentMap),
|
1106
|
+
false,
|
1107
|
+
!this.skipMap);
|
1108
|
+
this.depMaps[i] = depMap;
|
1109
|
+
|
1110
|
+
handler = getOwn(handlers, depMap.id);
|
1111
|
+
|
1112
|
+
if (handler) {
|
1113
|
+
this.depExports[i] = handler(this);
|
1114
|
+
return;
|
1115
|
+
}
|
1116
|
+
|
1117
|
+
this.depCount += 1;
|
1118
|
+
|
1119
|
+
on(depMap, 'defined', bind(this, function (depExports) {
|
1120
|
+
this.defineDep(i, depExports);
|
1121
|
+
this.check();
|
1122
|
+
}));
|
1123
|
+
|
1124
|
+
if (this.errback) {
|
1125
|
+
on(depMap, 'error', bind(this, this.errback));
|
1126
|
+
} else if (this.events.error) {
|
1127
|
+
// No direct errback on this module, but something
|
1128
|
+
// else is listening for errors, so be sure to
|
1129
|
+
// propagate the error correctly.
|
1130
|
+
on(depMap, 'error', bind(this, function(err) {
|
1131
|
+
this.emit('error', err);
|
1132
|
+
}));
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
id = depMap.id;
|
1137
|
+
mod = registry[id];
|
1138
|
+
|
1139
|
+
//Skip special modules like 'require', 'exports', 'module'
|
1140
|
+
//Also, don't call enable if it is already enabled,
|
1141
|
+
//important in circular dependency cases.
|
1142
|
+
if (!hasProp(handlers, id) && mod && !mod.enabled) {
|
1143
|
+
context.enable(depMap, this);
|
1144
|
+
}
|
1145
|
+
}));
|
1146
|
+
|
1147
|
+
//Enable each plugin that is used in
|
1148
|
+
//a dependency
|
1149
|
+
eachProp(this.pluginMaps, bind(this, function (pluginMap) {
|
1150
|
+
var mod = getOwn(registry, pluginMap.id);
|
1151
|
+
if (mod && !mod.enabled) {
|
1152
|
+
context.enable(pluginMap, this);
|
1153
|
+
}
|
1154
|
+
}));
|
1155
|
+
|
1156
|
+
this.enabling = false;
|
1157
|
+
|
1158
|
+
this.check();
|
1159
|
+
},
|
1160
|
+
|
1161
|
+
on: function (name, cb) {
|
1162
|
+
var cbs = this.events[name];
|
1163
|
+
if (!cbs) {
|
1164
|
+
cbs = this.events[name] = [];
|
1165
|
+
}
|
1166
|
+
cbs.push(cb);
|
1167
|
+
},
|
1168
|
+
|
1169
|
+
emit: function (name, evt) {
|
1170
|
+
each(this.events[name], function (cb) {
|
1171
|
+
cb(evt);
|
1172
|
+
});
|
1173
|
+
if (name === 'error') {
|
1174
|
+
//Now that the error handler was triggered, remove
|
1175
|
+
//the listeners, since this broken Module instance
|
1176
|
+
//can stay around for a while in the registry.
|
1177
|
+
delete this.events[name];
|
1178
|
+
}
|
1179
|
+
}
|
1180
|
+
};
|
1181
|
+
|
1182
|
+
function callGetModule(args) {
|
1183
|
+
//Skip modules already defined.
|
1184
|
+
if (!hasProp(defined, args[0])) {
|
1185
|
+
getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
|
1186
|
+
}
|
1187
|
+
}
|
1188
|
+
|
1189
|
+
function removeListener(node, func, name, ieName) {
|
1190
|
+
//Favor detachEvent because of IE9
|
1191
|
+
//issue, see attachEvent/addEventListener comment elsewhere
|
1192
|
+
//in this file.
|
1193
|
+
if (node.detachEvent && !isOpera) {
|
1194
|
+
//Probably IE. If not it will throw an error, which will be
|
1195
|
+
//useful to know.
|
1196
|
+
if (ieName) {
|
1197
|
+
node.detachEvent(ieName, func);
|
1198
|
+
}
|
1199
|
+
} else {
|
1200
|
+
node.removeEventListener(name, func, false);
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
/**
|
1205
|
+
* Given an event from a script node, get the requirejs info from it,
|
1206
|
+
* and then removes the event listeners on the node.
|
1207
|
+
* @param {Event} evt
|
1208
|
+
* @returns {Object}
|
1209
|
+
*/
|
1210
|
+
function getScriptData(evt) {
|
1211
|
+
//Using currentTarget instead of target for Firefox 2.0's sake. Not
|
1212
|
+
//all old browsers will be supported, but this one was easy enough
|
1213
|
+
//to support and still makes sense.
|
1214
|
+
var node = evt.currentTarget || evt.srcElement;
|
1215
|
+
|
1216
|
+
//Remove the listeners once here.
|
1217
|
+
removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
|
1218
|
+
removeListener(node, context.onScriptError, 'error');
|
1219
|
+
|
1220
|
+
return {
|
1221
|
+
node: node,
|
1222
|
+
id: node && node.getAttribute('data-requiremodule')
|
1223
|
+
};
|
1224
|
+
}
|
1225
|
+
|
1226
|
+
function intakeDefines() {
|
1227
|
+
var args;
|
1228
|
+
|
1229
|
+
//Any defined modules in the global queue, intake them now.
|
1230
|
+
takeGlobalQueue();
|
1231
|
+
|
1232
|
+
//Make sure any remaining defQueue items get properly processed.
|
1233
|
+
while (defQueue.length) {
|
1234
|
+
args = defQueue.shift();
|
1235
|
+
if (args[0] === null) {
|
1236
|
+
return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
|
1237
|
+
} else {
|
1238
|
+
//args are id, deps, factory. Should be normalized by the
|
1239
|
+
//define() function.
|
1240
|
+
callGetModule(args);
|
1241
|
+
}
|
1242
|
+
}
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
context = {
|
1246
|
+
config: config,
|
1247
|
+
contextName: contextName,
|
1248
|
+
registry: registry,
|
1249
|
+
defined: defined,
|
1250
|
+
urlFetched: urlFetched,
|
1251
|
+
defQueue: defQueue,
|
1252
|
+
Module: Module,
|
1253
|
+
makeModuleMap: makeModuleMap,
|
1254
|
+
nextTick: req.nextTick,
|
1255
|
+
onError: onError,
|
1256
|
+
|
1257
|
+
/**
|
1258
|
+
* Set a configuration for the context.
|
1259
|
+
* @param {Object} cfg config object to integrate.
|
1260
|
+
*/
|
1261
|
+
configure: function (cfg) {
|
1262
|
+
//Make sure the baseUrl ends in a slash.
|
1263
|
+
if (cfg.baseUrl) {
|
1264
|
+
if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
|
1265
|
+
cfg.baseUrl += '/';
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
//Save off the paths since they require special processing,
|
1270
|
+
//they are additive.
|
1271
|
+
var shim = config.shim,
|
1272
|
+
objs = {
|
1273
|
+
paths: true,
|
1274
|
+
bundles: true,
|
1275
|
+
config: true,
|
1276
|
+
map: true
|
1277
|
+
};
|
1278
|
+
|
1279
|
+
eachProp(cfg, function (value, prop) {
|
1280
|
+
if (objs[prop]) {
|
1281
|
+
if (!config[prop]) {
|
1282
|
+
config[prop] = {};
|
1283
|
+
}
|
1284
|
+
mixin(config[prop], value, true, true);
|
1285
|
+
} else {
|
1286
|
+
config[prop] = value;
|
1287
|
+
}
|
1288
|
+
});
|
1289
|
+
|
1290
|
+
//Reverse map the bundles
|
1291
|
+
if (cfg.bundles) {
|
1292
|
+
eachProp(cfg.bundles, function (value, prop) {
|
1293
|
+
each(value, function (v) {
|
1294
|
+
if (v !== prop) {
|
1295
|
+
bundlesMap[v] = prop;
|
1296
|
+
}
|
1297
|
+
});
|
1298
|
+
});
|
1299
|
+
}
|
1300
|
+
|
1301
|
+
//Merge shim
|
1302
|
+
if (cfg.shim) {
|
1303
|
+
eachProp(cfg.shim, function (value, id) {
|
1304
|
+
//Normalize the structure
|
1305
|
+
if (isArray(value)) {
|
1306
|
+
value = {
|
1307
|
+
deps: value
|
1308
|
+
};
|
1309
|
+
}
|
1310
|
+
if ((value.exports || value.init) && !value.exportsFn) {
|
1311
|
+
value.exportsFn = context.makeShimExports(value);
|
1312
|
+
}
|
1313
|
+
shim[id] = value;
|
1314
|
+
});
|
1315
|
+
config.shim = shim;
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
//Adjust packages if necessary.
|
1319
|
+
if (cfg.packages) {
|
1320
|
+
each(cfg.packages, function (pkgObj) {
|
1321
|
+
var location, name;
|
1322
|
+
|
1323
|
+
pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
|
1324
|
+
|
1325
|
+
name = pkgObj.name;
|
1326
|
+
location = pkgObj.location;
|
1327
|
+
if (location) {
|
1328
|
+
config.paths[name] = pkgObj.location;
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
//Save pointer to main module ID for pkg name.
|
1332
|
+
//Remove leading dot in main, so main paths are normalized,
|
1333
|
+
//and remove any trailing .js, since different package
|
1334
|
+
//envs have different conventions: some use a module name,
|
1335
|
+
//some use a file name.
|
1336
|
+
config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
|
1337
|
+
.replace(currDirRegExp, '')
|
1338
|
+
.replace(jsSuffixRegExp, '');
|
1339
|
+
});
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
//If there are any "waiting to execute" modules in the registry,
|
1343
|
+
//update the maps for them, since their info, like URLs to load,
|
1344
|
+
//may have changed.
|
1345
|
+
eachProp(registry, function (mod, id) {
|
1346
|
+
//If module already has init called, since it is too
|
1347
|
+
//late to modify them, and ignore unnormalized ones
|
1348
|
+
//since they are transient.
|
1349
|
+
if (!mod.inited && !mod.map.unnormalized) {
|
1350
|
+
mod.map = makeModuleMap(id);
|
1351
|
+
}
|
1352
|
+
});
|
1353
|
+
|
1354
|
+
//If a deps array or a config callback is specified, then call
|
1355
|
+
//require with those args. This is useful when require is defined as a
|
1356
|
+
//config object before require.js is loaded.
|
1357
|
+
if (cfg.deps || cfg.callback) {
|
1358
|
+
context.require(cfg.deps || [], cfg.callback);
|
1359
|
+
}
|
1360
|
+
},
|
1361
|
+
|
1362
|
+
makeShimExports: function (value) {
|
1363
|
+
function fn() {
|
1364
|
+
var ret;
|
1365
|
+
if (value.init) {
|
1366
|
+
ret = value.init.apply(global, arguments);
|
1367
|
+
}
|
1368
|
+
return ret || (value.exports && getGlobal(value.exports));
|
1369
|
+
}
|
1370
|
+
return fn;
|
1371
|
+
},
|
1372
|
+
|
1373
|
+
makeRequire: function (relMap, options) {
|
1374
|
+
options = options || {};
|
1375
|
+
|
1376
|
+
function localRequire(deps, callback, errback) {
|
1377
|
+
var id, map, requireMod;
|
1378
|
+
|
1379
|
+
if (options.enableBuildCallback && callback && isFunction(callback)) {
|
1380
|
+
callback.__requireJsBuild = true;
|
1381
|
+
}
|
1382
|
+
|
1383
|
+
if (typeof deps === 'string') {
|
1384
|
+
if (isFunction(callback)) {
|
1385
|
+
//Invalid call
|
1386
|
+
return onError(makeError('requireargs', 'Invalid require call'), errback);
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
//If require|exports|module are requested, get the
|
1390
|
+
//value for them from the special handlers. Caveat:
|
1391
|
+
//this only works while module is being defined.
|
1392
|
+
if (relMap && hasProp(handlers, deps)) {
|
1393
|
+
return handlers[deps](registry[relMap.id]);
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
//Synchronous access to one module. If require.get is
|
1397
|
+
//available (as in the Node adapter), prefer that.
|
1398
|
+
if (req.get) {
|
1399
|
+
return req.get(context, deps, relMap, localRequire);
|
1400
|
+
}
|
1401
|
+
|
1402
|
+
//Normalize module name, if it contains . or ..
|
1403
|
+
map = makeModuleMap(deps, relMap, false, true);
|
1404
|
+
id = map.id;
|
1405
|
+
|
1406
|
+
if (!hasProp(defined, id)) {
|
1407
|
+
return onError(makeError('notloaded', 'Module name "' +
|
1408
|
+
id +
|
1409
|
+
'" has not been loaded yet for context: ' +
|
1410
|
+
contextName +
|
1411
|
+
(relMap ? '' : '. Use require([])')));
|
1412
|
+
}
|
1413
|
+
return defined[id];
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
//Grab defines waiting in the global queue.
|
1417
|
+
intakeDefines();
|
1418
|
+
|
1419
|
+
//Mark all the dependencies as needing to be loaded.
|
1420
|
+
context.nextTick(function () {
|
1421
|
+
//Some defines could have been added since the
|
1422
|
+
//require call, collect them.
|
1423
|
+
intakeDefines();
|
1424
|
+
|
1425
|
+
requireMod = getModule(makeModuleMap(null, relMap));
|
1426
|
+
|
1427
|
+
//Store if map config should be applied to this require
|
1428
|
+
//call for dependencies.
|
1429
|
+
requireMod.skipMap = options.skipMap;
|
1430
|
+
|
1431
|
+
requireMod.init(deps, callback, errback, {
|
1432
|
+
enabled: true
|
1433
|
+
});
|
1434
|
+
|
1435
|
+
checkLoaded();
|
1436
|
+
});
|
1437
|
+
|
1438
|
+
return localRequire;
|
1439
|
+
}
|
1440
|
+
|
1441
|
+
mixin(localRequire, {
|
1442
|
+
isBrowser: isBrowser,
|
1443
|
+
|
1444
|
+
/**
|
1445
|
+
* Converts a module name + .extension into an URL path.
|
1446
|
+
* *Requires* the use of a module name. It does not support using
|
1447
|
+
* plain URLs like nameToUrl.
|
1448
|
+
*/
|
1449
|
+
toUrl: function (moduleNamePlusExt) {
|
1450
|
+
var ext,
|
1451
|
+
index = moduleNamePlusExt.lastIndexOf('.'),
|
1452
|
+
segment = moduleNamePlusExt.split('/')[0],
|
1453
|
+
isRelative = segment === '.' || segment === '..';
|
1454
|
+
|
1455
|
+
//Have a file extension alias, and it is not the
|
1456
|
+
//dots from a relative path.
|
1457
|
+
if (index !== -1 && (!isRelative || index > 1)) {
|
1458
|
+
ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
|
1459
|
+
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
return context.nameToUrl(normalize(moduleNamePlusExt,
|
1463
|
+
relMap && relMap.id, true), ext, true);
|
1464
|
+
},
|
1465
|
+
|
1466
|
+
defined: function (id) {
|
1467
|
+
return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
|
1468
|
+
},
|
1469
|
+
|
1470
|
+
specified: function (id) {
|
1471
|
+
id = makeModuleMap(id, relMap, false, true).id;
|
1472
|
+
return hasProp(defined, id) || hasProp(registry, id);
|
1473
|
+
}
|
1474
|
+
});
|
1475
|
+
|
1476
|
+
//Only allow undef on top level require calls
|
1477
|
+
if (!relMap) {
|
1478
|
+
localRequire.undef = function (id) {
|
1479
|
+
//Bind any waiting define() calls to this context,
|
1480
|
+
//fix for #408
|
1481
|
+
takeGlobalQueue();
|
1482
|
+
|
1483
|
+
var map = makeModuleMap(id, relMap, true),
|
1484
|
+
mod = getOwn(registry, id);
|
1485
|
+
|
1486
|
+
removeScript(id);
|
1487
|
+
|
1488
|
+
delete defined[id];
|
1489
|
+
delete urlFetched[map.url];
|
1490
|
+
delete undefEvents[id];
|
1491
|
+
|
1492
|
+
//Clean queued defines too. Go backwards
|
1493
|
+
//in array so that the splices do not
|
1494
|
+
//mess up the iteration.
|
1495
|
+
eachReverse(defQueue, function(args, i) {
|
1496
|
+
if(args[0] === id) {
|
1497
|
+
defQueue.splice(i, 1);
|
1498
|
+
}
|
1499
|
+
});
|
1500
|
+
|
1501
|
+
if (mod) {
|
1502
|
+
//Hold on to listeners in case the
|
1503
|
+
//module will be attempted to be reloaded
|
1504
|
+
//using a different config.
|
1505
|
+
if (mod.events.defined) {
|
1506
|
+
undefEvents[id] = mod.events;
|
1507
|
+
}
|
1508
|
+
|
1509
|
+
cleanRegistry(id);
|
1510
|
+
}
|
1511
|
+
};
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
return localRequire;
|
1515
|
+
},
|
1516
|
+
|
1517
|
+
/**
|
1518
|
+
* Called to enable a module if it is still in the registry
|
1519
|
+
* awaiting enablement. A second arg, parent, the parent module,
|
1520
|
+
* is passed in for context, when this method is overridden by
|
1521
|
+
* the optimizer. Not shown here to keep code compact.
|
1522
|
+
*/
|
1523
|
+
enable: function (depMap) {
|
1524
|
+
var mod = getOwn(registry, depMap.id);
|
1525
|
+
if (mod) {
|
1526
|
+
getModule(depMap).enable();
|
1527
|
+
}
|
1528
|
+
},
|
1529
|
+
|
1530
|
+
/**
|
1531
|
+
* Internal method used by environment adapters to complete a load event.
|
1532
|
+
* A load event could be a script load or just a load pass from a synchronous
|
1533
|
+
* load call.
|
1534
|
+
* @param {String} moduleName the name of the module to potentially complete.
|
1535
|
+
*/
|
1536
|
+
completeLoad: function (moduleName) {
|
1537
|
+
var found, args, mod,
|
1538
|
+
shim = getOwn(config.shim, moduleName) || {},
|
1539
|
+
shExports = shim.exports;
|
1540
|
+
|
1541
|
+
takeGlobalQueue();
|
1542
|
+
|
1543
|
+
while (defQueue.length) {
|
1544
|
+
args = defQueue.shift();
|
1545
|
+
if (args[0] === null) {
|
1546
|
+
args[0] = moduleName;
|
1547
|
+
//If already found an anonymous module and bound it
|
1548
|
+
//to this name, then this is some other anon module
|
1549
|
+
//waiting for its completeLoad to fire.
|
1550
|
+
if (found) {
|
1551
|
+
break;
|
1552
|
+
}
|
1553
|
+
found = true;
|
1554
|
+
} else if (args[0] === moduleName) {
|
1555
|
+
//Found matching define call for this script!
|
1556
|
+
found = true;
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
callGetModule(args);
|
1560
|
+
}
|
1561
|
+
|
1562
|
+
//Do this after the cycle of callGetModule in case the result
|
1563
|
+
//of those calls/init calls changes the registry.
|
1564
|
+
mod = getOwn(registry, moduleName);
|
1565
|
+
|
1566
|
+
if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
|
1567
|
+
if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
|
1568
|
+
if (hasPathFallback(moduleName)) {
|
1569
|
+
return;
|
1570
|
+
} else {
|
1571
|
+
return onError(makeError('nodefine',
|
1572
|
+
'No define call for ' + moduleName,
|
1573
|
+
null,
|
1574
|
+
[moduleName]));
|
1575
|
+
}
|
1576
|
+
} else {
|
1577
|
+
//A script that does not call define(), so just simulate
|
1578
|
+
//the call for it.
|
1579
|
+
callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
|
1580
|
+
}
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
checkLoaded();
|
1584
|
+
},
|
1585
|
+
|
1586
|
+
/**
|
1587
|
+
* Converts a module name to a file path. Supports cases where
|
1588
|
+
* moduleName may actually be just an URL.
|
1589
|
+
* Note that it **does not** call normalize on the moduleName,
|
1590
|
+
* it is assumed to have already been normalized. This is an
|
1591
|
+
* internal API, not a public one. Use toUrl for the public API.
|
1592
|
+
*/
|
1593
|
+
nameToUrl: function (moduleName, ext, skipExt) {
|
1594
|
+
var paths, syms, i, parentModule, url,
|
1595
|
+
parentPath, bundleId,
|
1596
|
+
pkgMain = getOwn(config.pkgs, moduleName);
|
1597
|
+
|
1598
|
+
if (pkgMain) {
|
1599
|
+
moduleName = pkgMain;
|
1600
|
+
}
|
1601
|
+
|
1602
|
+
bundleId = getOwn(bundlesMap, moduleName);
|
1603
|
+
|
1604
|
+
if (bundleId) {
|
1605
|
+
return context.nameToUrl(bundleId, ext, skipExt);
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
//If a colon is in the URL, it indicates a protocol is used and it is just
|
1609
|
+
//an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
|
1610
|
+
//or ends with .js, then assume the user meant to use an url and not a module id.
|
1611
|
+
//The slash is important for protocol-less URLs as well as full paths.
|
1612
|
+
if (req.jsExtRegExp.test(moduleName)) {
|
1613
|
+
//Just a plain path, not module name lookup, so just return it.
|
1614
|
+
//Add extension if it is included. This is a bit wonky, only non-.js things pass
|
1615
|
+
//an extension, this method probably needs to be reworked.
|
1616
|
+
url = moduleName + (ext || '');
|
1617
|
+
} else {
|
1618
|
+
//A module that needs to be converted to a path.
|
1619
|
+
paths = config.paths;
|
1620
|
+
|
1621
|
+
syms = moduleName.split('/');
|
1622
|
+
//For each module name segment, see if there is a path
|
1623
|
+
//registered for it. Start with most specific name
|
1624
|
+
//and work up from it.
|
1625
|
+
for (i = syms.length; i > 0; i -= 1) {
|
1626
|
+
parentModule = syms.slice(0, i).join('/');
|
1627
|
+
|
1628
|
+
parentPath = getOwn(paths, parentModule);
|
1629
|
+
if (parentPath) {
|
1630
|
+
//If an array, it means there are a few choices,
|
1631
|
+
//Choose the one that is desired
|
1632
|
+
if (isArray(parentPath)) {
|
1633
|
+
parentPath = parentPath[0];
|
1634
|
+
}
|
1635
|
+
syms.splice(0, i, parentPath);
|
1636
|
+
break;
|
1637
|
+
}
|
1638
|
+
}
|
1639
|
+
|
1640
|
+
//Join the path parts together, then figure out if baseUrl is needed.
|
1641
|
+
url = syms.join('/');
|
1642
|
+
url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
|
1643
|
+
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
return config.urlArgs ? url +
|
1647
|
+
((url.indexOf('?') === -1 ? '?' : '&') +
|
1648
|
+
config.urlArgs) : url;
|
1649
|
+
},
|
1650
|
+
|
1651
|
+
//Delegates to req.load. Broken out as a separate function to
|
1652
|
+
//allow overriding in the optimizer.
|
1653
|
+
load: function (id, url) {
|
1654
|
+
req.load(context, id, url);
|
1655
|
+
},
|
1656
|
+
|
1657
|
+
/**
|
1658
|
+
* Executes a module callback function. Broken out as a separate function
|
1659
|
+
* solely to allow the build system to sequence the files in the built
|
1660
|
+
* layer in the right sequence.
|
1661
|
+
*
|
1662
|
+
* @private
|
1663
|
+
*/
|
1664
|
+
execCb: function (name, callback, args, exports) {
|
1665
|
+
return callback.apply(exports, args);
|
1666
|
+
},
|
1667
|
+
|
1668
|
+
/**
|
1669
|
+
* callback for script loads, used to check status of loading.
|
1670
|
+
*
|
1671
|
+
* @param {Event} evt the event from the browser for the script
|
1672
|
+
* that was loaded.
|
1673
|
+
*/
|
1674
|
+
onScriptLoad: function (evt) {
|
1675
|
+
//Using currentTarget instead of target for Firefox 2.0's sake. Not
|
1676
|
+
//all old browsers will be supported, but this one was easy enough
|
1677
|
+
//to support and still makes sense.
|
1678
|
+
if (evt.type === 'load' ||
|
1679
|
+
(readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
|
1680
|
+
//Reset interactive script so a script node is not held onto for
|
1681
|
+
//to long.
|
1682
|
+
interactiveScript = null;
|
1683
|
+
|
1684
|
+
//Pull out the name of the module and the context.
|
1685
|
+
var data = getScriptData(evt);
|
1686
|
+
context.completeLoad(data.id);
|
1687
|
+
}
|
1688
|
+
},
|
1689
|
+
|
1690
|
+
/**
|
1691
|
+
* Callback for script errors.
|
1692
|
+
*/
|
1693
|
+
onScriptError: function (evt) {
|
1694
|
+
var data = getScriptData(evt);
|
1695
|
+
if (!hasPathFallback(data.id)) {
|
1696
|
+
return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id]));
|
1697
|
+
}
|
1698
|
+
}
|
1699
|
+
};
|
1700
|
+
|
1701
|
+
context.require = context.makeRequire();
|
1702
|
+
return context;
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
/**
|
1706
|
+
* Main entry point.
|
1707
|
+
*
|
1708
|
+
* If the only argument to require is a string, then the module that
|
1709
|
+
* is represented by that string is fetched for the appropriate context.
|
1710
|
+
*
|
1711
|
+
* If the first argument is an array, then it will be treated as an array
|
1712
|
+
* of dependency string names to fetch. An optional function callback can
|
1713
|
+
* be specified to execute when all of those dependencies are available.
|
1714
|
+
*
|
1715
|
+
* Make a local req variable to help Caja compliance (it assumes things
|
1716
|
+
* on a require that are not standardized), and to give a short
|
1717
|
+
* name for minification/local scope use.
|
1718
|
+
*/
|
1719
|
+
req = requirejs = function (deps, callback, errback, optional) {
|
1720
|
+
|
1721
|
+
//Find the right context, use default
|
1722
|
+
var context, config,
|
1723
|
+
contextName = defContextName;
|
1724
|
+
|
1725
|
+
// Determine if have config object in the call.
|
1726
|
+
if (!isArray(deps) && typeof deps !== 'string') {
|
1727
|
+
// deps is a config object
|
1728
|
+
config = deps;
|
1729
|
+
if (isArray(callback)) {
|
1730
|
+
// Adjust args if there are dependencies
|
1731
|
+
deps = callback;
|
1732
|
+
callback = errback;
|
1733
|
+
errback = optional;
|
1734
|
+
} else {
|
1735
|
+
deps = [];
|
1736
|
+
}
|
1737
|
+
}
|
1738
|
+
|
1739
|
+
if (config && config.context) {
|
1740
|
+
contextName = config.context;
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
context = getOwn(contexts, contextName);
|
1744
|
+
if (!context) {
|
1745
|
+
context = contexts[contextName] = req.s.newContext(contextName);
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
if (config) {
|
1749
|
+
context.configure(config);
|
1750
|
+
}
|
1751
|
+
|
1752
|
+
return context.require(deps, callback, errback);
|
1753
|
+
};
|
1754
|
+
|
1755
|
+
/**
|
1756
|
+
* Support require.config() to make it easier to cooperate with other
|
1757
|
+
* AMD loaders on globally agreed names.
|
1758
|
+
*/
|
1759
|
+
req.config = function (config) {
|
1760
|
+
return req(config);
|
1761
|
+
};
|
1762
|
+
|
1763
|
+
/**
|
1764
|
+
* Execute something after the current tick
|
1765
|
+
* of the event loop. Override for other envs
|
1766
|
+
* that have a better solution than setTimeout.
|
1767
|
+
* @param {Function} fn function to execute later.
|
1768
|
+
*/
|
1769
|
+
req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
|
1770
|
+
setTimeout(fn, 4);
|
1771
|
+
} : function (fn) { fn(); };
|
1772
|
+
|
1773
|
+
/**
|
1774
|
+
* Export require as a global, but only if it does not already exist.
|
1775
|
+
*/
|
1776
|
+
if (!require) {
|
1777
|
+
require = req;
|
1778
|
+
}
|
1779
|
+
|
1780
|
+
req.version = version;
|
1781
|
+
|
1782
|
+
//Used to filter out dependencies that are already paths.
|
1783
|
+
req.jsExtRegExp = /^\/|:|\?|\.js$/;
|
1784
|
+
req.isBrowser = isBrowser;
|
1785
|
+
s = req.s = {
|
1786
|
+
contexts: contexts,
|
1787
|
+
newContext: newContext
|
1788
|
+
};
|
1789
|
+
|
1790
|
+
//Create default context.
|
1791
|
+
req({});
|
1792
|
+
|
1793
|
+
//Exports some context-sensitive methods on global require.
|
1794
|
+
each([
|
1795
|
+
'toUrl',
|
1796
|
+
'undef',
|
1797
|
+
'defined',
|
1798
|
+
'specified'
|
1799
|
+
], function (prop) {
|
1800
|
+
//Reference from contexts instead of early binding to default context,
|
1801
|
+
//so that during builds, the latest instance of the default context
|
1802
|
+
//with its config gets used.
|
1803
|
+
req[prop] = function () {
|
1804
|
+
var ctx = contexts[defContextName];
|
1805
|
+
return ctx.require[prop].apply(ctx, arguments);
|
1806
|
+
};
|
1807
|
+
});
|
1808
|
+
|
1809
|
+
if (isBrowser) {
|
1810
|
+
head = s.head = document.getElementsByTagName('head')[0];
|
1811
|
+
//If BASE tag is in play, using appendChild is a problem for IE6.
|
1812
|
+
//When that browser dies, this can be removed. Details in this jQuery bug:
|
1813
|
+
//http://dev.jquery.com/ticket/2709
|
1814
|
+
baseElement = document.getElementsByTagName('base')[0];
|
1815
|
+
if (baseElement) {
|
1816
|
+
head = s.head = baseElement.parentNode;
|
1817
|
+
}
|
1818
|
+
}
|
1819
|
+
|
1820
|
+
/**
|
1821
|
+
* Any errors that require explicitly generates will be passed to this
|
1822
|
+
* function. Intercept/override it if you want custom error handling.
|
1823
|
+
* @param {Error} err the error object.
|
1824
|
+
*/
|
1825
|
+
req.onError = defaultOnError;
|
1826
|
+
|
1827
|
+
/**
|
1828
|
+
* Creates the node for the load command. Only used in browser envs.
|
1829
|
+
*/
|
1830
|
+
req.createNode = function (config, moduleName, url) {
|
1831
|
+
var node = config.xhtml ?
|
1832
|
+
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
1833
|
+
document.createElement('script');
|
1834
|
+
node.type = config.scriptType || 'text/javascript';
|
1835
|
+
node.charset = 'utf-8';
|
1836
|
+
node.async = true;
|
1837
|
+
return node;
|
1838
|
+
};
|
1839
|
+
|
1840
|
+
/**
|
1841
|
+
* Does the request to load a module for the browser case.
|
1842
|
+
* Make this a separate function to allow other environments
|
1843
|
+
* to override it.
|
1844
|
+
*
|
1845
|
+
* @param {Object} context the require context to find state.
|
1846
|
+
* @param {String} moduleName the name of the module.
|
1847
|
+
* @param {Object} url the URL to the module.
|
1848
|
+
*/
|
1849
|
+
req.load = function (context, moduleName, url) {
|
1850
|
+
var config = (context && context.config) || {},
|
1851
|
+
node;
|
1852
|
+
if (isBrowser) {
|
1853
|
+
//In the browser so use a script tag
|
1854
|
+
node = req.createNode(config, moduleName, url);
|
1855
|
+
|
1856
|
+
node.setAttribute('data-requirecontext', context.contextName);
|
1857
|
+
node.setAttribute('data-requiremodule', moduleName);
|
1858
|
+
|
1859
|
+
//Set up load listener. Test attachEvent first because IE9 has
|
1860
|
+
//a subtle issue in its addEventListener and script onload firings
|
1861
|
+
//that do not match the behavior of all other browsers with
|
1862
|
+
//addEventListener support, which fire the onload event for a
|
1863
|
+
//script right after the script execution. See:
|
1864
|
+
//https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
|
1865
|
+
//UNFORTUNATELY Opera implements attachEvent but does not follow the script
|
1866
|
+
//script execution mode.
|
1867
|
+
if (node.attachEvent &&
|
1868
|
+
//Check if node.attachEvent is artificially added by custom script or
|
1869
|
+
//natively supported by browser
|
1870
|
+
//read https://github.com/jrburke/requirejs/issues/187
|
1871
|
+
//if we can NOT find [native code] then it must NOT natively supported.
|
1872
|
+
//in IE8, node.attachEvent does not have toString()
|
1873
|
+
//Note the test for "[native code" with no closing brace, see:
|
1874
|
+
//https://github.com/jrburke/requirejs/issues/273
|
1875
|
+
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
|
1876
|
+
!isOpera) {
|
1877
|
+
//Probably IE. IE (at least 6-8) do not fire
|
1878
|
+
//script onload right after executing the script, so
|
1879
|
+
//we cannot tie the anonymous define call to a name.
|
1880
|
+
//However, IE reports the script as being in 'interactive'
|
1881
|
+
//readyState at the time of the define call.
|
1882
|
+
useInteractive = true;
|
1883
|
+
|
1884
|
+
node.attachEvent('onreadystatechange', context.onScriptLoad);
|
1885
|
+
//It would be great to add an error handler here to catch
|
1886
|
+
//404s in IE9+. However, onreadystatechange will fire before
|
1887
|
+
//the error handler, so that does not help. If addEventListener
|
1888
|
+
//is used, then IE will fire error before load, but we cannot
|
1889
|
+
//use that pathway given the connect.microsoft.com issue
|
1890
|
+
//mentioned above about not doing the 'script execute,
|
1891
|
+
//then fire the script load event listener before execute
|
1892
|
+
//next script' that other browsers do.
|
1893
|
+
//Best hope: IE10 fixes the issues,
|
1894
|
+
//and then destroys all installs of IE 6-9.
|
1895
|
+
//node.attachEvent('onerror', context.onScriptError);
|
1896
|
+
} else {
|
1897
|
+
node.addEventListener('load', context.onScriptLoad, false);
|
1898
|
+
node.addEventListener('error', context.onScriptError, false);
|
1899
|
+
}
|
1900
|
+
node.src = url;
|
1901
|
+
|
1902
|
+
//For some cache cases in IE 6-8, the script executes before the end
|
1903
|
+
//of the appendChild execution, so to tie an anonymous define
|
1904
|
+
//call to the module name (which is stored on the node), hold on
|
1905
|
+
//to a reference to this node, but clear after the DOM insertion.
|
1906
|
+
currentlyAddingScript = node;
|
1907
|
+
if (baseElement) {
|
1908
|
+
head.insertBefore(node, baseElement);
|
1909
|
+
} else {
|
1910
|
+
head.appendChild(node);
|
1911
|
+
}
|
1912
|
+
currentlyAddingScript = null;
|
1913
|
+
|
1914
|
+
return node;
|
1915
|
+
} else if (isWebWorker) {
|
1916
|
+
try {
|
1917
|
+
//In a web worker, use importScripts. This is not a very
|
1918
|
+
//efficient use of importScripts, importScripts will block until
|
1919
|
+
//its script is downloaded and evaluated. However, if web workers
|
1920
|
+
//are in play, the expectation that a build has been done so that
|
1921
|
+
//only one script needs to be loaded anyway. This may need to be
|
1922
|
+
//reevaluated if other use cases become common.
|
1923
|
+
importScripts(url);
|
1924
|
+
|
1925
|
+
//Account for anonymous modules
|
1926
|
+
context.completeLoad(moduleName);
|
1927
|
+
} catch (e) {
|
1928
|
+
context.onError(makeError('importscripts',
|
1929
|
+
'importScripts failed for ' +
|
1930
|
+
moduleName + ' at ' + url,
|
1931
|
+
e,
|
1932
|
+
[moduleName]));
|
1933
|
+
}
|
1934
|
+
}
|
1935
|
+
};
|
1936
|
+
|
1937
|
+
function getInteractiveScript() {
|
1938
|
+
if (interactiveScript && interactiveScript.readyState === 'interactive') {
|
1939
|
+
return interactiveScript;
|
1940
|
+
}
|
1941
|
+
|
1942
|
+
eachReverse(scripts(), function (script) {
|
1943
|
+
if (script.readyState === 'interactive') {
|
1944
|
+
return (interactiveScript = script);
|
1945
|
+
}
|
1946
|
+
});
|
1947
|
+
return interactiveScript;
|
1948
|
+
}
|
1949
|
+
|
1950
|
+
//Look for a data-main script attribute, which could also adjust the baseUrl.
|
1951
|
+
if (isBrowser && !cfg.skipDataMain) {
|
1952
|
+
//Figure out baseUrl. Get it from the script tag with require.js in it.
|
1953
|
+
eachReverse(scripts(), function (script) {
|
1954
|
+
//Set the 'head' where we can append children by
|
1955
|
+
//using the script's parent.
|
1956
|
+
if (!head) {
|
1957
|
+
head = script.parentNode;
|
1958
|
+
}
|
1959
|
+
|
1960
|
+
//Look for a data-main attribute to set main script for the page
|
1961
|
+
//to load. If it is there, the path to data main becomes the
|
1962
|
+
//baseUrl, if it is not already set.
|
1963
|
+
dataMain = script.getAttribute('data-main');
|
1964
|
+
if (dataMain) {
|
1965
|
+
//Preserve dataMain in case it is a path (i.e. contains '?')
|
1966
|
+
mainScript = dataMain;
|
1967
|
+
|
1968
|
+
//Set final baseUrl if there is not already an explicit one.
|
1969
|
+
if (!cfg.baseUrl) {
|
1970
|
+
//Pull off the directory of data-main for use as the
|
1971
|
+
//baseUrl.
|
1972
|
+
src = mainScript.split('/');
|
1973
|
+
mainScript = src.pop();
|
1974
|
+
subPath = src.length ? src.join('/') + '/' : './';
|
1975
|
+
|
1976
|
+
cfg.baseUrl = subPath;
|
1977
|
+
}
|
1978
|
+
|
1979
|
+
//Strip off any trailing .js since mainScript is now
|
1980
|
+
//like a module name.
|
1981
|
+
mainScript = mainScript.replace(jsSuffixRegExp, '');
|
1982
|
+
|
1983
|
+
//If mainScript is still a path, fall back to dataMain
|
1984
|
+
if (req.jsExtRegExp.test(mainScript)) {
|
1985
|
+
mainScript = dataMain;
|
1986
|
+
}
|
1987
|
+
|
1988
|
+
//Put the data-main script in the files to load.
|
1989
|
+
cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
|
1990
|
+
|
1991
|
+
return true;
|
1992
|
+
}
|
1993
|
+
});
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
/**
|
1997
|
+
* The function that handles definitions of modules. Differs from
|
1998
|
+
* require() in that a string for the module should be the first argument,
|
1999
|
+
* and the function to execute after dependencies are loaded should
|
2000
|
+
* return a value to define the module corresponding to the first argument's
|
2001
|
+
* name.
|
2002
|
+
*/
|
2003
|
+
define = function (name, deps, callback) {
|
2004
|
+
var node, context;
|
2005
|
+
|
2006
|
+
//Allow for anonymous modules
|
2007
|
+
if (typeof name !== 'string') {
|
2008
|
+
//Adjust args appropriately
|
2009
|
+
callback = deps;
|
2010
|
+
deps = name;
|
2011
|
+
name = null;
|
2012
|
+
}
|
2013
|
+
|
2014
|
+
//This module may not have dependencies
|
2015
|
+
if (!isArray(deps)) {
|
2016
|
+
callback = deps;
|
2017
|
+
deps = null;
|
2018
|
+
}
|
2019
|
+
|
2020
|
+
//If no name, and callback is a function, then figure out if it a
|
2021
|
+
//CommonJS thing with dependencies.
|
2022
|
+
if (!deps && isFunction(callback)) {
|
2023
|
+
deps = [];
|
2024
|
+
//Remove comments from the callback string,
|
2025
|
+
//look for require calls, and pull them into the dependencies,
|
2026
|
+
//but only if there are function args.
|
2027
|
+
if (callback.length) {
|
2028
|
+
callback
|
2029
|
+
.toString()
|
2030
|
+
.replace(commentRegExp, '')
|
2031
|
+
.replace(cjsRequireRegExp, function (match, dep) {
|
2032
|
+
deps.push(dep);
|
2033
|
+
});
|
2034
|
+
|
2035
|
+
//May be a CommonJS thing even without require calls, but still
|
2036
|
+
//could use exports, and module. Avoid doing exports and module
|
2037
|
+
//work though if it just needs require.
|
2038
|
+
//REQUIRES the function to expect the CommonJS variables in the
|
2039
|
+
//order listed below.
|
2040
|
+
deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
|
2041
|
+
}
|
2042
|
+
}
|
2043
|
+
|
2044
|
+
//If in IE 6-8 and hit an anonymous define() call, do the interactive
|
2045
|
+
//work.
|
2046
|
+
if (useInteractive) {
|
2047
|
+
node = currentlyAddingScript || getInteractiveScript();
|
2048
|
+
if (node) {
|
2049
|
+
if (!name) {
|
2050
|
+
name = node.getAttribute('data-requiremodule');
|
2051
|
+
}
|
2052
|
+
context = contexts[node.getAttribute('data-requirecontext')];
|
2053
|
+
}
|
2054
|
+
}
|
2055
|
+
|
2056
|
+
//Always save off evaluating the def call until the script onload handler.
|
2057
|
+
//This allows multiple modules to be in a file without prematurely
|
2058
|
+
//tracing dependencies, and allows for anonymous module support,
|
2059
|
+
//where the module name is not known until the script onload event
|
2060
|
+
//occurs. If no context, use the global queue, and get it processed
|
2061
|
+
//in the onscript load callback.
|
2062
|
+
(context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
|
2063
|
+
};
|
2064
|
+
|
2065
|
+
define.amd = {
|
2066
|
+
jQuery: true
|
2067
|
+
};
|
2068
|
+
|
2069
|
+
|
2070
|
+
/**
|
2071
|
+
* Executes the text. Normally just uses eval, but can be modified
|
2072
|
+
* to use a better, environment-specific call. Only used for transpiling
|
2073
|
+
* loader plugins, not for plain JS modules.
|
2074
|
+
* @param {String} text the text to execute/evaluate.
|
2075
|
+
*/
|
2076
|
+
req.exec = function (text) {
|
2077
|
+
/*jslint evil: true */
|
2078
|
+
return eval(text);
|
2079
|
+
};
|
2080
|
+
|
2081
|
+
//Set up with config info.
|
2082
|
+
req(cfg);
|
2083
|
+
}(this));
|