liferay-amd-loader
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -13,2 +13,3 @@ { | ||
"object-curly-spacing": "off", | ||
"prefer-spread": "off", | ||
"quote-props": ["error", "as-needed"], | ||
@@ -15,0 +16,0 @@ "quotes": ["error", "single", { |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.ES6Promise=t()}(this,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function t(e){return"function"==typeof e}function n(e){K=e}function r(e){z=e}function o(){return function(){return process.nextTick(l)}}function i(){return"undefined"!=typeof Y?function(){Y(l)}:a()}function s(){var e=0,t=new Q(l),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function u(){var e=new MessageChannel;return e.port1.onmessage=l,function(){return e.port2.postMessage(0)}}function a(){var e=setTimeout;return function(){return e(l,1)}}function l(){for(var e=0;e<V;e+=2){var t=$[e],n=$[e+1];t(n),$[e]=void 0,$[e+1]=void 0}V=0}function c(){try{var e=require,t=e("vertx");return Y=t.runOnLoop||t.runOnContext,i()}catch(n){return a()}}function f(e,t){var n=arguments,r=this,o=new this.constructor(p);void 0===o[te]&&q(o);var i=r._state;return i?!function(){var e=n[i-1];z(function(){return A(i,o,e,r._result)})}():C(r,o,e,t),o}function d(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(p);return b(n,e),n}function p(){}function h(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function g(e){try{return e.then}catch(t){return ie.error=t,ie}}function m(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function v(e,t,n){z(function(e){var r=!1,o=m(n,t,function(n){r||(r=!0,t!==n?b(e,n):P(e,n))},function(t){r||(r=!0,x(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,x(e,o))},e)}function y(e,t){t._state===re?P(e,t._result):t._state===oe?x(e,t._result):C(t,void 0,function(t){return b(e,t)},function(t){return x(e,t)})}function M(e,n,r){n.constructor===e.constructor&&r===f&&n.constructor.resolve===d?y(e,n):r===ie?(x(e,ie.error),ie.error=null):void 0===r?P(e,n):t(r)?v(e,n,r):P(e,n)}function b(t,n){t===n?x(t,h()):e(n)?M(t,n,g(n)):P(t,n)}function w(e){e._onerror&&e._onerror(e._result),O(e)}function P(e,t){e._state===ne&&(e._result=t,e._state=re,0!==e._subscribers.length&&z(O,e))}function x(e,t){e._state===ne&&(e._state=oe,e._result=t,z(w,e))}function C(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+re]=n,o[i+oe]=r,0===i&&e._state&&z(O,e)}function O(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,o=void 0,i=e._result,s=0;s<t.length;s+=3)r=t[s],o=t[s+n],r?A(n,r,o,i):o(i);e._subscribers.length=0}}function L(){this.error=null}function j(e,t){try{return e(t)}catch(n){return se.error=n,se}}function A(e,n,r,o){var i=t(r),s=void 0,u=void 0,a=void 0,l=void 0;if(i){if(s=j(r,o),s===se?(l=!0,u=s.error,s.error=null):a=!0,n===s)return void x(n,_())}else s=o,a=!0;n._state!==ne||(i&&a?b(n,s):l?x(n,u):e===re?P(n,s):e===oe&&x(n,s))}function R(e,t){try{t(function(t){b(e,t)},function(t){x(e,t)})}catch(n){x(e,n)}}function E(){return ue++}function q(e){e[te]=ue++,e._state=void 0,e._result=void 0,e._subscribers=[]}function I(e,t){this._instanceConstructor=e,this.promise=new e(p),this.promise[te]||q(this.promise),W(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&P(this.promise,this._result))):x(this.promise,S())}function S(){return new Error("Array Methods must be provided an Array")}function B(e){return new I(this,e).promise}function F(e){var t=this;return new t(W(e)?function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function k(e){var t=this,n=new t(p);return x(n,e),n}function G(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function D(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(e){this[te]=E(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&G(),this instanceof N?R(this,e):D())}function U(){var e=void 0;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===r&&!n.cast)return}e.Promise=N}var T=void 0;T=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var W=T,V=0,Y=void 0,K=void 0,z=function(e,t){$[V]=e,$[V+1]=t,V+=2,2===V&&(K?K(l):ee())},H="undefined"!=typeof window?window:void 0,J=H||{},Q=J.MutationObserver||J.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),ee=void 0;ee=X?o():Q?s():Z?u():void 0===H&&"function"==typeof require?c():a();var te=Math.random().toString(36).substring(16),ne=void 0,re=1,oe=2,ie=new L,se=new L,ue=0;return I.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ne&&n<e;n++)this._eachEntry(t[n],n)},I.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===d){var o=g(e);if(o===f&&e._state!==ne)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===N){var i=new n(p);M(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},I.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===ne&&(this._remaining--,e===oe?x(r,n):this._result[t]=n),0===this._remaining&&P(r,this._result)},I.prototype._willSettleAt=function(e,t){var n=this;C(e,void 0,function(e){return n._settledAt(re,t,e)},function(e){return n._settledAt(oe,t,e)})},N.all=B,N.race=F,N.resolve=d,N.reject=k,N._setScheduler=n,N._setAsap=r,N._asap=z,N.prototype={constructor:N,then:f,"catch":function(e){return this.then(null,e)}},N.polyfill=U,N.Promise=N,N}),function(){var global={};global.__CONFIG__=window.__CONFIG__,function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.EventEmitter=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){this._events={}}return t.prototype={constructor:t,on:function(e,t){var n=this._events[e]=this._events[e]||[];n.push(t)},off:function(e,t){var n=this._events[e];if(n){var r=n.indexOf(t);r>-1&&n.splice(r,1)}},emit:function(e,t){var n=this._events[e];if(n){n=n.slice(0);for(var r=0;r<n.length;r++){var o=n[r];o.call(o,t)}}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.ConfigParser=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._config={},this._modules={},this._conditionalModules={},this._parseConfig(e)}return t.prototype={constructor:t,addModule:function(e){var t=this._modules[e.name];if(t)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);else this._modules[e.name]=e;return this._registerConditionalModule(e),this._modules[e.name]},getConfig:function(){return this._config},getConditionalModules:function(){return this._conditionalModules},getModules:function(){return this._modules},mapModule:function(e,t){if(!this._config.maps&&!t)return e;var n;return n=Array.isArray(e)?e:[e],t&&(n=n.map(this._getModuleMapper(t))),this._config.maps&&(n=n.map(this._getModuleMapper(this._config.maps))),Array.isArray(e)?n:n[0]},_getModuleMapper:function(e){return function(t){var n;return n=this._mapExactMatch(t,e),n||(n=this._mapPartialMatch(t,e)),n||(n=this._mapWildcardMatch(t,e)),n||t}.bind(this)},_mapExactMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}},_mapPartialMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}},_mapWildcardMatch:function(e,t){if("function"==typeof t["*"])return t["*"](e)},_parseConfig:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&("modules"===t?this._parseModules(e[t]):this._config[t]=e[t]);return this._config},_parseModules:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];n.name=t,this.addModule(n)}return this._modules},_registerConditionalModule:function(e){if(e.condition){var t=this._conditionalModules[e.condition.trigger];t||(this._conditionalModules[e.condition.trigger]=t=[]),t.push(e.name)}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.DependencyBuilder=n}("undefined"!=typeof global?global:this,function(global){"use strict";function DependencyBuilder(e){this._configParser=e,this._pathResolver=new global.PathResolver,this._result=[]}var hasOwnProperty=Object.prototype.hasOwnProperty;return DependencyBuilder.prototype={constructor:DependencyBuilder,resolveDependencies:function(e){this._queue=e.slice(0);var t;try{this._resolveDependencies(),t=this._result.reverse().slice(0)}finally{this._cleanup()}return t},_cleanup:function(){var e=this._configParser.getModules();for(var t in e)if(hasOwnProperty.call(e,t)){var n=e[t];n.conditionalMark=!1,n.mark=!1,n.tmpMark=!1}this._queue.length=0,this._result.length=0},_processConditionalModules:function(e){var t=this._configParser.getConditionalModules()[e.name];if(t&&!e.conditionalMark){for(var n=this._configParser.getModules(),r=0;r<t.length;r++){var o=n[t[r]];this._queue.indexOf(o.name)===-1&&this._testConditionalModule(o.condition.test)&&this._queue.push(o.name)}e.conditionalMark=!0}},_resolveDependencies:function(){for(var e=this._configParser.getModules(),t=0;t<this._queue.length;t++){var n=e[this._queue[t]];n||(n=this._configParser.addModule({name:this._queue[t],dependencies:[]})),n.mark||this._visit(n)}},_testConditionalModule:function(testFunction){return"function"==typeof testFunction?testFunction():eval("false || "+testFunction)()},_visit:function(e){if(e.tmpMark)throw new Error("Error processing module: "+e.name+". The provided configuration is not Directed Acyclic Graph.");if(this._processConditionalModules(e),!e.mark){e.tmpMark=!0;for(var t=this._configParser.getModules(),n=0;n<e.dependencies.length;n++){var r=e.dependencies[n];if("require"!==r&&"exports"!==r&&"module"!==r){r=this._pathResolver.resolvePath(e.name,r);var o=this._configParser.mapModule(r,e.map),i=t[o];i||(i=this._configParser.addModule({name:o,dependencies:[]})),this._visit(i)}}e.mark=!0,e.tmpMark=!1,this._result.unshift(e.name)}},_queue:[]},DependencyBuilder}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.URLBuilder=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._configParser=e}var n=/^https?:\/\/|\/\/|www\./;return t.prototype={constructor:t,build:function(e){var t=[],r=[],o=[],i=[],s=[],u=this._configParser.getConfig(),a=u.basePath||"",l=this._configParser.getModules();a.length&&"/"!==a.charAt(a.length-1)&&(a+="/");for(var c=0;c<e.length;c++){var f=l[e[c]];if(f.fullPath)s.push({modules:[f.name],url:this._getURLWithParams(f.fullPath)});else{var d=this._getModulePath(f),p=0===d.indexOf("/");n.test(d)?s.push({modules:[f.name],url:this._getURLWithParams(d)}):!u.combine||f.anonymous?s.push({modules:[f.name],url:this._getURLWithParams(u.url+(p?"":a)+d)}):p?(t.push(d),o.push(f.name)):(r.push(d),i.push(f.name))}f.requested=!0}return r.length&&(s=s.concat(this._generateBufferURLs(i,r,{basePath:a,url:u.url,urlMaxLength:u.urlMaxLength})),r.length=0),t.length&&(s=s.concat(this._generateBufferURLs(o,t,{url:u.url,urlMaxLength:u.urlMaxLength})),t.length=0),s},_generateBufferURLs:function(e,t,n){var r,o=n.basePath||"",i=[],s=n.urlMaxLength||2e3,u={modules:[e[0]],url:n.url+o+t[0]};for(r=1;r<t.length;r++){var a=e[r],l=t[r];u.url.length+o.length+l.length+1<s?(u.modules.push(a),u.url+="&"+o+l):(i.push(u),u={modules:[a],url:n.url+o+l})}return u.url=this._getURLWithParams(u.url),i.push(u),i},_getModulePath:function(e){var t=e.path||e.name,r=this._configParser.getConfig().paths||{},o=!1;return Object.keys(r).forEach(function(e){t!==e&&0!==t.indexOf(e+"/")||(t=r[e]+t.substring(e.length))}),o||"function"!=typeof r["*"]||(t=r["*"](t)),n.test(t)||t.lastIndexOf(".js")===t.length-3||(t+=".js"),t},_getURLWithParams:function(e){var t=this._configParser.getConfig(),n=t.defaultURLParams||{},r=Object.keys(n);if(!r.length)return e;var o=r.map(function(e){return e+"="+n[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+o}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.PathResolver=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){}return t.prototype={constructor:t,resolvePath:function(e,t){if("require"===t||"exports"===t||"module"===t||0!==t.indexOf(".")&&0!==t.indexOf(".."))return t;var n=e.split("/");n.splice(-1,1);for(var r=t.split("/"),o=r.splice(-1,1),i=0;i<r.length;i++){var s=r[i];if("."!==s)if(".."===s){if(!n.length){n=n.concat(r.slice(i));break}n.splice(-1,1)}else n.push(s)}return n.push(o),n.join("/")}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.Loader=new n,e.require=e.Loader.require.bind(e.Loader),e.define=e.Loader.define.bind(e.Loader),e.define.amd={}}("undefined"!=typeof global?global:this,function(e){"use strict";function t(n){t.superclass.constructor.apply(this,arguments),this._config=n||e.__CONFIG__,this._modulesMap={}}t.prototype=Object.create(e.EventEmitter.prototype),t.prototype.constructor=t,t.superclass=e.EventEmitter.prototype;var n={addModule:function(e){return this._getConfigParser().addModule(e)},define:function(){var e=this,t=arguments[0],n=arguments[1],r=arguments[2],o=arguments[3]||{};o.anonymous=!1;var i=arguments.length;if(i<2?(r=arguments[0],n=["module","exports"],o.anonymous=!0):2===i&&("string"==typeof t?(n=["module","exports"],r=arguments[1]):(n=arguments[0],r=arguments[1],o.anonymous=!0)),o.anonymous){var s=function(t){if(e.off("scriptLoaded",s),1!==t.length)e._reportMismatchedAnonymousModules(r.toString());else{var i=t[0],u=e.getModules()[i];u&&u.pendingImplementation&&e._reportMismatchedAnonymousModules(r.toString()),e._define(i,n,r,o)}};e.on("scriptLoaded",s)}else this._define(t,n,r,o)},getConditionalModules:function(){return this._getConfigParser().getConditionalModules()},getModules:function(){return this._getConfigParser().getModules()},require:function(){var e,t,n,r,o=this;if(Array.isArray(arguments[0]))n=arguments[0],r="function"==typeof arguments[1]?arguments[1]:null,e="function"==typeof arguments[2]?arguments[2]:null;else for(n=[],t=0;t<arguments.length;++t)if("string"==typeof arguments[t])n[t]=arguments[t];else if("function"==typeof arguments[t]){r=arguments[t],e="function"==typeof arguments[++t]?arguments[t]:null;break}var i,s=o._getConfigParser(),u=s.mapModule(n);new Promise(function(e,t){o._resolveDependencies(u).then(function(r){var a=s.getConfig();0!==a.waitTimeout&&(i=setTimeout(function(){var e=s.getModules(),o=new Error("Load timeout for modules: "+n);o.dependencies=r,o.mappedModules=u,o.missingDependencies=r.filter(function(t){return"undefined"==typeof e[t].implementation}),o.modules=n,o.dependecies=o.dependencies,t(o)},a.waitTimeout||7e3)),o._loadModules(r).then(e,t)},t)}).then(function(e){if(clearTimeout(i),r){var t=o._getModuleImplementations(u);r.apply(r,t)}},function(t){clearTimeout(i),e&&e.call(e,t)})},_createModulePromise:function(e){var t=this;return new Promise(function(n,r){var o=t._getConfigParser().getModules(),i=o[e];if(i.exports){var s=t._getValueGlobalNS(i.exports);if(s)n(s);else{var u=function(o){if(o.indexOf(e)>=0){t.off("scriptLoaded",u);var s=t._getValueGlobalNS(i.exports);s?n(s):r(new Error("Module "+e+" does not export the specified value: "+i.exports))}};t.on("scriptLoaded",u)}}else{var a=function(r){r===e&&(t.off("moduleRegister",a),t._modulesMap[e]=!0,n(e))};t.on("moduleRegister",a)}})},_define:function(e,t,n,r){var o=r||{},i=this._getConfigParser();if(i.getConfig().ignoreModuleVersion){var s=e.split("/"),u=s[0].split("@");s[0]=u[0],e=s.join("/")}var a=this._getPathResolver();t=t.map(function(t){return a.resolvePath(e,t)}),o.name=e,o.dependencies=t,o.pendingImplementation=n,i.addModule(o),this._modulesMap[o.name]||(this._modulesMap[o.name]=!0),this.emit("moduleRegister",e)},_getConfigParser:function(){return this._configParser||(this._configParser=new e.ConfigParser(this._config)),this._configParser},_getDependencyBuilder:function(){return this._dependencyBuilder||(this._dependencyBuilder=new e.DependencyBuilder(this._getConfigParser())),this._dependencyBuilder},_getValueGlobalNS:function(e){for(var t=e.split("."),n=(0,eval)("this")[t[0]],r=1;n&&r<t.length;r++){if(!Object.prototype.hasOwnProperty.call(n,t[r]))return null;n=n[t[r]]}return n},_getMissingDependencies:function(e){for(var t=this._getConfigParser(),n=t.getModules(),r=Object.create(null),o=0;o<e.length;o++)for(var i=n[e[o]],s=t.mapModule(i.dependencies,i.map),u=0;u<s.length;u++){var a=s[u],l=n[a];"require"===a||"exports"===a||"module"===a||l&&l.pendingImplementation||(r[a]=1)}return Object.keys(r)},_getModuleImplementations:function(e){for(var t=[],n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var o=n[e[r]];t.push(o?o.implementation:void 0)}return t},_getPathResolver:function(){return this._pathResolver||(this._pathResolver=new e.PathResolver),this._pathResolver},_getURLBuilder:function(){return this._urlBuilder||(this._urlBuilder=new e.URLBuilder(this._getConfigParser())),this._urlBuilder},_filterModulesByProperty:function(e,t){var n=t;"string"==typeof t&&(n=[t]);for(var r=[],o=this._getConfigParser().getModules(),i=0;i<e.length;i++){var s=e[i],u=o[e[i]];if(u){if("require"!==u&&"exports"!==u&&"module"!==u){for(var a=0,l=0;l<n.length;l++)if(u[n[l]]){a=!0;break}a||r.push(s)}}else r.push(s)}return r},_loadModules:function(e){var t=this;return new Promise(function(n,r){var o=t._filterModulesByProperty(e,["requested","pendingImplementation"]);if(o.length){for(var i=t._getURLBuilder().build(o),s=[],u=0;u<i.length;u++)s.push(t._loadScript(i[u]));Promise.all(s).then(function(n){return t._waitForModules(e)}).then(function(e){n(e)})["catch"](function(e){r(e)})}else t._waitForModules(e).then(function(e){n(e)})["catch"](function(e){r(e)})})},_loadScript:function(e){var t=this;return new Promise(function(n,r){var o=document.createElement("script");o.src=e.url,o.async=!1,o.onload=o.onreadystatechange=function(){this.readyState&&"complete"!==this.readyState&&"load"!==this.readyState||(o.onload=o.onreadystatechange=null,n(o),t.emit("scriptLoaded",e.modules))},o.onerror=function(){document.head.removeChild(o),r(o)},document.head.appendChild(o)})},_resolveDependencies:function(e){var t=this;return new Promise(function(n,r){try{var o=t._getDependencyBuilder().resolveDependencies(e);n(o)}catch(i){r(i)}})},_reportMismatchedAnonymousModules:function(e){var t="Mismatched anonymous define() module: "+e,n=this._config.reportMismatchedAnonymousModules;if(!n||"exception"===n)throw new Error(t);console&&console[n]&&console[n].call(console,t)},_setModuleImplementation:function(e){for(var t=this,n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var o=e[r];if("undefined"==typeof o.implementation)if("undefined"==typeof o.exports){for(var i=[],s={exports:{}},u=t._getConfigParser(),a=0;a<o.dependencies.length;a++){var l=o.dependencies[a];if("exports"===l)i.push(s.exports);else if("module"===l)i.push(s);else if("require"===l){var c=t._createLocalRequire(o);c.toUrl=function(e){var n=t._getURLBuilder().build([e]);return n[0].url},i.push(c)}else{var f=n[u.mapModule(l,o.map)],d=f.implementation;i.push(d)}}var p;p="function"==typeof o.pendingImplementation?o.pendingImplementation.apply(o.pendingImplementation,i):o.pendingImplementation,"undefined"!=typeof p?o.implementation=p:o.implementation=s.exports}else o.pendingImplementation=o.implementation=this._getValueGlobalNS(o.exports)}},_createLocalRequire:function(t){var n=this._getConfigParser(),r=this._getPathResolver();return function(o){var i=arguments.length;if(!(i>1)){o=r.resolvePath(t.name,o),o=n.mapModule(o,t.map);var s=n.getModules()[o];if(!s||"undefined"==typeof s.implementation)throw new Error('Module "'+o+'" has not been loaded yet for context: '+t.name);return s.implementation}e.require.apply(e.Loader,arguments)}},_waitForModule:function(e){var t=this,n=t._modulesMap[e];return n||(n=t._createModulePromise(e),t._modulesMap[e]=n),n},_waitForModules:function(e){var t=this;return new Promise(function(n,r){for(var o=[],i=0;i<e.length;i++)o.push(t._waitForModule(e[i]));Promise.all(o).then(function(o){var i=t._getConfigParser().getModules(),s=function(){for(var r=[],o=0;o<e.length;o++)r.push(i[e[o]]);t._setModuleImplementation(r),n(r)},u=t._getMissingDependencies(e);u.length?t.require(u,s,r):s()},r)})}};return Object.keys(n).forEach(function(e){t.prototype[e]=n[e]}),t.prototype.define.amd={},t});var namespace=null,exposeGlobal=!0;if("object"==typeof global.__CONFIG__&&("string"==typeof global.__CONFIG__.namespace&&(namespace=global.__CONFIG__.namespace),"boolean"==typeof global.__CONFIG__.exposeGlobal&&(exposeGlobal=global.__CONFIG__.exposeGlobal)),namespace){var ns=window[global.__CONFIG__.namespace]?window[global.__CONFIG__.namespace]:{};ns.Loader=global.Loader,window[global.__CONFIG__.namespace]=ns}else window.Loader=global.Loader;exposeGlobal&&(window.Loader=global.Loader,window.require=global.require,window.define=global.define),global.Loader.version=function(){return"2.2.0"}}(),function(){"undefined"==typeof window.Promise&&"undefined"!=typeof window.ES6Promise&&(window.Promise=window.ES6Promise)}(); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.ES6Promise=t()}(this,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function t(e){return"function"==typeof e}function n(e){K=e}function r(e){z=e}function o(){return function(){return process.nextTick(l)}}function i(){return"undefined"!=typeof Y?function(){Y(l)}:a()}function s(){var e=0,t=new Q(l),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function u(){var e=new MessageChannel;return e.port1.onmessage=l,function(){return e.port2.postMessage(0)}}function a(){var e=setTimeout;return function(){return e(l,1)}}function l(){for(var e=0;e<V;e+=2){var t=$[e],n=$[e+1];t(n),$[e]=void 0,$[e+1]=void 0}V=0}function c(){try{var e=require,t=e("vertx");return Y=t.runOnLoop||t.runOnContext,i()}catch(n){return a()}}function f(e,t){var n=arguments,r=this,o=new this.constructor(p);void 0===o[te]&&q(o);var i=r._state;return i?!function(){var e=n[i-1];z(function(){return A(i,o,e,r._result)})}():C(r,o,e,t),o}function d(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(p);return b(n,e),n}function p(){}function h(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(t){return ie.error=t,ie}}function m(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function v(e,t,n){z(function(e){var r=!1,o=m(n,t,function(n){r||(r=!0,t!==n?b(e,n):P(e,n))},function(t){r||(r=!0,x(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,x(e,o))},e)}function y(e,t){t._state===re?P(e,t._result):t._state===oe?x(e,t._result):C(t,void 0,function(t){return b(e,t)},function(t){return x(e,t)})}function M(e,n,r){n.constructor===e.constructor&&r===f&&n.constructor.resolve===d?y(e,n):r===ie?(x(e,ie.error),ie.error=null):void 0===r?P(e,n):t(r)?v(e,n,r):P(e,n)}function b(t,n){t===n?x(t,h()):e(n)?M(t,n,_(n)):P(t,n)}function w(e){e._onerror&&e._onerror(e._result),O(e)}function P(e,t){e._state===ne&&(e._result=t,e._state=re,0!==e._subscribers.length&&z(O,e))}function x(e,t){e._state===ne&&(e._state=oe,e._result=t,z(w,e))}function C(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+re]=n,o[i+oe]=r,0===i&&e._state&&z(O,e)}function O(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,o=void 0,i=e._result,s=0;s<t.length;s+=3)r=t[s],o=t[s+n],r?A(n,r,o,i):o(i);e._subscribers.length=0}}function L(){this.error=null}function j(e,t){try{return e(t)}catch(n){return se.error=n,se}}function A(e,n,r,o){var i=t(r),s=void 0,u=void 0,a=void 0,l=void 0;if(i){if(s=j(r,o),s===se?(l=!0,u=s.error,s.error=null):a=!0,n===s)return void x(n,g())}else s=o,a=!0;n._state!==ne||(i&&a?b(n,s):l?x(n,u):e===re?P(n,s):e===oe&&x(n,s))}function R(e,t){try{t(function(t){b(e,t)},function(t){x(e,t)})}catch(n){x(e,n)}}function E(){return ue++}function q(e){e[te]=ue++,e._state=void 0,e._result=void 0,e._subscribers=[]}function I(e,t){this._instanceConstructor=e,this.promise=new e(p),this.promise[te]||q(this.promise),W(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&P(this.promise,this._result))):x(this.promise,S())}function S(){return new Error("Array Methods must be provided an Array")}function B(e){return new I(this,e).promise}function F(e){var t=this;return new t(W(e)?function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function k(e){var t=this,n=new t(p);return x(n,e),n}function D(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function G(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(e){this[te]=E(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&D(),this instanceof U?R(this,e):G())}function N(){var e=void 0;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===r&&!n.cast)return}e.Promise=U}var T=void 0;T=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var W=T,V=0,Y=void 0,K=void 0,z=function(e,t){$[V]=e,$[V+1]=t,V+=2,2===V&&(K?K(l):ee())},H="undefined"!=typeof window?window:void 0,J=H||{},Q=J.MutationObserver||J.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),ee=void 0;ee=X?o():Q?s():Z?u():void 0===H&&"function"==typeof require?c():a();var te=Math.random().toString(36).substring(16),ne=void 0,re=1,oe=2,ie=new L,se=new L,ue=0;return I.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ne&&n<e;n++)this._eachEntry(t[n],n)},I.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===d){var o=_(e);if(o===f&&e._state!==ne)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===U){var i=new n(p);M(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},I.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===ne&&(this._remaining--,e===oe?x(r,n):this._result[t]=n),0===this._remaining&&P(r,this._result)},I.prototype._willSettleAt=function(e,t){var n=this;C(e,void 0,function(e){return n._settledAt(re,t,e)},function(e){return n._settledAt(oe,t,e)})},U.all=B,U.race=F,U.resolve=d,U.reject=k,U._setScheduler=n,U._setAsap=r,U._asap=z,U.prototype={constructor:U,then:f,"catch":function(e){return this.then(null,e)}},U.polyfill=N,U.Promise=U,U}),function(){var global={};global.__CONFIG__=window.__CONFIG__,function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.EventEmitter=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){this._events={}}return t.prototype={constructor:t,on:function(e,t){var n=this._events[e]=this._events[e]||[];n.push(t)},off:function(e,t){var n=this._events[e];if(n){var r=n.indexOf(t);r>-1&&n.splice(r,1)}},emit:function(e,t){var n=this._events[e];if(n){n=n.slice(0);for(var r=0;r<n.length;r++){var o=n[r];o.call(o,t)}}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.ConfigParser=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._config={},this._modules={},this._conditionalModules={},this._parseConfig(e)}return t.prototype={constructor:t,addModule:function(e){var t=this._modules[e.name];if(t)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);else this._modules[e.name]=e;return this._registerConditionalModule(e),this._modules[e.name]},getConfig:function(){return this._config},getConditionalModules:function(){return this._conditionalModules},getModules:function(){return this._modules},mapModule:function(e,t){if(!this._config.maps&&!t)return e;var n;return n=Array.isArray(e)?e:[e],t&&(n=n.map(this._getModuleMapper(t))),this._config.maps&&(n=n.map(this._getModuleMapper(this._config.maps))),Array.isArray(e)?n:n[0]},_getModuleMapper:function(e){return function(t){var n;return n=this._mapExactMatch(t,e),n||(n=this._mapPartialMatch(t,e)),n||(n=this._mapWildcardMatch(t,e)),n||t}.bind(this)},_mapExactMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}},_mapPartialMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}},_mapWildcardMatch:function(e,t){if("function"==typeof t["*"])return t["*"](e)},_parseConfig:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&("modules"===t?this._parseModules(e[t]):this._config[t]=e[t]);return this._config},_parseModules:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];n.name=t,this.addModule(n)}return this._modules},_registerConditionalModule:function(e){if(e.condition){var t=this._conditionalModules[e.condition.trigger];t||(this._conditionalModules[e.condition.trigger]=t=[]),t.push(e.name)}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.DependencyBuilder=n}("undefined"!=typeof global?global:this,function(global){"use strict";function DependencyBuilder(e){this._configParser=e,this._pathResolver=new global.PathResolver,this._result=[]}var hasOwnProperty=Object.prototype.hasOwnProperty;return DependencyBuilder.prototype={constructor:DependencyBuilder,resolveDependencies:function(e){this._queue=e.slice(0);var t;try{this._resolveDependencies(),t=this._result.reverse().slice(0)}finally{this._cleanup()}return t},_cleanup:function(){var e=this._configParser.getModules();for(var t in e)if(hasOwnProperty.call(e,t)){var n=e[t];n.conditionalMark=!1,n.mark=!1,n.tmpMark=!1}this._queue.length=0,this._result.length=0},_processConditionalModules:function(e){var t=this._configParser.getConditionalModules()[e.name];if(t&&!e.conditionalMark){for(var n=this._configParser.getModules(),r=0;r<t.length;r++){var o=n[t[r]];this._queue.indexOf(o.name)===-1&&this._testConditionalModule(o.condition.test)&&this._queue.push(o.name)}e.conditionalMark=!0}},_resolveDependencies:function(){for(var e=this._configParser.getModules(),t=0;t<this._queue.length;t++){var n=e[this._queue[t]];n||(n=this._configParser.addModule({name:this._queue[t],dependencies:[]})),n.mark||this._visit(n)}},_testConditionalModule:function(testFunction){return"function"==typeof testFunction?testFunction():eval("false || "+testFunction)()},_visit:function(e){if(e.tmpMark)throw new Error("Error processing module: "+e.name+". The provided configuration is not Directed Acyclic Graph.");if(this._processConditionalModules(e),!e.mark){e.tmpMark=!0;for(var t=this._configParser.getModules(),n=0;n<e.dependencies.length;n++){var r=e.dependencies[n];if("require"!==r&&"exports"!==r&&"module"!==r){r=this._pathResolver.resolvePath(e.name,r);var o=this._configParser.mapModule(r,e.map),i=t[o];i||(i=this._configParser.addModule({name:o,dependencies:[]})),this._visit(i)}}e.mark=!0,e.tmpMark=!1,this._result.unshift(e.name)}},_queue:[]},DependencyBuilder}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.URLBuilder=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._configParser=e}var n=/^https?:\/\/|\/\/|www\./;return t.prototype={constructor:t,build:function(e){var t=[],r=[],o=[],i=[],s=[],u=this._configParser.getConfig(),a=u.basePath||"",l=this._configParser.getModules();a.length&&"/"!==a.charAt(a.length-1)&&(a+="/");for(var c=0;c<e.length;c++){var f=l[e[c]];if(f.fullPath)s.push({modules:[f.name],url:this._getURLWithParams(f.fullPath)});else{var d=this._getModulePath(f),p=0===d.indexOf("/");n.test(d)?s.push({modules:[f.name],url:this._getURLWithParams(d)}):!u.combine||f.anonymous?s.push({modules:[f.name],url:this._getURLWithParams(u.url+(p?"":a)+d)}):p?(t.push(d),o.push(f.name)):(r.push(d),i.push(f.name))}f.requested=!0}return r.length&&(s=s.concat(this._generateBufferURLs(i,r,{basePath:a,url:u.url,urlMaxLength:u.urlMaxLength})),r.length=0),t.length&&(s=s.concat(this._generateBufferURLs(o,t,{url:u.url,urlMaxLength:u.urlMaxLength})),t.length=0),s},_generateBufferURLs:function(e,t,n){var r,o=n.basePath||"",i=[],s=n.urlMaxLength||2e3,u={modules:[e[0]],url:n.url+o+t[0]};for(r=1;r<t.length;r++){var a=e[r],l=t[r];u.url.length+o.length+l.length+1<s?(u.modules.push(a),u.url+="&"+o+l):(i.push(u),u={modules:[a],url:n.url+o+l})}return u.url=this._getURLWithParams(u.url),i.push(u),i},_getModulePath:function(e){var t=e.path||e.name,r=this._configParser.getConfig().paths||{},o=!1;return Object.keys(r).forEach(function(e){t!==e&&0!==t.indexOf(e+"/")||(t=r[e]+t.substring(e.length))}),o||"function"!=typeof r["*"]||(t=r["*"](t)),n.test(t)||t.lastIndexOf(".js")===t.length-3||(t+=".js"),t},_getURLWithParams:function(e){var t=this._configParser.getConfig(),n=t.defaultURLParams||{},r=Object.keys(n);if(!r.length)return e;var o=r.map(function(e){return e+"="+n[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+o}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.PathResolver=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){}return t.prototype={constructor:t,resolvePath:function(e,t){if("require"===t||"exports"===t||"module"===t||0!==t.indexOf(".")&&0!==t.indexOf(".."))return t;var n=e.split("/");n.splice(-1,1);for(var r=t.split("/"),o=r.splice(-1,1),i=0;i<r.length;i++){var s=r[i];if("."!==s)if(".."===s){if(!n.length){n=n.concat(r.slice(i));break}n.splice(-1,1)}else n.push(s)}return n.push(o),n.join("/")}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.Loader=new n,e.require=e.Loader.require.bind(e.Loader),e.define=e.Loader.define.bind(e.Loader),e.define.amd={}}("undefined"!=typeof global?global:this,function(e){"use strict";function t(n){t.superclass.constructor.apply(this,arguments),this._config=n||e.__CONFIG__,this._modulesMap={}}t.prototype=Object.create(e.EventEmitter.prototype),t.prototype.constructor=t,t.superclass=e.EventEmitter.prototype;var n={addModule:function(e){return this._getConfigParser().addModule(e)},define:function(){var e=this,t=arguments[0],n=arguments[1],r=arguments[2],o=arguments[3]||{};o.anonymous=!1;var i=arguments.length;if(i<2?(r=arguments[0],n=["module","exports"],o.anonymous=!0):2===i&&("string"==typeof t?(n=["module","exports"],r=arguments[1]):(n=arguments[0],r=arguments[1],o.anonymous=!0)),o.anonymous){var s=function(t){if(e.off("scriptLoaded",s),1!==t.length)e._reportMismatchedAnonymousModules(r.toString());else{var i=t[0],u=e.getModules()[i];u&&u.pendingImplementation&&e._reportMismatchedAnonymousModules(r.toString()),e._define(i,n,r,o)}};e.on("scriptLoaded",s)}else this._define(t,n,r,o)},getConditionalModules:function(){return this._getConfigParser().getConditionalModules()},getModules:function(){return this._getConfigParser().getModules()},require:function(){var e,t,n,r,o=this;if(Array.isArray(arguments[0]))n=arguments[0],r="function"==typeof arguments[1]?arguments[1]:null,e="function"==typeof arguments[2]?arguments[2]:null;else for(n=[],t=0;t<arguments.length;++t)if("string"==typeof arguments[t])n[t]=arguments[t];else if("function"==typeof arguments[t]){r=arguments[t],e="function"==typeof arguments[++t]?arguments[t]:null;break}var i,s=o._getConfigParser(),u=s.mapModule(n);new Promise(function(e,t){o._resolveDependencies(u).then(function(r){o._log("Resolved modules:",u,"to:",r);var a=r.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});a.length>0&&t(new Error("The following problems where detected while resolving modules:\n"+a.join("\n")));var l=s.getConfig();0!==l.waitTimeout&&(i=setTimeout(function(){var e=s.getModules(),o=new Error("Load timeout for modules: "+n);o.dependencies=r,o.mappedModules=u,o.missingDependencies=r.filter(function(t){return"undefined"==typeof e[t].implementation}),o.modules=n,o.dependecies=o.dependencies,t(o)},l.waitTimeout||7e3)),o._loadModules(r).then(e,t)},t)}).then(function(e){if(clearTimeout(i),r){var t=o._getModuleImplementations(u);r.apply(r,t)}},function(t){clearTimeout(i),e?e.call(e,t):o._error("Unhandled failure:",t,"while resolving modules:",u)})},_createModulePromise:function(e){var t=this;return new Promise(function(n,r){var o=t._getConfigParser().getModules(),i=o[e];if(i.exports){var s=t._getValueGlobalNS(i.exports);if(s)n(s);else{var u=function(o){if(o.indexOf(e)>=0){t.off("scriptLoaded",u);var s=t._getValueGlobalNS(i.exports);s?n(s):r(new Error("Module "+e+" does not export the specified value: "+i.exports))}};t.on("scriptLoaded",u)}}else{var a=function(r){r===e&&(t.off("moduleRegister",a),t._modulesMap[e]=!0,n(e))};t.on("moduleRegister",a)}})},_define:function(e,t,n,r){var o=r||{},i=this._getConfigParser();if(i.getConfig().ignoreModuleVersion){var s=e.split("/"),u=s[0].split("@");s[0]=u[0],e=s.join("/")}var a=this._getPathResolver();t=t.map(function(t){return a.resolvePath(e,t)}),o.name=e,o.dependencies=t,o.pendingImplementation=n,i.addModule(o),this._modulesMap[o.name]||(this._modulesMap[o.name]=!0),this.emit("moduleRegister",e)},_getConfigParser:function(){return this._configParser||(this._configParser=new e.ConfigParser(this._config)),this._configParser},_getDependencyBuilder:function(){return this._dependencyBuilder||(this._dependencyBuilder=new e.DependencyBuilder(this._getConfigParser())),this._dependencyBuilder},_getValueGlobalNS:function(e){for(var t=e.split("."),n=(0,eval)("this")[t[0]],r=1;n&&r<t.length;r++){if(!Object.prototype.hasOwnProperty.call(n,t[r]))return null;n=n[t[r]]}return n},_getMissingDependencies:function(e){for(var t=this._getConfigParser(),n=t.getModules(),r=Object.create(null),o=0;o<e.length;o++)for(var i=n[e[o]],s=t.mapModule(i.dependencies,i.map),u=0;u<s.length;u++){var a=s[u],l=n[a];"require"===a||"exports"===a||"module"===a||l&&l.pendingImplementation||(r[a]=1)}return Object.keys(r)},_getModuleImplementations:function(e){for(var t=[],n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var o=n[e[r]];t.push(o?o.implementation:void 0)}return t},_getPathResolver:function(){return this._pathResolver||(this._pathResolver=new e.PathResolver),this._pathResolver},_getURLBuilder:function(){return this._urlBuilder||(this._urlBuilder=new e.URLBuilder(this._getConfigParser())),this._urlBuilder},_filterModulesByProperty:function(e,t){var n=t;"string"==typeof t&&(n=[t]);for(var r=[],o=this._getConfigParser().getModules(),i=0;i<e.length;i++){var s=e[i],u=o[e[i]];if(u){if("require"!==u&&"exports"!==u&&"module"!==u){for(var a=0,l=0;l<n.length;l++)if(u[n[l]]){a=!0;break}a||r.push(s)}}else r.push(s)}return r},_loadModules:function(e){var t=this;return new Promise(function(n,r){var o=t._filterModulesByProperty(e,["requested","pendingImplementation"]);if(o.length){for(var i=t._getURLBuilder().build(o),s=[],u=0;u<i.length;u++)s.push(t._loadScript(i[u]));Promise.all(s).then(function(n){return t._waitForModules(e)}).then(function(e){n(e)})["catch"](function(e){r(e)})}else t._waitForModules(e).then(function(e){n(e)})["catch"](function(e){r(e)})})},_loadScript:function(e){var t=this;return new Promise(function(n,r){var o=document.createElement("script");o.src=e.url,o.async=!1,o.onload=o.onreadystatechange=function(){this.readyState&&"complete"!==this.readyState&&"load"!==this.readyState||(o.onload=o.onreadystatechange=null,n(o),t.emit("scriptLoaded",e.modules))},o.onerror=function(){document.head.removeChild(o),r(o)},document.head.appendChild(o)})},_log:function(){var e=console,t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments),n=this._getConfigParser().getConfig();n.explainResolutions&&e.log.apply(e,["Liferay AMD Loader:"].concat(t))},_error:function(){var e=console,t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.log.apply(e,["Liferay AMD Loader:"].concat(t))},_resolveDependencies:function(e){var t=this;return new Promise(function(n,r){try{var o=t._getDependencyBuilder().resolveDependencies(e);n(o)}catch(i){r(i)}})},_reportMismatchedAnonymousModules:function(e){var t="Mismatched anonymous define() module: "+e,n=this._config.reportMismatchedAnonymousModules;if(!n||"exception"===n)throw new Error(t);console&&console[n]&&console[n].call(console,t)},_setModuleImplementation:function(e){for(var t=this,n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var o=e[r];if("undefined"==typeof o.implementation)if("undefined"==typeof o.exports){for(var i=[],s={exports:{}},u=t._getConfigParser(),a=0;a<o.dependencies.length;a++){var l=o.dependencies[a];if("exports"===l)i.push(s.exports);else if("module"===l)i.push(s);else if("require"===l){var c=t._createLocalRequire(o);c.toUrl=function(e){var n=t._getURLBuilder().build([e]);return n[0].url},i.push(c)}else{var f=n[u.mapModule(l,o.map)],d=f.implementation;i.push(d)}}var p;p="function"==typeof o.pendingImplementation?o.pendingImplementation.apply(o.pendingImplementation,i):o.pendingImplementation,"undefined"!=typeof p?o.implementation=p:o.implementation=s.exports}else o.pendingImplementation=o.implementation=this._getValueGlobalNS(o.exports)}},_createLocalRequire:function(t){var n=this._getConfigParser(),r=this._getPathResolver();return function(o){var i=arguments.length;if(!(i>1)){o=r.resolvePath(t.name,o),o=n.mapModule(o,t.map);var s=n.getModules()[o];if(!s||"undefined"==typeof s.implementation)throw new Error('Module "'+o+'" has not been loaded yet for context: '+t.name);return s.implementation}e.require.apply(e.Loader,arguments)}},_waitForModule:function(e){var t=this,n=t._modulesMap[e];return n||(n=t._createModulePromise(e),t._modulesMap[e]=n),n},_waitForModules:function(e){var t=this;return new Promise(function(n,r){for(var o=[],i=0;i<e.length;i++)o.push(t._waitForModule(e[i]));Promise.all(o).then(function(o){var i=t._getConfigParser().getModules(),s=function(){for(var r=[],o=0;o<e.length;o++)r.push(i[e[o]]);t._setModuleImplementation(r),n(r)},u=t._getMissingDependencies(e);u.length?t.require(u,s,r):s()},r)})}};return Object.keys(n).forEach(function(e){t.prototype[e]=n[e]}),t.prototype.define.amd={},t});var namespace=null,exposeGlobal=!0;if("object"==typeof global.__CONFIG__&&("string"==typeof global.__CONFIG__.namespace&&(namespace=global.__CONFIG__.namespace),"boolean"==typeof global.__CONFIG__.exposeGlobal&&(exposeGlobal=global.__CONFIG__.exposeGlobal)),namespace){var ns=window[global.__CONFIG__.namespace]?window[global.__CONFIG__.namespace]:{};ns.Loader=global.Loader,window[global.__CONFIG__.namespace]=ns}else window.Loader=global.Loader;exposeGlobal&&(window.Loader=global.Loader,window.require=global.require,window.define=global.define),global.Loader.version=function(){return"2.3.0"}}(),function(){"undefined"==typeof window.Promise&&"undefined"!=typeof window.ES6Promise&&(window.Promise=window.ES6Promise)}(); |
@@ -1304,2 +1304,27 @@ (function() { | ||
self._log( | ||
'Resolved modules:', | ||
mappedModules, | ||
'to:', | ||
dependencies | ||
); | ||
var dependencyErrors = dependencies | ||
.filter(function(dep) { | ||
return dep.indexOf(':ERROR:') === 0; | ||
}) | ||
.map(function(dep) { | ||
return dep.substr(7); | ||
}); | ||
if (dependencyErrors.length > 0) { | ||
reject( | ||
new Error( | ||
'The following problems where detected while ' + | ||
'resolving modules:\n' + | ||
dependencyErrors.join('\n') | ||
) | ||
); | ||
} | ||
var config = configParser.getConfig(); | ||
@@ -1362,2 +1387,9 @@ | ||
failureCallback.call(failureCallback, error); | ||
} else { | ||
self._error( | ||
'Unhandled failure:', | ||
error, | ||
'while resolving modules:', | ||
mappedModules | ||
); | ||
} | ||
@@ -1806,2 +1838,29 @@ } | ||
_log: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
var config = this._getConfigParser().getConfig(); | ||
if (config.explainResolutions) { | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
} | ||
}, | ||
_error: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
}, | ||
/** | ||
@@ -2104,3 +2163,3 @@ * Resolves modules dependencies. | ||
global.Loader.version = function() { return '2.2.0' }; | ||
global.Loader.version = function() { return '2.3.0' }; | ||
}()); |
@@ -1,1 +0,1 @@ | ||
!function(){var global={};global.__CONFIG__=window.__CONFIG__,function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.EventEmitter=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){this._events={}}return t.prototype={constructor:t,on:function(e,t){var n=this._events[e]=this._events[e]||[];n.push(t)},off:function(e,t){var n=this._events[e];if(n){var o=n.indexOf(t);o>-1&&n.splice(o,1)}},emit:function(e,t){var n=this._events[e];if(n){n=n.slice(0);for(var o=0;o<n.length;o++){var i=n[o];i.call(i,t)}}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.ConfigParser=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._config={},this._modules={},this._conditionalModules={},this._parseConfig(e)}return t.prototype={constructor:t,addModule:function(e){var t=this._modules[e.name];if(t)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);else this._modules[e.name]=e;return this._registerConditionalModule(e),this._modules[e.name]},getConfig:function(){return this._config},getConditionalModules:function(){return this._conditionalModules},getModules:function(){return this._modules},mapModule:function(e,t){if(!this._config.maps&&!t)return e;var n;return n=Array.isArray(e)?e:[e],t&&(n=n.map(this._getModuleMapper(t))),this._config.maps&&(n=n.map(this._getModuleMapper(this._config.maps))),Array.isArray(e)?n:n[0]},_getModuleMapper:function(e){return function(t){var n;return n=this._mapExactMatch(t,e),n||(n=this._mapPartialMatch(t,e)),n||(n=this._mapWildcardMatch(t,e)),n||t}.bind(this)},_mapExactMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var o=t[n];if(o.value&&o.exactMatch&&e===n)return o.value}},_mapPartialMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var o=t[n];if(!o.exactMatch&&(o.value&&(o=o.value),e===n||0===e.indexOf(n+"/")))return o+e.substring(n.length)}},_mapWildcardMatch:function(e,t){if("function"==typeof t["*"])return t["*"](e)},_parseConfig:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&("modules"===t?this._parseModules(e[t]):this._config[t]=e[t]);return this._config},_parseModules:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];n.name=t,this.addModule(n)}return this._modules},_registerConditionalModule:function(e){if(e.condition){var t=this._conditionalModules[e.condition.trigger];t||(this._conditionalModules[e.condition.trigger]=t=[]),t.push(e.name)}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.DependencyBuilder=n}("undefined"!=typeof global?global:this,function(global){"use strict";function DependencyBuilder(e){this._configParser=e,this._pathResolver=new global.PathResolver,this._result=[]}var hasOwnProperty=Object.prototype.hasOwnProperty;return DependencyBuilder.prototype={constructor:DependencyBuilder,resolveDependencies:function(e){this._queue=e.slice(0);var t;try{this._resolveDependencies(),t=this._result.reverse().slice(0)}finally{this._cleanup()}return t},_cleanup:function(){var e=this._configParser.getModules();for(var t in e)if(hasOwnProperty.call(e,t)){var n=e[t];n.conditionalMark=!1,n.mark=!1,n.tmpMark=!1}this._queue.length=0,this._result.length=0},_processConditionalModules:function(e){var t=this._configParser.getConditionalModules()[e.name];if(t&&!e.conditionalMark){for(var n=this._configParser.getModules(),o=0;o<t.length;o++){var i=n[t[o]];this._queue.indexOf(i.name)===-1&&this._testConditionalModule(i.condition.test)&&this._queue.push(i.name)}e.conditionalMark=!0}},_resolveDependencies:function(){for(var e=this._configParser.getModules(),t=0;t<this._queue.length;t++){var n=e[this._queue[t]];n||(n=this._configParser.addModule({name:this._queue[t],dependencies:[]})),n.mark||this._visit(n)}},_testConditionalModule:function(testFunction){return"function"==typeof testFunction?testFunction():eval("false || "+testFunction)()},_visit:function(e){if(e.tmpMark)throw new Error("Error processing module: "+e.name+". The provided configuration is not Directed Acyclic Graph.");if(this._processConditionalModules(e),!e.mark){e.tmpMark=!0;for(var t=this._configParser.getModules(),n=0;n<e.dependencies.length;n++){var o=e.dependencies[n];if("require"!==o&&"exports"!==o&&"module"!==o){o=this._pathResolver.resolvePath(e.name,o);var i=this._configParser.mapModule(o,e.map),r=t[i];r||(r=this._configParser.addModule({name:i,dependencies:[]})),this._visit(r)}}e.mark=!0,e.tmpMark=!1,this._result.unshift(e.name)}},_queue:[]},DependencyBuilder}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.URLBuilder=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._configParser=e}var n=/^https?:\/\/|\/\/|www\./;return t.prototype={constructor:t,build:function(e){var t=[],o=[],i=[],r=[],s=[],a=this._configParser.getConfig(),u=a.basePath||"",l=this._configParser.getModules();u.length&&"/"!==u.charAt(u.length-1)&&(u+="/");for(var d=0;d<e.length;d++){var f=l[e[d]];if(f.fullPath)s.push({modules:[f.name],url:this._getURLWithParams(f.fullPath)});else{var c=this._getModulePath(f),p=0===c.indexOf("/");n.test(c)?s.push({modules:[f.name],url:this._getURLWithParams(c)}):!a.combine||f.anonymous?s.push({modules:[f.name],url:this._getURLWithParams(a.url+(p?"":u)+c)}):p?(t.push(c),i.push(f.name)):(o.push(c),r.push(f.name))}f.requested=!0}return o.length&&(s=s.concat(this._generateBufferURLs(r,o,{basePath:u,url:a.url,urlMaxLength:a.urlMaxLength})),o.length=0),t.length&&(s=s.concat(this._generateBufferURLs(i,t,{url:a.url,urlMaxLength:a.urlMaxLength})),t.length=0),s},_generateBufferURLs:function(e,t,n){var o,i=n.basePath||"",r=[],s=n.urlMaxLength||2e3,a={modules:[e[0]],url:n.url+i+t[0]};for(o=1;o<t.length;o++){var u=e[o],l=t[o];a.url.length+i.length+l.length+1<s?(a.modules.push(u),a.url+="&"+i+l):(r.push(a),a={modules:[u],url:n.url+i+l})}return a.url=this._getURLWithParams(a.url),r.push(a),r},_getModulePath:function(e){var t=e.path||e.name,o=this._configParser.getConfig().paths||{},i=!1;return Object.keys(o).forEach(function(e){t!==e&&0!==t.indexOf(e+"/")||(t=o[e]+t.substring(e.length))}),i||"function"!=typeof o["*"]||(t=o["*"](t)),n.test(t)||t.lastIndexOf(".js")===t.length-3||(t+=".js"),t},_getURLWithParams:function(e){var t=this._configParser.getConfig(),n=t.defaultURLParams||{},o=Object.keys(n);if(!o.length)return e;var i=o.map(function(e){return e+"="+n[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+i}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.PathResolver=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){}return t.prototype={constructor:t,resolvePath:function(e,t){if("require"===t||"exports"===t||"module"===t||0!==t.indexOf(".")&&0!==t.indexOf(".."))return t;var n=e.split("/");n.splice(-1,1);for(var o=t.split("/"),i=o.splice(-1,1),r=0;r<o.length;r++){var s=o[r];if("."!==s)if(".."===s){if(!n.length){n=n.concat(o.slice(r));break}n.splice(-1,1)}else n.push(s)}return n.push(i),n.join("/")}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.Loader=new n,e.require=e.Loader.require.bind(e.Loader),e.define=e.Loader.define.bind(e.Loader),e.define.amd={}}("undefined"!=typeof global?global:this,function(e){"use strict";function t(n){t.superclass.constructor.apply(this,arguments),this._config=n||e.__CONFIG__,this._modulesMap={}}t.prototype=Object.create(e.EventEmitter.prototype),t.prototype.constructor=t,t.superclass=e.EventEmitter.prototype;var n={addModule:function(e){return this._getConfigParser().addModule(e)},define:function(){var e=this,t=arguments[0],n=arguments[1],o=arguments[2],i=arguments[3]||{};i.anonymous=!1;var r=arguments.length;if(r<2?(o=arguments[0],n=["module","exports"],i.anonymous=!0):2===r&&("string"==typeof t?(n=["module","exports"],o=arguments[1]):(n=arguments[0],o=arguments[1],i.anonymous=!0)),i.anonymous){var s=function(t){if(e.off("scriptLoaded",s),1!==t.length)e._reportMismatchedAnonymousModules(o.toString());else{var r=t[0],a=e.getModules()[r];a&&a.pendingImplementation&&e._reportMismatchedAnonymousModules(o.toString()),e._define(r,n,o,i)}};e.on("scriptLoaded",s)}else this._define(t,n,o,i)},getConditionalModules:function(){return this._getConfigParser().getConditionalModules()},getModules:function(){return this._getConfigParser().getModules()},require:function(){var e,t,n,o,i=this;if(Array.isArray(arguments[0]))n=arguments[0],o="function"==typeof arguments[1]?arguments[1]:null,e="function"==typeof arguments[2]?arguments[2]:null;else for(n=[],t=0;t<arguments.length;++t)if("string"==typeof arguments[t])n[t]=arguments[t];else if("function"==typeof arguments[t]){o=arguments[t],e="function"==typeof arguments[++t]?arguments[t]:null;break}var r,s=i._getConfigParser(),a=s.mapModule(n);new Promise(function(e,t){i._resolveDependencies(a).then(function(o){var u=s.getConfig();0!==u.waitTimeout&&(r=setTimeout(function(){var e=s.getModules(),i=new Error("Load timeout for modules: "+n);i.dependencies=o,i.mappedModules=a,i.missingDependencies=o.filter(function(t){return"undefined"==typeof e[t].implementation}),i.modules=n,i.dependecies=i.dependencies,t(i)},u.waitTimeout||7e3)),i._loadModules(o).then(e,t)},t)}).then(function(e){if(clearTimeout(r),o){var t=i._getModuleImplementations(a);o.apply(o,t)}},function(t){clearTimeout(r),e&&e.call(e,t)})},_createModulePromise:function(e){var t=this;return new Promise(function(n,o){var i=t._getConfigParser().getModules(),r=i[e];if(r.exports){var s=t._getValueGlobalNS(r.exports);if(s)n(s);else{var a=function(i){if(i.indexOf(e)>=0){t.off("scriptLoaded",a);var s=t._getValueGlobalNS(r.exports);s?n(s):o(new Error("Module "+e+" does not export the specified value: "+r.exports))}};t.on("scriptLoaded",a)}}else{var u=function(o){o===e&&(t.off("moduleRegister",u),t._modulesMap[e]=!0,n(e))};t.on("moduleRegister",u)}})},_define:function(e,t,n,o){var i=o||{},r=this._getConfigParser();if(r.getConfig().ignoreModuleVersion){var s=e.split("/"),a=s[0].split("@");s[0]=a[0],e=s.join("/")}var u=this._getPathResolver();t=t.map(function(t){return u.resolvePath(e,t)}),i.name=e,i.dependencies=t,i.pendingImplementation=n,r.addModule(i),this._modulesMap[i.name]||(this._modulesMap[i.name]=!0),this.emit("moduleRegister",e)},_getConfigParser:function(){return this._configParser||(this._configParser=new e.ConfigParser(this._config)),this._configParser},_getDependencyBuilder:function(){return this._dependencyBuilder||(this._dependencyBuilder=new e.DependencyBuilder(this._getConfigParser())),this._dependencyBuilder},_getValueGlobalNS:function(e){for(var t=e.split("."),n=(0,eval)("this")[t[0]],o=1;n&&o<t.length;o++){if(!Object.prototype.hasOwnProperty.call(n,t[o]))return null;n=n[t[o]]}return n},_getMissingDependencies:function(e){for(var t=this._getConfigParser(),n=t.getModules(),o=Object.create(null),i=0;i<e.length;i++)for(var r=n[e[i]],s=t.mapModule(r.dependencies,r.map),a=0;a<s.length;a++){var u=s[a],l=n[u];"require"===u||"exports"===u||"module"===u||l&&l.pendingImplementation||(o[u]=1)}return Object.keys(o)},_getModuleImplementations:function(e){for(var t=[],n=this._getConfigParser().getModules(),o=0;o<e.length;o++){var i=n[e[o]];t.push(i?i.implementation:void 0)}return t},_getPathResolver:function(){return this._pathResolver||(this._pathResolver=new e.PathResolver),this._pathResolver},_getURLBuilder:function(){return this._urlBuilder||(this._urlBuilder=new e.URLBuilder(this._getConfigParser())),this._urlBuilder},_filterModulesByProperty:function(e,t){var n=t;"string"==typeof t&&(n=[t]);for(var o=[],i=this._getConfigParser().getModules(),r=0;r<e.length;r++){var s=e[r],a=i[e[r]];if(a){if("require"!==a&&"exports"!==a&&"module"!==a){for(var u=0,l=0;l<n.length;l++)if(a[n[l]]){u=!0;break}u||o.push(s)}}else o.push(s)}return o},_loadModules:function(e){var t=this;return new Promise(function(n,o){var i=t._filterModulesByProperty(e,["requested","pendingImplementation"]);if(i.length){for(var r=t._getURLBuilder().build(i),s=[],a=0;a<r.length;a++)s.push(t._loadScript(r[a]));Promise.all(s).then(function(n){return t._waitForModules(e)}).then(function(e){n(e)})["catch"](function(e){o(e)})}else t._waitForModules(e).then(function(e){n(e)})["catch"](function(e){o(e)})})},_loadScript:function(e){var t=this;return new Promise(function(n,o){var i=document.createElement("script");i.src=e.url,i.async=!1,i.onload=i.onreadystatechange=function(){this.readyState&&"complete"!==this.readyState&&"load"!==this.readyState||(i.onload=i.onreadystatechange=null,n(i),t.emit("scriptLoaded",e.modules))},i.onerror=function(){document.head.removeChild(i),o(i)},document.head.appendChild(i)})},_resolveDependencies:function(e){var t=this;return new Promise(function(n,o){try{var i=t._getDependencyBuilder().resolveDependencies(e);n(i)}catch(r){o(r)}})},_reportMismatchedAnonymousModules:function(e){var t="Mismatched anonymous define() module: "+e,n=this._config.reportMismatchedAnonymousModules;if(!n||"exception"===n)throw new Error(t);console&&console[n]&&console[n].call(console,t)},_setModuleImplementation:function(e){for(var t=this,n=this._getConfigParser().getModules(),o=0;o<e.length;o++){var i=e[o];if("undefined"==typeof i.implementation)if("undefined"==typeof i.exports){for(var r=[],s={exports:{}},a=t._getConfigParser(),u=0;u<i.dependencies.length;u++){var l=i.dependencies[u];if("exports"===l)r.push(s.exports);else if("module"===l)r.push(s);else if("require"===l){var d=t._createLocalRequire(i);d.toUrl=function(e){var n=t._getURLBuilder().build([e]);return n[0].url},r.push(d)}else{var f=n[a.mapModule(l,i.map)],c=f.implementation;r.push(c)}}var p;p="function"==typeof i.pendingImplementation?i.pendingImplementation.apply(i.pendingImplementation,r):i.pendingImplementation,"undefined"!=typeof p?i.implementation=p:i.implementation=s.exports}else i.pendingImplementation=i.implementation=this._getValueGlobalNS(i.exports)}},_createLocalRequire:function(t){var n=this._getConfigParser(),o=this._getPathResolver();return function(i){var r=arguments.length;if(!(r>1)){i=o.resolvePath(t.name,i),i=n.mapModule(i,t.map);var s=n.getModules()[i];if(!s||"undefined"==typeof s.implementation)throw new Error('Module "'+i+'" has not been loaded yet for context: '+t.name);return s.implementation}e.require.apply(e.Loader,arguments)}},_waitForModule:function(e){var t=this,n=t._modulesMap[e];return n||(n=t._createModulePromise(e),t._modulesMap[e]=n),n},_waitForModules:function(e){var t=this;return new Promise(function(n,o){for(var i=[],r=0;r<e.length;r++)i.push(t._waitForModule(e[r]));Promise.all(i).then(function(i){var r=t._getConfigParser().getModules(),s=function(){for(var o=[],i=0;i<e.length;i++)o.push(r[e[i]]);t._setModuleImplementation(o),n(o)},a=t._getMissingDependencies(e);a.length?t.require(a,s,o):s()},o)})}};return Object.keys(n).forEach(function(e){t.prototype[e]=n[e]}),t.prototype.define.amd={},t});var namespace=null,exposeGlobal=!0;if("object"==typeof global.__CONFIG__&&("string"==typeof global.__CONFIG__.namespace&&(namespace=global.__CONFIG__.namespace),"boolean"==typeof global.__CONFIG__.exposeGlobal&&(exposeGlobal=global.__CONFIG__.exposeGlobal)),namespace){var ns=window[global.__CONFIG__.namespace]?window[global.__CONFIG__.namespace]:{};ns.Loader=global.Loader,window[global.__CONFIG__.namespace]=ns}else window.Loader=global.Loader;exposeGlobal&&(window.Loader=global.Loader,window.require=global.require,window.define=global.define),global.Loader.version=function(){return"2.2.0"}}(); | ||
!function(){var global={};global.__CONFIG__=window.__CONFIG__,function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.EventEmitter=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){this._events={}}return t.prototype={constructor:t,on:function(e,t){var n=this._events[e]=this._events[e]||[];n.push(t)},off:function(e,t){var n=this._events[e];if(n){var o=n.indexOf(t);o>-1&&n.splice(o,1)}},emit:function(e,t){var n=this._events[e];if(n){n=n.slice(0);for(var o=0;o<n.length;o++){var r=n[o];r.call(r,t)}}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.ConfigParser=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._config={},this._modules={},this._conditionalModules={},this._parseConfig(e)}return t.prototype={constructor:t,addModule:function(e){var t=this._modules[e.name];if(t)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);else this._modules[e.name]=e;return this._registerConditionalModule(e),this._modules[e.name]},getConfig:function(){return this._config},getConditionalModules:function(){return this._conditionalModules},getModules:function(){return this._modules},mapModule:function(e,t){if(!this._config.maps&&!t)return e;var n;return n=Array.isArray(e)?e:[e],t&&(n=n.map(this._getModuleMapper(t))),this._config.maps&&(n=n.map(this._getModuleMapper(this._config.maps))),Array.isArray(e)?n:n[0]},_getModuleMapper:function(e){return function(t){var n;return n=this._mapExactMatch(t,e),n||(n=this._mapPartialMatch(t,e)),n||(n=this._mapWildcardMatch(t,e)),n||t}.bind(this)},_mapExactMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var o=t[n];if(o.value&&o.exactMatch&&e===n)return o.value}},_mapPartialMatch:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var o=t[n];if(!o.exactMatch&&(o.value&&(o=o.value),e===n||0===e.indexOf(n+"/")))return o+e.substring(n.length)}},_mapWildcardMatch:function(e,t){if("function"==typeof t["*"])return t["*"](e)},_parseConfig:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&("modules"===t?this._parseModules(e[t]):this._config[t]=e[t]);return this._config},_parseModules:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];n.name=t,this.addModule(n)}return this._modules},_registerConditionalModule:function(e){if(e.condition){var t=this._conditionalModules[e.condition.trigger];t||(this._conditionalModules[e.condition.trigger]=t=[]),t.push(e.name)}}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.DependencyBuilder=n}("undefined"!=typeof global?global:this,function(global){"use strict";function DependencyBuilder(e){this._configParser=e,this._pathResolver=new global.PathResolver,this._result=[]}var hasOwnProperty=Object.prototype.hasOwnProperty;return DependencyBuilder.prototype={constructor:DependencyBuilder,resolveDependencies:function(e){this._queue=e.slice(0);var t;try{this._resolveDependencies(),t=this._result.reverse().slice(0)}finally{this._cleanup()}return t},_cleanup:function(){var e=this._configParser.getModules();for(var t in e)if(hasOwnProperty.call(e,t)){var n=e[t];n.conditionalMark=!1,n.mark=!1,n.tmpMark=!1}this._queue.length=0,this._result.length=0},_processConditionalModules:function(e){var t=this._configParser.getConditionalModules()[e.name];if(t&&!e.conditionalMark){for(var n=this._configParser.getModules(),o=0;o<t.length;o++){var r=n[t[o]];this._queue.indexOf(r.name)===-1&&this._testConditionalModule(r.condition.test)&&this._queue.push(r.name)}e.conditionalMark=!0}},_resolveDependencies:function(){for(var e=this._configParser.getModules(),t=0;t<this._queue.length;t++){var n=e[this._queue[t]];n||(n=this._configParser.addModule({name:this._queue[t],dependencies:[]})),n.mark||this._visit(n)}},_testConditionalModule:function(testFunction){return"function"==typeof testFunction?testFunction():eval("false || "+testFunction)()},_visit:function(e){if(e.tmpMark)throw new Error("Error processing module: "+e.name+". The provided configuration is not Directed Acyclic Graph.");if(this._processConditionalModules(e),!e.mark){e.tmpMark=!0;for(var t=this._configParser.getModules(),n=0;n<e.dependencies.length;n++){var o=e.dependencies[n];if("require"!==o&&"exports"!==o&&"module"!==o){o=this._pathResolver.resolvePath(e.name,o);var r=this._configParser.mapModule(o,e.map),i=t[r];i||(i=this._configParser.addModule({name:r,dependencies:[]})),this._visit(i)}}e.mark=!0,e.tmpMark=!1,this._result.unshift(e.name)}},_queue:[]},DependencyBuilder}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.URLBuilder=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(e){this._configParser=e}var n=/^https?:\/\/|\/\/|www\./;return t.prototype={constructor:t,build:function(e){var t=[],o=[],r=[],i=[],s=[],a=this._configParser.getConfig(),l=a.basePath||"",u=this._configParser.getModules();l.length&&"/"!==l.charAt(l.length-1)&&(l+="/");for(var d=0;d<e.length;d++){var f=u[e[d]];if(f.fullPath)s.push({modules:[f.name],url:this._getURLWithParams(f.fullPath)});else{var c=this._getModulePath(f),p=0===c.indexOf("/");n.test(c)?s.push({modules:[f.name],url:this._getURLWithParams(c)}):!a.combine||f.anonymous?s.push({modules:[f.name],url:this._getURLWithParams(a.url+(p?"":l)+c)}):p?(t.push(c),r.push(f.name)):(o.push(c),i.push(f.name))}f.requested=!0}return o.length&&(s=s.concat(this._generateBufferURLs(i,o,{basePath:l,url:a.url,urlMaxLength:a.urlMaxLength})),o.length=0),t.length&&(s=s.concat(this._generateBufferURLs(r,t,{url:a.url,urlMaxLength:a.urlMaxLength})),t.length=0),s},_generateBufferURLs:function(e,t,n){var o,r=n.basePath||"",i=[],s=n.urlMaxLength||2e3,a={modules:[e[0]],url:n.url+r+t[0]};for(o=1;o<t.length;o++){var l=e[o],u=t[o];a.url.length+r.length+u.length+1<s?(a.modules.push(l),a.url+="&"+r+u):(i.push(a),a={modules:[l],url:n.url+r+u})}return a.url=this._getURLWithParams(a.url),i.push(a),i},_getModulePath:function(e){var t=e.path||e.name,o=this._configParser.getConfig().paths||{},r=!1;return Object.keys(o).forEach(function(e){t!==e&&0!==t.indexOf(e+"/")||(t=o[e]+t.substring(e.length))}),r||"function"!=typeof o["*"]||(t=o["*"](t)),n.test(t)||t.lastIndexOf(".js")===t.length-3||(t+=".js"),t},_getURLWithParams:function(e){var t=this._configParser.getConfig(),n=t.defaultURLParams||{},o=Object.keys(n);if(!o.length)return e;var r=o.map(function(e){return e+"="+n[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.PathResolver=n}("undefined"!=typeof global?global:this,function(e){"use strict";function t(){}return t.prototype={constructor:t,resolvePath:function(e,t){if("require"===t||"exports"===t||"module"===t||0!==t.indexOf(".")&&0!==t.indexOf(".."))return t;var n=e.split("/");n.splice(-1,1);for(var o=t.split("/"),r=o.splice(-1,1),i=0;i<o.length;i++){var s=o[i];if("."!==s)if(".."===s){if(!n.length){n=n.concat(o.slice(i));break}n.splice(-1,1)}else n.push(s)}return n.push(r),n.join("/")}},t}),function(e,t){"use strict";var n=t(e);"object"==typeof module&&module&&(module.exports=n),"function"==typeof define&&define.amd&&define(t),e.Loader=new n,e.require=e.Loader.require.bind(e.Loader),e.define=e.Loader.define.bind(e.Loader),e.define.amd={}}("undefined"!=typeof global?global:this,function(e){"use strict";function t(n){t.superclass.constructor.apply(this,arguments),this._config=n||e.__CONFIG__,this._modulesMap={}}t.prototype=Object.create(e.EventEmitter.prototype),t.prototype.constructor=t,t.superclass=e.EventEmitter.prototype;var n={addModule:function(e){return this._getConfigParser().addModule(e)},define:function(){var e=this,t=arguments[0],n=arguments[1],o=arguments[2],r=arguments[3]||{};r.anonymous=!1;var i=arguments.length;if(i<2?(o=arguments[0],n=["module","exports"],r.anonymous=!0):2===i&&("string"==typeof t?(n=["module","exports"],o=arguments[1]):(n=arguments[0],o=arguments[1],r.anonymous=!0)),r.anonymous){var s=function(t){if(e.off("scriptLoaded",s),1!==t.length)e._reportMismatchedAnonymousModules(o.toString());else{var i=t[0],a=e.getModules()[i];a&&a.pendingImplementation&&e._reportMismatchedAnonymousModules(o.toString()),e._define(i,n,o,r)}};e.on("scriptLoaded",s)}else this._define(t,n,o,r)},getConditionalModules:function(){return this._getConfigParser().getConditionalModules()},getModules:function(){return this._getConfigParser().getModules()},require:function(){var e,t,n,o,r=this;if(Array.isArray(arguments[0]))n=arguments[0],o="function"==typeof arguments[1]?arguments[1]:null,e="function"==typeof arguments[2]?arguments[2]:null;else for(n=[],t=0;t<arguments.length;++t)if("string"==typeof arguments[t])n[t]=arguments[t];else if("function"==typeof arguments[t]){o=arguments[t],e="function"==typeof arguments[++t]?arguments[t]:null;break}var i,s=r._getConfigParser(),a=s.mapModule(n);new Promise(function(e,t){r._resolveDependencies(a).then(function(o){r._log("Resolved modules:",a,"to:",o);var l=o.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});l.length>0&&t(new Error("The following problems where detected while resolving modules:\n"+l.join("\n")));var u=s.getConfig();0!==u.waitTimeout&&(i=setTimeout(function(){var e=s.getModules(),r=new Error("Load timeout for modules: "+n);r.dependencies=o,r.mappedModules=a,r.missingDependencies=o.filter(function(t){return"undefined"==typeof e[t].implementation}),r.modules=n,r.dependecies=r.dependencies,t(r)},u.waitTimeout||7e3)),r._loadModules(o).then(e,t)},t)}).then(function(e){if(clearTimeout(i),o){var t=r._getModuleImplementations(a);o.apply(o,t)}},function(t){clearTimeout(i),e?e.call(e,t):r._error("Unhandled failure:",t,"while resolving modules:",a)})},_createModulePromise:function(e){var t=this;return new Promise(function(n,o){var r=t._getConfigParser().getModules(),i=r[e];if(i.exports){var s=t._getValueGlobalNS(i.exports);if(s)n(s);else{var a=function(r){if(r.indexOf(e)>=0){t.off("scriptLoaded",a);var s=t._getValueGlobalNS(i.exports);s?n(s):o(new Error("Module "+e+" does not export the specified value: "+i.exports))}};t.on("scriptLoaded",a)}}else{var l=function(o){o===e&&(t.off("moduleRegister",l),t._modulesMap[e]=!0,n(e))};t.on("moduleRegister",l)}})},_define:function(e,t,n,o){var r=o||{},i=this._getConfigParser();if(i.getConfig().ignoreModuleVersion){var s=e.split("/"),a=s[0].split("@");s[0]=a[0],e=s.join("/")}var l=this._getPathResolver();t=t.map(function(t){return l.resolvePath(e,t)}),r.name=e,r.dependencies=t,r.pendingImplementation=n,i.addModule(r),this._modulesMap[r.name]||(this._modulesMap[r.name]=!0),this.emit("moduleRegister",e)},_getConfigParser:function(){return this._configParser||(this._configParser=new e.ConfigParser(this._config)),this._configParser},_getDependencyBuilder:function(){return this._dependencyBuilder||(this._dependencyBuilder=new e.DependencyBuilder(this._getConfigParser())),this._dependencyBuilder},_getValueGlobalNS:function(e){for(var t=e.split("."),n=(0,eval)("this")[t[0]],o=1;n&&o<t.length;o++){if(!Object.prototype.hasOwnProperty.call(n,t[o]))return null;n=n[t[o]]}return n},_getMissingDependencies:function(e){for(var t=this._getConfigParser(),n=t.getModules(),o=Object.create(null),r=0;r<e.length;r++)for(var i=n[e[r]],s=t.mapModule(i.dependencies,i.map),a=0;a<s.length;a++){var l=s[a],u=n[l];"require"===l||"exports"===l||"module"===l||u&&u.pendingImplementation||(o[l]=1)}return Object.keys(o)},_getModuleImplementations:function(e){for(var t=[],n=this._getConfigParser().getModules(),o=0;o<e.length;o++){var r=n[e[o]];t.push(r?r.implementation:void 0)}return t},_getPathResolver:function(){return this._pathResolver||(this._pathResolver=new e.PathResolver),this._pathResolver},_getURLBuilder:function(){return this._urlBuilder||(this._urlBuilder=new e.URLBuilder(this._getConfigParser())),this._urlBuilder},_filterModulesByProperty:function(e,t){var n=t;"string"==typeof t&&(n=[t]);for(var o=[],r=this._getConfigParser().getModules(),i=0;i<e.length;i++){var s=e[i],a=r[e[i]];if(a){if("require"!==a&&"exports"!==a&&"module"!==a){for(var l=0,u=0;u<n.length;u++)if(a[n[u]]){l=!0;break}l||o.push(s)}}else o.push(s)}return o},_loadModules:function(e){var t=this;return new Promise(function(n,o){var r=t._filterModulesByProperty(e,["requested","pendingImplementation"]);if(r.length){for(var i=t._getURLBuilder().build(r),s=[],a=0;a<i.length;a++)s.push(t._loadScript(i[a]));Promise.all(s).then(function(n){return t._waitForModules(e)}).then(function(e){n(e)})["catch"](function(e){o(e)})}else t._waitForModules(e).then(function(e){n(e)})["catch"](function(e){o(e)})})},_loadScript:function(e){var t=this;return new Promise(function(n,o){var r=document.createElement("script");r.src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){this.readyState&&"complete"!==this.readyState&&"load"!==this.readyState||(r.onload=r.onreadystatechange=null,n(r),t.emit("scriptLoaded",e.modules))},r.onerror=function(){document.head.removeChild(r),o(r)},document.head.appendChild(r)})},_log:function(){var e=console,t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments),n=this._getConfigParser().getConfig();n.explainResolutions&&e.log.apply(e,["Liferay AMD Loader:"].concat(t))},_error:function(){var e=console,t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.log.apply(e,["Liferay AMD Loader:"].concat(t))},_resolveDependencies:function(e){var t=this;return new Promise(function(n,o){try{var r=t._getDependencyBuilder().resolveDependencies(e);n(r)}catch(i){o(i)}})},_reportMismatchedAnonymousModules:function(e){var t="Mismatched anonymous define() module: "+e,n=this._config.reportMismatchedAnonymousModules;if(!n||"exception"===n)throw new Error(t);console&&console[n]&&console[n].call(console,t)},_setModuleImplementation:function(e){for(var t=this,n=this._getConfigParser().getModules(),o=0;o<e.length;o++){var r=e[o];if("undefined"==typeof r.implementation)if("undefined"==typeof r.exports){for(var i=[],s={exports:{}},a=t._getConfigParser(),l=0;l<r.dependencies.length;l++){var u=r.dependencies[l];if("exports"===u)i.push(s.exports);else if("module"===u)i.push(s);else if("require"===u){var d=t._createLocalRequire(r);d.toUrl=function(e){var n=t._getURLBuilder().build([e]);return n[0].url},i.push(d)}else{var f=n[a.mapModule(u,r.map)],c=f.implementation;i.push(c)}}var p;p="function"==typeof r.pendingImplementation?r.pendingImplementation.apply(r.pendingImplementation,i):r.pendingImplementation,"undefined"!=typeof p?r.implementation=p:r.implementation=s.exports}else r.pendingImplementation=r.implementation=this._getValueGlobalNS(r.exports)}},_createLocalRequire:function(t){var n=this._getConfigParser(),o=this._getPathResolver();return function(r){var i=arguments.length;if(!(i>1)){r=o.resolvePath(t.name,r),r=n.mapModule(r,t.map);var s=n.getModules()[r];if(!s||"undefined"==typeof s.implementation)throw new Error('Module "'+r+'" has not been loaded yet for context: '+t.name);return s.implementation}e.require.apply(e.Loader,arguments)}},_waitForModule:function(e){var t=this,n=t._modulesMap[e];return n||(n=t._createModulePromise(e),t._modulesMap[e]=n),n},_waitForModules:function(e){var t=this;return new Promise(function(n,o){for(var r=[],i=0;i<e.length;i++)r.push(t._waitForModule(e[i]));Promise.all(r).then(function(r){var i=t._getConfigParser().getModules(),s=function(){for(var o=[],r=0;r<e.length;r++)o.push(i[e[r]]);t._setModuleImplementation(o),n(o)},a=t._getMissingDependencies(e);a.length?t.require(a,s,o):s()},o)})}};return Object.keys(n).forEach(function(e){t.prototype[e]=n[e]}),t.prototype.define.amd={},t});var namespace=null,exposeGlobal=!0;if("object"==typeof global.__CONFIG__&&("string"==typeof global.__CONFIG__.namespace&&(namespace=global.__CONFIG__.namespace),"boolean"==typeof global.__CONFIG__.exposeGlobal&&(exposeGlobal=global.__CONFIG__.exposeGlobal)),namespace){var ns=window[global.__CONFIG__.namespace]?window[global.__CONFIG__.namespace]:{};ns.Loader=global.Loader,window[global.__CONFIG__.namespace]=ns}else window.Loader=global.Loader;exposeGlobal&&(window.Loader=global.Loader,window.require=global.require,window.define=global.define),global.Loader.version=function(){return"2.3.0"}}(); |
@@ -1292,2 +1292,27 @@ (function() { | ||
self._log( | ||
'Resolved modules:', | ||
mappedModules, | ||
'to:', | ||
dependencies | ||
); | ||
var dependencyErrors = dependencies | ||
.filter(function(dep) { | ||
return dep.indexOf(':ERROR:') === 0; | ||
}) | ||
.map(function(dep) { | ||
return dep.substr(7); | ||
}); | ||
if (dependencyErrors.length > 0) { | ||
reject( | ||
new Error( | ||
'The following problems where detected while ' + | ||
'resolving modules:\n' + | ||
dependencyErrors.join('\n') | ||
) | ||
); | ||
} | ||
var config = configParser.getConfig(); | ||
@@ -1350,2 +1375,9 @@ | ||
failureCallback.call(failureCallback, error); | ||
} else { | ||
self._error( | ||
'Unhandled failure:', | ||
error, | ||
'while resolving modules:', | ||
mappedModules | ||
); | ||
} | ||
@@ -1794,2 +1826,29 @@ } | ||
_log: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
var config = this._getConfigParser().getConfig(); | ||
if (config.explainResolutions) { | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
} | ||
}, | ||
_error: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
}, | ||
/** | ||
@@ -2086,3 +2145,3 @@ * Resolves modules dependencies. | ||
global.Loader.version = function() { return '2.2.0' }; | ||
global.Loader.version = function() { return '2.3.0' }; | ||
}()); |
@@ -5,9 +5,8 @@ /* eslint-env node */ | ||
var babel = require('gulp-babel'); | ||
var childProcess = require('child_process'); | ||
var concat = require('gulp-concat'); | ||
var del = require('del'); | ||
var exec = require('child_process').exec; | ||
var fs = require('fs'); | ||
var gulp = require('gulp'); | ||
var istanbul = require('gulp-istanbul'); | ||
var jsdoc = require('gulp-jsdoc'); | ||
var merge = require('merge-stream'); | ||
@@ -74,3 +73,3 @@ var mocha = require('gulp-mocha'); | ||
gulp.task('build-config', ['config', 'modules'], function(callback) { | ||
exec( | ||
childProcess.exec( | ||
'node node_modules/liferay-module-config-generator/bin/index.js ' + | ||
@@ -225,4 +224,21 @@ '-b src/config/config-base.js ' + | ||
gulp.task('jsdoc', function() { | ||
gulp.src(['./src/js/**/*.js', 'README.md']).pipe(jsdoc('api')); | ||
gulp.task('jsdoc', function(cb) { | ||
var files = []; | ||
gulp | ||
.src(['./src/js/**/*.js', 'README.md'], { read: false }) | ||
.pipe( | ||
through.obj(function(file, encoding, cb) { | ||
files.push(file.path); | ||
cb(null, file); | ||
}) | ||
) | ||
.on('finish', function() { | ||
childProcess.spawnSync( | ||
'./node_modules/.bin/jsdoc', | ||
['-d', 'api'].concat(files) | ||
); | ||
cb(); | ||
}); | ||
}); | ||
@@ -229,0 +245,0 @@ |
{ | ||
"name": "liferay-amd-loader", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "AMD Loader with support for combo URL and conditional loading", | ||
@@ -11,2 +11,3 @@ "main": "main.js", | ||
"publish-please": "publish-please", | ||
"start": "http-server ./dist/demo -p 8080", | ||
"test": "gulp test" | ||
@@ -53,3 +54,2 @@ }, | ||
"gulp-istanbul": "^0.10.0", | ||
"gulp-jsdoc": "^0.1.5", | ||
"gulp-mocha": "^2.1.1", | ||
@@ -60,4 +60,5 @@ "gulp-rename": "^1.2.2", | ||
"gulp-uglify": "^1.2.0", | ||
"http-server": "^0.10.0", | ||
"husky": "^0.13.4", | ||
"jsdoc": "^3.4.0", | ||
"jsdoc": "^3.5.5", | ||
"jshint-stylish": "^2.0.0", | ||
@@ -64,0 +65,0 @@ "liferay-module-config-generator": "latest", |
@@ -28,5 +28,5 @@ AMD Module Loader | ||
1. The default configuration and the demo require a combo loader. Go to the folder, where you cloned the loader, then run `node combo.js`. This will run a combo handler on port 3000. | ||
2. Download [mongoose](https://github.com/cesanta/mongoose) or if you have `brew` just do `brew install mongoose`, then navigate to Loader folder and run mongoose with the following params: | ||
`mongoose -listening_port 8080 -document_root dist`. | ||
3. Open a browser, for example Chrome and load `http://localhost:8080/demo/`. Open the console and look for the messages. You will see that resouces are being loaded. | ||
2. Run start script: | ||
`npm run start`. | ||
3. Open a browser, for example Chrome and load `http://localhost:8080/`. Open the console and look for the messages. You will see that resouces are being loaded. | ||
@@ -33,0 +33,0 @@ Loader features |
@@ -233,2 +233,27 @@ 'use strict'; | ||
self._log( | ||
'Resolved modules:', | ||
mappedModules, | ||
'to:', | ||
dependencies | ||
); | ||
var dependencyErrors = dependencies | ||
.filter(function(dep) { | ||
return dep.indexOf(':ERROR:') === 0; | ||
}) | ||
.map(function(dep) { | ||
return dep.substr(7); | ||
}); | ||
if (dependencyErrors.length > 0) { | ||
reject( | ||
new Error( | ||
'The following problems where detected while ' + | ||
'resolving modules:\n' + | ||
dependencyErrors.join('\n') | ||
) | ||
); | ||
} | ||
var config = configParser.getConfig(); | ||
@@ -291,2 +316,9 @@ | ||
failureCallback.call(failureCallback, error); | ||
} else { | ||
self._error( | ||
'Unhandled failure:', | ||
error, | ||
'while resolving modules:', | ||
mappedModules | ||
); | ||
} | ||
@@ -735,2 +767,29 @@ } | ||
_log: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
var config = this._getConfigParser().getConfig(); | ||
if (config.explainResolutions) { | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
} | ||
}, | ||
_error: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
}, | ||
/** | ||
@@ -737,0 +796,0 @@ * Resolves modules dependencies. |
@@ -255,2 +255,27 @@ (function (global, factory) { | ||
self._log( | ||
'Resolved modules:', | ||
mappedModules, | ||
'to:', | ||
dependencies | ||
); | ||
var dependencyErrors = dependencies | ||
.filter(function(dep) { | ||
return dep.indexOf(':ERROR:') === 0; | ||
}) | ||
.map(function(dep) { | ||
return dep.substr(7); | ||
}); | ||
if (dependencyErrors.length > 0) { | ||
reject( | ||
new Error( | ||
'The following problems where detected while ' + | ||
'resolving modules:\n' + | ||
dependencyErrors.join('\n') | ||
) | ||
); | ||
} | ||
var config = configParser.getConfig(); | ||
@@ -313,2 +338,9 @@ | ||
failureCallback.call(failureCallback, error); | ||
} else { | ||
self._error( | ||
'Unhandled failure:', | ||
error, | ||
'while resolving modules:', | ||
mappedModules | ||
); | ||
} | ||
@@ -757,2 +789,29 @@ } | ||
_log: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
var config = this._getConfigParser().getConfig(); | ||
if (config.explainResolutions) { | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
} | ||
}, | ||
_error: function() { | ||
var aliasedConsole = console; | ||
var args = arguments.length === 1 | ||
? [arguments[0]] | ||
: Array.apply(null, arguments); | ||
aliasedConsole.log.apply( | ||
aliasedConsole, | ||
['Liferay AMD Loader:'].concat(args) | ||
); | ||
}, | ||
/** | ||
@@ -759,0 +818,0 @@ * Resolves modules dependencies. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2172399
221
17694