New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

liferay-amd-loader

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liferay-amd-loader - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

2

build/loader/loader-min.js

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"resolvePath",value: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("/"),i=r.splice(-1,1),o=0;o<r.length;o++){var u=r[o];if("."!==u)if(".."===u){if(!n.length){n=n.concat(r.slice(o));break}n.splice(-1,1)}else n.push(u)}return n.push(i),n.join("/")}}]),e}();t.default=i},function(e,t,n){"use strict";var r=o(n(2)),i=o(n(8));function o(e){return e&&e.__esModule?e:{default:e}}void 0===window.Promise&&(window.Promise=i.default);var u=window.__CONFIG__||{},a="string"==typeof u.namespace?u.namespace:void 0,s=void 0===u.exposeGlobal||u.exposeGlobal,l=new r.default(u);if(a){var c=window[a]?window[a]:{};c.Loader=l,window[a]=c}else window.Loader=l;s&&(window.Loader=l,window.require=r.default.prototype.require.bind(l),window.define=r.default.prototype.define.bind(l),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=c(n(3)),o=c(n(4)),u=c(n(5)),a=c(n(0)),s=c(n(6)),l=c(n(7));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._config=e||window.__CONFIG__,r._document=n||window.document,r._modulesMap={},r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.default),r(t,[{key:"version",value:function(){return l.default.version}},{key:"addModule",value:function(e){return this._getConfigParser().addModule(e)}},{key:"define",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0],o=n[1],u=n[2],a=n[3]||{};a.anonymous=!1;var s=arguments.length;if(s<2?(u=n[0],o=["module","exports"],a.anonymous=!0):2===s&&("string"==typeof i?(o=["module","exports"],u=n[1]):(o=n[0],u=n[1],a.anonymous=!0)),a.anonymous){this.on("scriptLoaded",function t(n){if(e.off("scriptLoaded",t),1!==n.length)e._reportMismatchedAnonymousModules(u.toString());else{var r=n[0],i=e.getModules()[r];i&&i.pendingImplementation&&e._reportMismatchedAnonymousModules(u.toString()),e._define(r,o,u,a)}})}else this._define(i,o,u,a)}},{key:"getConditionalModules",value:function(){return this._getConfigParser().getConditionalModules()}},{key:"getModules",value:function(){return this._getConfigParser().getModules()}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=this._normalizeRequireArgs(n),o=i.modules,u=i.successCallback,a=i.failureCallback,s=this._getConfigParser().mapModule(o),l=void 0;new Promise(function(t,n){e._resolveDependencies(s).then(function(r){e._log("Resolved modules:",s,"to:",r);var i=e._getResolutionError(r);i?n(i):(l=e._setRejectTimeout(o,s,r,n),e._loadModules(r).then(t,n))},n)}).then(function(){if(clearTimeout(l),u){var t;t=e._getModuleImplementations(s),u.apply(u,t)}},function(t){clearTimeout(l),a?a.call(a,t):e._error("Unhandled failure:",t,"while resolving modules:",s)})}},{key:"_normalizeRequireArgs",value:function(e){var t=void 0,n=void 0,r=void 0;if(Array.isArray(e[0]))t=e[0],n="function"==typeof e[1]?e[1]:null,r="function"==typeof e[2]?e[2]:null;else{t=[];for(var i=0;i<e.length;++i)if("string"==typeof e[i])t[i]=e[i];else if("function"==typeof e[i]){n=e[i],r="function"==typeof e[++i]?e[i]:null;break}}return{modules:t,successCallback:n,failureCallback:r}}},{key:"_getResolutionError",value:function(e){var t=e.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});return t.length>0?new Error("The following problems where detected while resolving modules:\n"+t.join("\n")):null}},{key:"_setRejectTimeout",value:function(e,t,n,r){var i=this._getConfigParser(),o=i.getConfig(),u=void 0;return 0!==o.waitTimeout&&(u=setTimeout(function(){var o=i.getModules(),u=new Error("Load timeout for modules: "+e);u.modules=e,u.mappedModules=t,u.dependencies=n;var a=void 0;a=n.filter(function(e){return void 0===o[e].implementation}),u.missingDependencies=a,a=u.missingDependencies.filter(function(e){return void 0!==o[e].pendingImplementation}),u.fetchedMissingDependencies=a,a=u.missingDependencies.filter(function(e){return void 0===o[e].pendingImplementation}),u.unfetchedMissingDependencies=a,u.dependecies=u.dependencies,r(u)},o.waitTimeout||7e3)),u}},{key:"_createModulePromise",value:function(e){var t=this;return new Promise(function(n,r){var i=t._getConfigParser().getModules()[e];if(i.exports){var o=t._getValueGlobalNS(i.exports);if(o)n(o);else{t.on("scriptLoaded",function o(u){if(u.indexOf(e)>=0){t.off("scriptLoaded",o);var a=t._getValueGlobalNS(i.exports);a?n(a):r(new Error("Module "+e+" does not export the specified value: "+i.exports))}})}}else{t.on("moduleRegister",function r(i){i===e&&(t.off("moduleRegister",r),t._modulesMap[e]=!0,n(e))})}})}},{key:"_define",value:function(e,t,n,r){var i=r||{},o=this._getConfigParser();if(o.getConfig().ignoreModuleVersion){var u=e.split("/"),a=u[0].split("@");u[0]=a[0],e=u.join("/")}var s=this._getPathResolver();t=t.map(function(t){return s.resolvePath(e,t)}),i.name=e,i.dependencies=t,i.pendingImplementation=n,o.addModule(i),this._modulesMap[i.name]||(this._modulesMap[i.name]=!0),this.emit("moduleRegister",e)}},{key:"_getConfigParser",value:function(){return this._configParser||(this._configParser=new i.default(this._config)),this._configParser}},{key:"_getDependencyBuilder",value:function(){return this._dependencyBuilder||(this._dependencyBuilder=new o.default(this._getConfigParser())),this._dependencyBuilder}},{key:"_getValueGlobalNS",value: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}},{key:"_getMissingDependencies",value:function(e){for(var t=this._getConfigParser(),n=t.getModules(),r=Object.create(null),i=0;i<e.length;i++)for(var o=n[e[i]],u=t.mapModule(o.dependencies,o.map),a=0;a<u.length;a++){var s=u[a],l=n[s];"require"===s||"exports"===s||"module"===s||l&&l.pendingImplementation||(r[s]=1)}return Object.keys(r)}},{key:"_getModuleImplementations",value:function(e){for(var t=[],n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var i=n[e[r]];t.push(i?i.implementation:void 0)}return t}},{key:"_getPathResolver",value:function(){return this._pathResolver||(this._pathResolver=new a.default),this._pathResolver}},{key:"_getURLBuilder",value:function(){return this._urlBuilder||(this._urlBuilder=new s.default(this._getConfigParser())),this._urlBuilder}},{key:"_filterModulesByProperty",value:function(e,t){var n=t;"string"==typeof t&&(n=[t]);for(var r=[],i=this._getConfigParser().getModules(),o=0;o<e.length;o++){var u=e[o],a=i[e[o]];if(a){if("require"!==a&&"exports"!==a&&"module"!==a){for(var s=!1,l=0;l<n.length;l++)if(a[n[l]]){s=!0;break}s||r.push(u)}}else r.push(u)}return r}},{key:"_loadModules",value:function(e){var t=this;return new Promise(function(n,r){var i=t._filterModulesByProperty(e,["requested","pendingImplementation"]);if(i.length){for(var o=t._getURLBuilder().build(i),u=[],a=0;a<o.length;a++)u.push(t._loadScript(o[a]));Promise.all(u).then(function(){return t._waitForModules(e)}).then(n).catch(r)}else t._waitForModules(e).then(n).catch(r)})}},{key:"_loadScript",value:function(e){var t=this,n=this;return new Promise(function(r,i){var o=t._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,r(o),n.emit("scriptLoaded",e.modules))},o.onerror=function(){t._document.head.removeChild(o),i(o)},t._document.head.appendChild(o)})}},{key:"_log",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=console,i=1===arguments.length?[t[0]]:Array.apply(void 0,t);this._getConfigParser().getConfig().explainResolutions&&r.log.apply(r,f(["Liferay AMD Loader:"].concat(i)))}},{key:"_error",value:function(){var e=console,t=1===arguments.length?[arguments.length<=0?void 0:arguments[0]]:Array.apply(void 0,arguments);e.log.apply(e,f(["Liferay AMD Loader:"].concat(t)))}},{key:"_resolveDependencies",value:function(e){var t=this;return new Promise(function(n,r){try{n(t._getDependencyBuilder().resolveDependencies(e))}catch(e){r(e)}})}},{key:"_reportMismatchedAnonymousModules",value:function(e){var t="Mismatched anonymous define() module: "+e,n=this._config.reportMismatchedAnonymousModules;if(!n||"exception"===n)throw new Error(t);console&&console[n]}},{key:"_setModuleImplementation",value:function(e){for(var t=this,n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var i=e[r];if(void 0===i.implementation)if(void 0===i.exports){for(var o=[],u={exports:{}},a=this._getConfigParser(),s=0;s<i.dependencies.length;s++){var l=i.dependencies[s];if("exports"===l)o.push(u.exports);else if("module"===l)o.push(u);else if("require"===l){var c=this._createLocalRequire(i);c.toUrl=function(e){return t._getURLBuilder().build([e])[0].url},o.push(c)}else{var f=n[a.mapModule(l,i.map)].implementation;o.push(f)}}var d=void 0;d="function"==typeof i.pendingImplementation?i.pendingImplementation.apply(i.pendingImplementation,o):i.pendingImplementation,i.implementation=void 0!==d?d:u.exports}else i.implementation=this._getValueGlobalNS(i.exports),i.pendingImplementation=i.implementation}}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._getConfigParser(),r=this._getPathResolver();return function(i){for(var o=arguments.length,u=Array(o>1?o-1:0),a=1;a<o;a++)u[a-1]=arguments[a];if(u.length>0)return t.require.apply(t,[i].concat(u));i=r.resolvePath(e.name,i),i=n.mapModule(i,e.map);var s=n.getModules()[i];if(!s||void 0===s.implementation)throw new Error('Module "'+i+'" has not been loaded yet for context: '+e.name);return s.implementation}}},{key:"_waitForModule",value:function(e){var t=this._modulesMap[e];return t||(t=this._createModulePromise(e),this._modulesMap[e]=t),t}},{key:"_waitForModules",value:function(e){var t=this;return new Promise(function(n,r){for(var i=[],o=0;o<e.length;o++)i.push(t._waitForModule(e[o]));Promise.all(i).then(function(){var i=t._getConfigParser().getModules(),o=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,o,r):o()},r)})}}]),t}();t.default=d,d.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config={},this._modules={},this._conditionalModules={},this._parseConfig(t)}return r(e,[{key:"addModule",value: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]}},{key:"getConfig",value:function(){return this._config}},{key:"getConditionalModules",value:function(){return this._conditionalModules}},{key:"getModules",value:function(){return this._modules}},{key:"mapModule",value:function(e,t){if(!this._config.maps&&!t)return e;var n=void 0;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]}},{key:"_getModuleMapper",value:function(e){var t=this;return function(n){var r=void 0;return(r=t._mapExactMatch(n,e))||(r=t._mapPartialMatch(n,e)),r||(r=t._mapWildcardMatch(n,e)),r||n}}},{key:"_mapExactMatch",value: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}}},{key:"_mapPartialMatch",value: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)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"_parseConfig",value: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}},{key:"_parseModules",value: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}},{key:"_registerConditionalModule",value:function(e){if(e.condition){var t=this._conditionalModules[e.condition.trigger];t||(this._conditionalModules[e.condition.trigger]=t=[]),t.push(e.name)}}}]),e}();t.default=i},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_pathResolver=__webpack_require__(0),_pathResolver2=_interopRequireDefault(_pathResolver);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var DependencyBuilder=function(){function DependencyBuilder(e){_classCallCheck(this,DependencyBuilder),this._configParser=e,this._pathResolver=new _pathResolver2.default,this._result=[],this._queue=[],this._cachedResolutions={}}return _createClass(DependencyBuilder,[{key:"resolveDependencies",value:function(e){var t=e.sort().join(),n=this._cachedResolutions[t];if(!n)try{this._queue=e.slice(0),this._resolveDependencies(),n=this._result.reverse().slice(0),this._cachedResolutions[t]=n}finally{this._cleanup()}return n}},{key:"_cleanup",value:function(){var e=this._configParser.getModules();for(var t in e)if(Object.prototype.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}},{key:"_processConditionalModules",value: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 i=n[t[r]];-1===this._queue.indexOf(i.name)&&this._testConditionalModule(i.condition.test)&&this._queue.push(i.name)}e.conditionalMark=!0}}},{key:"_resolveDependencies",value: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)}}},{key:"_testConditionalModule",value:function _testConditionalModule(testFunction){return"function"==typeof testFunction?testFunction():eval("false || "+testFunction)()}},{key:"_visit",value: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 i=this._configParser.mapModule(r,e.map),o=t[i];o||(o=this._configParser.addModule({name:i,dependencies:[]})),this._visit(o)}}e.mark=!0,e.tmpMark=!1,this._result.unshift(e.name)}}}]),DependencyBuilder}();exports.default=DependencyBuilder},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._events={}}return r(e,[{key:"on",value:function(e,t){(this._events[e]=this._events[e]||[]).push(t)}},{key:"off",value:function(e,t){var n=this._events[e];if(n){var r=n.indexOf(t);r>-1&&n.splice(r,1)}}},{key:"emit",value:function(e,t){var n=this._events[e];if(n){n=n.slice(0);for(var r=0;r<n.length;r++){var i=n[r];i.call(i,t)}}}}]),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=/^https?:\/\/|\/\/|www\./,o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._configParser=t}return r(e,[{key:"build",value:function(e){var t=[],n=[],r=[],o=[],u=[],a=this._configParser.getConfig(),s=a.basePath||"",l=this._configParser.getModules();s.length&&"/"!==s.charAt(s.length-1)&&(s+="/");for(var c=0;c<e.length;c++){var f=l[e[c]];if(f.fullPath)u.push({modules:[f.name],url:this._getURLWithParams(f.fullPath)});else{var d=this._getModulePath(f),h=0===d.indexOf("/");i.test(d)?u.push({modules:[f.name],url:this._getURLWithParams(d)}):!a.combine||f.anonymous?u.push({modules:[f.name],url:this._getURLWithParams(a.url+(h?"":s)+d)}):h?(t.push(d),r.push(f.name)):(n.push(d),o.push(f.name))}f.requested=!0}return n.length&&(u=u.concat(this._generateBufferURLs(o,n,{basePath:s,url:a.url,urlMaxLength:a.urlMaxLength})),n.length=0),t.length&&(u=u.concat(this._generateBufferURLs(r,t,{url:a.url,urlMaxLength:a.urlMaxLength})),t.length=0),u}},{key:"_generateBufferURLs",value:function(e,t,n){var r=void 0,i=n.basePath||"",o=[],u=n.urlMaxLength||2e3,a={modules:[e[0]],url:n.url+i+t[0]};for(r=1;r<t.length;r++){var s=e[r],l=t[r];a.url.length+i.length+l.length+1<u?(a.modules.push(s),a.url+="&"+i+l):(o.push(a),a={modules:[s],url:n.url+i+l})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=e.path||e.name,n=this._configParser.getConfig().paths||{};return Object.keys(n).forEach(function(e){t!==e&&0!==t.indexOf(e+"/")||(t=n[e]+t.substring(e.length))}),"function"==typeof n["*"]&&(t=n["*"](t)),i.test(t)||t.lastIndexOf(".js")===t.length-3||(t+=".js"),t}},{key:"_getURLWithParams",value:function(e){var t=this._configParser.getConfig().defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map(function(e){return e+"="+t[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t){e.exports={name:"liferay-amd-loader",version:"3.1.0",description:"AMD Loader with support for combo URL and conditional loading",scripts:{clean:"rm -rf build",build:"node bin/build-loader.js",ci:"prettier-eslint --list-different && npm run lint && npm run build && npm run build-demo && npm test","build-demo":"node bin/build-demo.js",demo:"node bin/run-demo.js",test:"jest",format:"prettier-eslint --write 'src/**/*.js'",lint:"eslint 'src/**/*.js' && eslint 'bin/**/*.js'",prepublish:"publish-please guard","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test"},repository:{type:"git",url:"https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/fixture/.*"]},author:"Iliyan Peychev",license:"LGPL-3.0",keywords:["Liferay","AMD","ES6","Loader"],bugs:{url:"https://github.com/liferay/liferay-amd-loader/issues"},homepage:"https://github.com/liferay/liferay-amd-loader",files:[".babelrc",".eslintrc",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],dependencies:{"es6-promise":"^4.0.5"},devDependencies:{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1",combohandler:"^0.4.0",eslint:"^4.17.0","eslint-config-liferay":"^2.0.18","fs-extra":"^5.0.0",globby:"^7.1.1","http-server":"^0.11.1",jest:"^22.2.1","liferay-module-config-generator":"^1.3.3","prettier-eslint-cli":"^4.7.0","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^3.10.0","webpack-clear-console":"^1.0.3"}}},function(e,t,n){(function(t,r){var i;i=function(){"use strict";function e(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,u=void 0,a=void 0,s=function(e,t){v[o]=e,v[o+1]=t,2===(o+=2)&&(a?a(g):w())};var l="undefined"!=typeof window?window:void 0,c=l||{},f=c.MutationObserver||c.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(g,1)}}var v=new Array(1e3);function g(){for(var e=0;e<o;e+=2){(0,v[e])(v[e+1]),v[e]=void 0,v[e+1]=void 0}o=0}var m,_,y,b,w=void 0;function M(e,t){var n=arguments,r=this,i=new this.constructor(C);void 0===i[k]&&N(i);var o,u=r._state;return u?(o=n[u-1],s(function(){return F(u,i,o,r._result)})):S(r,i,e,t),i}function P(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(C);return T(t,e),t}d?w=function(){return t.nextTick(g)}:f?(_=0,y=new f(g),b=document.createTextNode(""),y.observe(b,{characterData:!0}),w=function(){b.data=_=++_%2}):h?((m=new MessageChannel).port1.onmessage=g,w=function(){return m.port2.postMessage(0)}):w=void 0===l?function(){try{var e=n(11);return void 0!==(u=e.runOnLoop||e.runOnContext)?function(){u(g)}:p()}catch(e){return p()}}():p();var k=Math.random().toString(36).substring(16);function C(){}var j=void 0,O=1,x=2,A=new I;function R(e){try{return e.then}catch(e){return A.error=e,A}}function L(t,n,r){n.constructor===t.constructor&&r===M&&n.constructor.resolve===P?function(e,t){t._state===O?D(e,t._result):t._state===x?q(e,t._result):S(t,void 0,function(t){return T(e,t)},function(t){return q(e,t)})}(t,n):r===A?(q(t,A.error),A.error=null):void 0===r?D(t,n):e(r)?function(e,t,n){s(function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,function(n){r||(r=!0,t!==n?T(e,n):D(e,n))},function(t){r||(r=!0,q(e,t))},e._label);!r&&i&&(r=!0,q(e,i))},e)}(t,n,r):D(t,n)}function T(e,t){var n;e===t?q(e,new TypeError("You cannot resolve a promise with itself")):"function"==typeof(n=t)||"object"==typeof n&&null!==n?L(e,t,R(t)):D(e,t)}function E(e){e._onerror&&e._onerror(e._result),B(e)}function D(e,t){e._state===j&&(e._result=t,e._state=O,0!==e._subscribers.length&&s(B,e))}function q(e,t){e._state===j&&(e._state=x,e._result=t,s(E,e))}function S(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+O]=n,i[o+x]=r,0===o&&e._state&&s(B,e)}function B(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,i=void 0,o=e._result,u=0;u<t.length;u+=3)r=t[u],i=t[u+n],r?F(n,r,i,o):i(o);e._subscribers.length=0}}function I(){this.error=null}var U=new I;function F(t,n,r,i){var o=e(r),u=void 0,a=void 0,s=void 0,l=void 0;if(o){if((u=function(e,t){try{return e(t)}catch(e){return U.error=e,U}}(r,i))===U?(l=!0,a=u.error,u.error=null):s=!0,n===u)return void q(n,new TypeError("A promises callback cannot return that same promise."))}else u=i,s=!0;n._state!==j||(o&&s?T(n,u):l?q(n,a):t===O?D(n,u):t===x&&q(n,u))}var G=0;function N(e){e[k]=G++,e._state=void 0,e._result=void 0,e._subscribers=[]}function W(e,t){this._instanceConstructor=e,this.promise=new e(C),this.promise[k]||N(this.promise),i(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&D(this.promise,this._result))):q(this.promise,new Error("Array Methods must be provided an Array"))}function V(e){this[k]=G++,this._result=this._state=void 0,this._subscribers=[],C!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof V?function(e,t){try{t(function(t){T(e,t)},function(t){q(e,t)})}catch(t){q(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return W.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===j&&n<e;n++)this._eachEntry(t[n],n)},W.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===P){var i=R(e);if(i===M&&e._state!==j)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===V){var o=new n(C);L(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},W.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===j&&(this._remaining--,e===x?q(r,n):this._result[t]=n),0===this._remaining&&D(r,this._result)},W.prototype._willSettleAt=function(e,t){var n=this;S(e,void 0,function(e){return n._settledAt(O,t,e)},function(e){return n._settledAt(x,t,e)})},V.all=function(e){return new W(this,e).promise},V.race=function(e){var t=this;return i(e)?new t(function(n,r){for(var i=e.length,o=0;o<i;o++)t.resolve(e[o]).then(n,r)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},V.resolve=P,V.reject=function(e){var t=new this(C);return q(t,e),t},V._setScheduler=function(e){a=e},V._setAsap=function(e){s=e},V._asap=s,V.prototype={constructor:V,then:M,catch:function(e){return this.then(null,e)}},V.polyfill=function(){var e=void 0;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=V},V.Promise=V,V},e.exports=i()}).call(t,n(9),n(10))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var s,l=[],c=!1,f=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&h())}function h(){if(!c){var e=a(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f<t;)s&&s[f].run();f=-1,t=l.length}s=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new p(e,t)),1!==l.length||c||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"resolvePath",value: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("/"),i=r.splice(-1,1),o=0;o<r.length;o++){var u=r[o];if("."!==u)if(".."===u){if(!n.length){n=n.concat(r.slice(o));break}n.splice(-1,1)}else n.push(u)}return n.push(i),n.join("/")}}]),e}();t.default=i},function(e,t,n){"use strict";var r=o(n(2)),i=o(n(8));function o(e){return e&&e.__esModule?e:{default:e}}void 0===window.Promise&&(window.Promise=i.default);var u=window.__CONFIG__||{},a="string"==typeof u.namespace?u.namespace:void 0,s=void 0===u.exposeGlobal||u.exposeGlobal,l=new r.default(u);if(a){var c=window[a]?window[a]:{};c.Loader=l,window[a]=c}else window.Loader=l;s&&(window.Loader=l,window.require=r.default.prototype.require.bind(l),window.define=r.default.prototype.define.bind(l),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=c(n(3)),o=c(n(4)),u=c(n(5)),a=c(n(0)),s=c(n(6)),l=c(n(7));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._config=e||window.__CONFIG__,r._document=n||window.document,r._modulesMap={},r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.default),r(t,[{key:"version",value:function(){return l.default.version}},{key:"addModule",value:function(e){return this._getConfigParser().addModule(e)}},{key:"define",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0],o=n[1],u=n[2],a=n[3]||{};a.anonymous=!1;var s=arguments.length;if(s<2?(u=n[0],o=["module","exports"],a.anonymous=!0):2===s&&("string"==typeof i?(o=["module","exports"],u=n[1]):(o=n[0],u=n[1],a.anonymous=!0)),a.anonymous){this.on("scriptLoaded",function t(n){if(e.off("scriptLoaded",t),1!==n.length)e._reportMismatchedAnonymousModules(u.toString());else{var r=n[0],i=e.getModules()[r];i&&i.pendingImplementation&&e._reportMismatchedAnonymousModules(u.toString()),e._define(r,o,u,a)}})}else this._define(i,o,u,a)}},{key:"getConditionalModules",value:function(){return this._getConfigParser().getConditionalModules()}},{key:"getModules",value:function(){return this._getConfigParser().getModules()}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=this._normalizeRequireArgs(n),o=i.modules,u=i.successCallback,a=i.failureCallback,s=this._getConfigParser().mapModule(o),l=void 0;new Promise(function(t,n){e._resolveDependencies(s).then(function(r){e._log("Resolved modules:",s,"to:",r);var i=e._getResolutionError(r);i?n(i):(l=e._setRejectTimeout(o,s,r,n),e._loadModules(r).then(t,n))},n)}).then(function(){if(clearTimeout(l),u){var t;t=e._getModuleImplementations(s),u.apply(u,t)}},function(t){clearTimeout(l),a?a.call(a,t):e._error("Unhandled failure:",t,"while resolving modules:",s)})}},{key:"_normalizeRequireArgs",value:function(e){var t=void 0,n=void 0,r=void 0;if(Array.isArray(e[0]))t=e[0],n="function"==typeof e[1]?e[1]:null,r="function"==typeof e[2]?e[2]:null;else{t=[];for(var i=0;i<e.length;++i)if("string"==typeof e[i])t[i]=e[i];else if("function"==typeof e[i]){n=e[i],r="function"==typeof e[++i]?e[i]:null;break}}return{modules:t,successCallback:n,failureCallback:r}}},{key:"_getResolutionError",value:function(e){var t=e.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});return t.length>0?new Error("The following problems where detected while resolving modules:\n"+t.join("\n")):null}},{key:"_setRejectTimeout",value:function(e,t,n,r){var i=this._getConfigParser(),o=i.getConfig(),u=void 0;return 0!==o.waitTimeout&&(u=setTimeout(function(){var o=i.getModules(),u=new Error("Load timeout for modules: "+e);u.modules=e,u.mappedModules=t,u.dependencies=n;var a=void 0;a=n.filter(function(e){return void 0===o[e].implementation}),u.missingDependencies=a,a=u.missingDependencies.filter(function(e){return void 0!==o[e].pendingImplementation}),u.fetchedMissingDependencies=a,a=u.missingDependencies.filter(function(e){return void 0===o[e].pendingImplementation}),u.unfetchedMissingDependencies=a,u.dependecies=u.dependencies,r(u)},o.waitTimeout||7e3)),u}},{key:"_createModulePromise",value:function(e){var t=this;return new Promise(function(n,r){var i=t._getConfigParser().getModules()[e];if(i.exports){var o=t._getValueGlobalNS(i.exports);if(o)n(o);else{t.on("scriptLoaded",function o(u){if(u.indexOf(e)>=0){t.off("scriptLoaded",o);var a=t._getValueGlobalNS(i.exports);a?n(a):r(new Error("Module "+e+" does not export the specified value: "+i.exports))}})}}else{t.on("moduleRegister",function r(i){i===e&&(t.off("moduleRegister",r),t._modulesMap[e]=!0,n(e))})}})}},{key:"_define",value:function(e,t,n,r){var i=r||{},o=this._getConfigParser();if(o.getConfig().ignoreModuleVersion){var u=e.split("/"),a=u[0].split("@");u[0]=a[0],e=u.join("/")}var s=this._getPathResolver();t=t.map(function(t){return s.resolvePath(e,t)}),i.name=e,i.dependencies=t,i.pendingImplementation=n,o.addModule(i),this._modulesMap[i.name]||(this._modulesMap[i.name]=!0),this.emit("moduleRegister",e)}},{key:"_getConfigParser",value:function(){return this._configParser||(this._configParser=new i.default(this._config)),this._configParser}},{key:"_getDependencyBuilder",value:function(){return this._dependencyBuilder||(this._dependencyBuilder=new o.default(this._getConfigParser())),this._dependencyBuilder}},{key:"_getValueGlobalNS",value: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}},{key:"_getMissingDependencies",value:function(e){for(var t=this._getConfigParser(),n=t.getModules(),r=Object.create(null),i=0;i<e.length;i++)for(var o=n[e[i]],u=t.mapModule(o.dependencies,o.map),a=0;a<u.length;a++){var s=u[a],l=n[s];"require"===s||"exports"===s||"module"===s||l&&l.pendingImplementation||(r[s]=1)}return Object.keys(r)}},{key:"_getModuleImplementations",value:function(e){for(var t=[],n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var i=n[e[r]];t.push(i?i.implementation:void 0)}return t}},{key:"_getPathResolver",value:function(){return this._pathResolver||(this._pathResolver=new a.default),this._pathResolver}},{key:"_getURLBuilder",value:function(){return this._urlBuilder||(this._urlBuilder=new s.default(this._getConfigParser())),this._urlBuilder}},{key:"_filterModulesByProperty",value:function(e,t){var n=t;"string"==typeof t&&(n=[t]);for(var r=[],i=this._getConfigParser().getModules(),o=0;o<e.length;o++){var u=e[o],a=i[e[o]];if(a){if("require"!==a&&"exports"!==a&&"module"!==a){for(var s=!1,l=0;l<n.length;l++)if(a[n[l]]){s=!0;break}s||r.push(u)}}else r.push(u)}return r}},{key:"_loadModules",value:function(e){var t=this;return new Promise(function(n,r){var i=t._filterModulesByProperty(e,["requested","pendingImplementation"]);if(i.length){for(var o=t._getURLBuilder().build(i),u=[],a=0;a<o.length;a++)u.push(t._loadScript(o[a]));Promise.all(u).then(function(){return t._waitForModules(e)}).then(n).catch(r)}else t._waitForModules(e).then(n).catch(r)})}},{key:"_loadScript",value:function(e){var t=this,n=this;return new Promise(function(r,i){var o=t._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,r(o),n.emit("scriptLoaded",e.modules))},o.onerror=function(){t._document.head.removeChild(o),i(o)},t._document.head.appendChild(o)})}},{key:"_log",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=console,i=1===arguments.length?[t[0]]:Array.apply(void 0,t);this._getConfigParser().getConfig().explainResolutions&&r.log.apply(r,f(["Liferay AMD Loader:"].concat(i)))}},{key:"_error",value:function(){var e=console,t=1===arguments.length?[arguments.length<=0?void 0:arguments[0]]:Array.apply(void 0,arguments);e.log.apply(e,f(["Liferay AMD Loader:"].concat(t)))}},{key:"_resolveDependencies",value:function(e){var t=this;return new Promise(function(n,r){try{n(t._getDependencyBuilder().resolveDependencies(e))}catch(e){r(e)}})}},{key:"_reportMismatchedAnonymousModules",value:function(e){var t="Mismatched anonymous define() module: "+e,n=this._config.reportMismatchedAnonymousModules;if(!n||"exception"===n)throw new Error(t);console&&console[n]}},{key:"_setModuleImplementation",value:function(e){for(var t=this,n=this._getConfigParser().getModules(),r=0;r<e.length;r++){var i=e[r];if(void 0===i.implementation)if(void 0===i.exports){for(var o=[],u={exports:{}},a=this._getConfigParser(),s=0;s<i.dependencies.length;s++){var l=i.dependencies[s];if("exports"===l)o.push(u.exports);else if("module"===l)o.push(u);else if("require"===l){var c=this._createLocalRequire(i);c.toUrl=function(e){return t._getURLBuilder().build([e])[0].url},o.push(c)}else{var f=n[a.mapModule(l,i.map)].implementation;o.push(f)}}var d=void 0;d="function"==typeof i.pendingImplementation?i.pendingImplementation.apply(i.pendingImplementation,o):i.pendingImplementation,i.implementation=void 0!==d?d:u.exports}else i.implementation=this._getValueGlobalNS(i.exports),i.pendingImplementation=i.implementation}}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._getConfigParser(),r=this._getPathResolver();return function(i){for(var o=arguments.length,u=Array(o>1?o-1:0),a=1;a<o;a++)u[a-1]=arguments[a];if(u.length>0)return t.require.apply(t,[i].concat(u));i=r.resolvePath(e.name,i),i=n.mapModule(i,e.map);var s=n.getModules()[i];if(!s||void 0===s.implementation)throw new Error('Module "'+i+'" has not been loaded yet for context: '+e.name);return s.implementation}}},{key:"_waitForModule",value:function(e){var t=this._modulesMap[e];return t||(t=this._createModulePromise(e),this._modulesMap[e]=t),t}},{key:"_waitForModules",value:function(e){var t=this;return new Promise(function(n,r){for(var i=[],o=0;o<e.length;o++)i.push(t._waitForModule(e[o]));Promise.all(i).then(function(){var i=t._getConfigParser().getModules(),o=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,o,r):o()},r)})}}]),t}();t.default=d,d.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config={},this._modules={},this._conditionalModules={},this._parseConfig(t)}return r(e,[{key:"addModule",value: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]}},{key:"getConfig",value:function(){return this._config}},{key:"getConditionalModules",value:function(){return this._conditionalModules}},{key:"getModules",value:function(){return this._modules}},{key:"mapModule",value:function(e,t){if(!this._config.maps&&!t)return e;var n=void 0;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]}},{key:"_getModuleMapper",value:function(e){var t=this;return function(n){var r=void 0;return(r=t._mapExactMatch(n,e))||(r=t._mapPartialMatch(n,e)),r||(r=t._mapWildcardMatch(n,e)),r||n}}},{key:"_mapExactMatch",value: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}}},{key:"_mapPartialMatch",value: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)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"_parseConfig",value: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}},{key:"_parseModules",value: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}},{key:"_registerConditionalModule",value:function(e){if(e.condition){var t=this._conditionalModules[e.condition.trigger];t||(this._conditionalModules[e.condition.trigger]=t=[]),t.push(e.name)}}}]),e}();t.default=i},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_pathResolver=__webpack_require__(0),_pathResolver2=_interopRequireDefault(_pathResolver);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var DependencyBuilder=function(){function DependencyBuilder(e){_classCallCheck(this,DependencyBuilder),this._configParser=e,this._pathResolver=new _pathResolver2.default,this._result=[],this._queue=[],this._cachedResolutions={}}return _createClass(DependencyBuilder,[{key:"resolveDependencies",value:function(e){var t=e.slice().sort().join(),n=this._cachedResolutions[t];if(!n)try{this._queue=e.slice(0),this._resolveDependencies(),n=this._result.reverse().slice(0),this._cachedResolutions[t]=n}finally{this._cleanup()}return n}},{key:"_cleanup",value:function(){var e=this._configParser.getModules();for(var t in e)if(Object.prototype.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}},{key:"_processConditionalModules",value: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 i=n[t[r]];-1===this._queue.indexOf(i.name)&&this._testConditionalModule(i.condition.test)&&this._queue.push(i.name)}e.conditionalMark=!0}}},{key:"_resolveDependencies",value: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)}}},{key:"_testConditionalModule",value:function _testConditionalModule(testFunction){return"function"==typeof testFunction?testFunction():eval("false || "+testFunction)()}},{key:"_visit",value: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 i=this._configParser.mapModule(r,e.map),o=t[i];o||(o=this._configParser.addModule({name:i,dependencies:[]})),this._visit(o)}}e.mark=!0,e.tmpMark=!1,this._result.unshift(e.name)}}}]),DependencyBuilder}();exports.default=DependencyBuilder},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._events={}}return r(e,[{key:"on",value:function(e,t){(this._events[e]=this._events[e]||[]).push(t)}},{key:"off",value:function(e,t){var n=this._events[e];if(n){var r=n.indexOf(t);r>-1&&n.splice(r,1)}}},{key:"emit",value:function(e,t){var n=this._events[e];if(n){n=n.slice(0);for(var r=0;r<n.length;r++){var i=n[r];i.call(i,t)}}}}]),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=/^https?:\/\/|\/\/|www\./,o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._configParser=t}return r(e,[{key:"build",value:function(e){var t=[],n=[],r=[],o=[],u=[],a=this._configParser.getConfig(),s=a.basePath||"",l=this._configParser.getModules();s.length&&"/"!==s.charAt(s.length-1)&&(s+="/");for(var c=0;c<e.length;c++){var f=l[e[c]];if(f.fullPath)u.push({modules:[f.name],url:this._getURLWithParams(f.fullPath)});else{var d=this._getModulePath(f),h=0===d.indexOf("/");i.test(d)?u.push({modules:[f.name],url:this._getURLWithParams(d)}):!a.combine||f.anonymous?u.push({modules:[f.name],url:this._getURLWithParams(a.url+(h?"":s)+d)}):h?(t.push(d),r.push(f.name)):(n.push(d),o.push(f.name))}f.requested=!0}return n.length&&(u=u.concat(this._generateBufferURLs(o,n,{basePath:s,url:a.url,urlMaxLength:a.urlMaxLength})),n.length=0),t.length&&(u=u.concat(this._generateBufferURLs(r,t,{url:a.url,urlMaxLength:a.urlMaxLength})),t.length=0),u}},{key:"_generateBufferURLs",value:function(e,t,n){var r=void 0,i=n.basePath||"",o=[],u=n.urlMaxLength||2e3,a={modules:[e[0]],url:n.url+i+t[0]};for(r=1;r<t.length;r++){var s=e[r],l=t[r];a.url.length+i.length+l.length+1<u?(a.modules.push(s),a.url+="&"+i+l):(o.push(a),a={modules:[s],url:n.url+i+l})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=e.path||e.name,n=this._configParser.getConfig().paths||{};return Object.keys(n).forEach(function(e){t!==e&&0!==t.indexOf(e+"/")||(t=n[e]+t.substring(e.length))}),"function"==typeof n["*"]&&(t=n["*"](t)),i.test(t)||t.lastIndexOf(".js")===t.length-3||(t+=".js"),t}},{key:"_getURLWithParams",value:function(e){var t=this._configParser.getConfig().defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map(function(e){return e+"="+t[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t){e.exports={name:"liferay-amd-loader",version:"3.1.1",description:"AMD Loader with support for combo URL and conditional loading",scripts:{clean:"rm -rf build",build:"node bin/build-loader.js",ci:"prettier-eslint --list-different && npm run lint && npm run build && npm run build-demo && npm test","build-demo":"node bin/build-demo.js",demo:"node bin/run-demo.js",test:"jest",format:"prettier-eslint --write 'src/**/*.js'",lint:"eslint 'src/**/*.js' && eslint 'bin/**/*.js'",prepublish:"publish-please guard","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test"},repository:{type:"git",url:"https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/fixture/.*"]},author:"Iliyan Peychev",license:"LGPL-3.0",keywords:["Liferay","AMD","ES6","Loader"],bugs:{url:"https://github.com/liferay/liferay-amd-loader/issues"},homepage:"https://github.com/liferay/liferay-amd-loader",files:[".babelrc",".eslintrc",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],dependencies:{"es6-promise":"^4.0.5"},devDependencies:{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1",combohandler:"^0.4.0",eslint:"^4.17.0","eslint-config-liferay":"^2.0.18","fs-extra":"^5.0.0",globby:"^7.1.1","http-server":"^0.11.1",jest:"^22.2.1","liferay-module-config-generator":"^1.3.3","prettier-eslint-cli":"^4.7.0","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^3.10.0","webpack-clear-console":"^1.0.3"}}},function(e,t,n){(function(t,r){var i;i=function(){"use strict";function e(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,u=void 0,a=void 0,s=function(e,t){v[o]=e,v[o+1]=t,2===(o+=2)&&(a?a(g):w())};var l="undefined"!=typeof window?window:void 0,c=l||{},f=c.MutationObserver||c.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(g,1)}}var v=new Array(1e3);function g(){for(var e=0;e<o;e+=2){(0,v[e])(v[e+1]),v[e]=void 0,v[e+1]=void 0}o=0}var m,_,y,b,w=void 0;function M(e,t){var n=arguments,r=this,i=new this.constructor(C);void 0===i[k]&&N(i);var o,u=r._state;return u?(o=n[u-1],s(function(){return F(u,i,o,r._result)})):S(r,i,e,t),i}function P(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(C);return T(t,e),t}d?w=function(){return t.nextTick(g)}:f?(_=0,y=new f(g),b=document.createTextNode(""),y.observe(b,{characterData:!0}),w=function(){b.data=_=++_%2}):h?((m=new MessageChannel).port1.onmessage=g,w=function(){return m.port2.postMessage(0)}):w=void 0===l?function(){try{var e=n(11);return void 0!==(u=e.runOnLoop||e.runOnContext)?function(){u(g)}:p()}catch(e){return p()}}():p();var k=Math.random().toString(36).substring(16);function C(){}var j=void 0,O=1,x=2,A=new I;function R(e){try{return e.then}catch(e){return A.error=e,A}}function L(t,n,r){n.constructor===t.constructor&&r===M&&n.constructor.resolve===P?function(e,t){t._state===O?D(e,t._result):t._state===x?q(e,t._result):S(t,void 0,function(t){return T(e,t)},function(t){return q(e,t)})}(t,n):r===A?(q(t,A.error),A.error=null):void 0===r?D(t,n):e(r)?function(e,t,n){s(function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,function(n){r||(r=!0,t!==n?T(e,n):D(e,n))},function(t){r||(r=!0,q(e,t))},e._label);!r&&i&&(r=!0,q(e,i))},e)}(t,n,r):D(t,n)}function T(e,t){var n;e===t?q(e,new TypeError("You cannot resolve a promise with itself")):"function"==typeof(n=t)||"object"==typeof n&&null!==n?L(e,t,R(t)):D(e,t)}function E(e){e._onerror&&e._onerror(e._result),B(e)}function D(e,t){e._state===j&&(e._result=t,e._state=O,0!==e._subscribers.length&&s(B,e))}function q(e,t){e._state===j&&(e._state=x,e._result=t,s(E,e))}function S(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+O]=n,i[o+x]=r,0===o&&e._state&&s(B,e)}function B(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,i=void 0,o=e._result,u=0;u<t.length;u+=3)r=t[u],i=t[u+n],r?F(n,r,i,o):i(o);e._subscribers.length=0}}function I(){this.error=null}var U=new I;function F(t,n,r,i){var o=e(r),u=void 0,a=void 0,s=void 0,l=void 0;if(o){if((u=function(e,t){try{return e(t)}catch(e){return U.error=e,U}}(r,i))===U?(l=!0,a=u.error,u.error=null):s=!0,n===u)return void q(n,new TypeError("A promises callback cannot return that same promise."))}else u=i,s=!0;n._state!==j||(o&&s?T(n,u):l?q(n,a):t===O?D(n,u):t===x&&q(n,u))}var G=0;function N(e){e[k]=G++,e._state=void 0,e._result=void 0,e._subscribers=[]}function W(e,t){this._instanceConstructor=e,this.promise=new e(C),this.promise[k]||N(this.promise),i(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&D(this.promise,this._result))):q(this.promise,new Error("Array Methods must be provided an Array"))}function V(e){this[k]=G++,this._result=this._state=void 0,this._subscribers=[],C!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof V?function(e,t){try{t(function(t){T(e,t)},function(t){q(e,t)})}catch(t){q(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return W.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===j&&n<e;n++)this._eachEntry(t[n],n)},W.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===P){var i=R(e);if(i===M&&e._state!==j)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===V){var o=new n(C);L(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},W.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===j&&(this._remaining--,e===x?q(r,n):this._result[t]=n),0===this._remaining&&D(r,this._result)},W.prototype._willSettleAt=function(e,t){var n=this;S(e,void 0,function(e){return n._settledAt(O,t,e)},function(e){return n._settledAt(x,t,e)})},V.all=function(e){return new W(this,e).promise},V.race=function(e){var t=this;return i(e)?new t(function(n,r){for(var i=e.length,o=0;o<i;o++)t.resolve(e[o]).then(n,r)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},V.resolve=P,V.reject=function(e){var t=new this(C);return q(t,e),t},V._setScheduler=function(e){a=e},V._setAsap=function(e){s=e},V._asap=s,V.prototype={constructor:V,then:M,catch:function(e){return this.then(null,e)}},V.polyfill=function(){var e=void 0;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=V},V.Promise=V,V},e.exports=i()}).call(t,n(9),n(10))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var s,l=[],c=!1,f=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&h())}function h(){if(!c){var e=a(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f<t;)s&&s[f].run();f=-1,t=l.length}s=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new p(e,t)),1!==l.length||c||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){}]);
//# sourceMappingURL=loader-min.js.map
{
"name": "liferay-amd-loader",
"version": "3.1.0",
"version": "3.1.1",
"description": "AMD Loader with support for combo URL and conditional loading",

@@ -5,0 +5,0 @@ "scripts": {

@@ -80,5 +80,5 @@ import config from './fixture/config.js';

'aui-node',
'aui-dom-node',
'aui-plugin-base',
'aui-dialog',
'aui-dom-node',
'aui-test2',

@@ -266,3 +266,8 @@ ]);

expect(
dependencyBuilder._cachedResolutions[modules.sort().join()]
dependencyBuilder._cachedResolutions[
modules
.slice()
.sort()
.join()
]
).toEqual(expectedDependencies);

@@ -269,0 +274,0 @@ });

@@ -39,3 +39,6 @@ import PathResolver from './path-resolver';

resolveDependencies(modules) {
const modulesSignature = modules.sort().join();
const modulesSignature = modules
.slice()
.sort()
.join();

@@ -42,0 +45,0 @@ let resolution = this._cachedResolutions[modulesSignature];

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 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

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc