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

to
4.0.0-alpha.3

.eslintrc.js

6

bin/build-demo.js

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
const fs = require('fs-extra');

@@ -2,0 +8,0 @@ const globby = require('globby');

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
const globby = require('globby');

@@ -2,0 +8,0 @@ const {run} = require('./util');

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
const comboServer = require('combohandler/lib/server');

@@ -2,0 +8,0 @@

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
const fs = require('fs');

@@ -44,2 +50,3 @@ const http = require('http');

server.listen(8080, 'localhost', () => {
/* eslint-disable no-console */
console.log('Starting up http-server');

@@ -46,0 +53,0 @@ console.log('Available on:');

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
const {spawn, spawnSync} = require('child_process');

@@ -2,0 +8,0 @@ const fs = require('fs-extra');

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
const {spawnSync} = require('child_process');

@@ -2,0 +8,0 @@ const fs = require('fs-extra');

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
__CONFIG__ = {

@@ -2,0 +8,0 @@ url: 'http://localhost:8080',

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define('constants@1.0.0/index', {one: 1, two: 2});

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define('isarray@1.0.0/index', ['module'], function(module) {
module.exports = 'Hello from isarray@1.0.0';
});

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define('isarray@1.1.0/index', ['module'], function(module) {
module.exports = 'Hello from isarray@1.1.0';
});

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define(

@@ -2,0 +8,0 @@ 'isobject@1.0.0/index',

4

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=2)}([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";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=t}return r(e,[{key:"build",value:function(e){var t=this._config,n=[],r=[],i=[],o=t.basePath;o.length&&"/"!==o.charAt(o.length-1)&&(o+="/");var u=!0,a=!1,s=void 0;try{for(var l,c=e[Symbol.iterator]();!(u=(l=c.next()).done);u=!0){var f=l.value,d=t.getModule(f),h=this._getModulePath(d);t.combine?(n.push(h),r.push(d.name)):i.push({modules:[d.name],url:this._getURLWithParams(t.url+o+h)})}}catch(e){a=!0,s=e}finally{try{!u&&c.return&&c.return()}finally{if(a)throw s}}return n.length&&(i=i.concat(this._generateBufferURLs(r,n,{basePath:o,url:t.url,urlMaxLength:t.urlMaxLength})),n.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,i=[],o=n.urlMaxLength,u={modules:[e[0]],url:n.url+r+t[0]},a=1;a<t.length;a++){var s=e[a],l=t[a];u.url.length+r.length+l.length+1<o?(u.modules.push(s),u.url+="&"+r+l):(i.push(u),u={modules:[s],url:n.url+r+l})}return u.url=this._getURLWithParams(u.url),i.push(u),i}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach(function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))}),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.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=i},function(e,t,n){"use strict";var r=o(n(3)),i=o(n(10));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(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=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}}(),o=f(n(4)),u=f(n(7)),a=f(n(8)),s=f(n(0)),l=f(n(1)),c=f(n(9));function f(e){return e&&e.__esModule?e:{default:e}}function d(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 h=function(){function e(){var t=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,e),this._pathResolver=new s.default,this._config=new o.default(t||window.__CONFIG__),this._dependencyResolver=new u.default(this._config),this._urlBuilder=new l.default(this._config),this._scriptLoader=new a.default(n||window.document,this._config)}return i(e,[{key:"version",value:function(){return c.default.version}},{key:"define",value:function(){for(var e=this,t=this._config,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=r[0],u=t.getModule(o);if(u&&u.defined)t.showWarnings&&console.warn("Liferay AMD Loader: Module '"+o+"' is being redefined; only the first definition will be used");else{var a=r[1],s=r[2];if(2==r.length&&(s=a,a=["require","exports","module"]),"function"!=typeof s){var l=s;s=function(){return l}}(u=t.addModule(o)).define.resolve(r),u.factory=s,u.dependencies=a.map(function(t){return e._pathResolver.resolvePath(o,t)})}}},{key:"require",value:function(){for(var e=this,t=this._scriptLoader,n=this._config,i=void 0,o=void 0,u=void 0,a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];if(1==s.length)i=s[0],o=void 0,u=void 0;else if(2==s.length){var c=s[s.length-1];"function"==typeof c?(i=s[0],o=c,u=void 0):null==c?(i=s[0],o=void 0,u=void 0):(i=s,o=void 0,u=void 0)}else{var f=s[s.length-1],h=!1;if("function"!=typeof f&&null!=f||(h=!0),h){var p=s[s.length-2],v=!1;"function"!=typeof p&&null!=p||(v=!0),v?(i=s.slice(0,s.length-2),o=p,u=f):(i=s.slice(0,s.length-1),o=f,u=void 0)}else i=s,o=void 0,u=void 0}if("string"==typeof i)i=[i];else if(1==i.length&&Array.isArray(i[0])){var m;i=(m=[]).concat.apply(m,d(i))}if(void 0===o&&(o=function(){}),void 0===u){var y=new Error("Require caller stack trace");u=function(e){console.log("---------------------------------------"),console.log("Liferay AMD Loader: Unhandled require failure:"),console.log(" · modules:",i),console.log(" · origin:",y),console.log(" · error:",e),["definedDependencies","implementedDependencies","missingDependencies","errors"].forEach(function(t){e[t]&&console.log(" · "+t+":",e[t])}),console.log("---------------------------------------")}}this._dependencyResolver.resolve(i).then(function(a){n.explainResolutions&&console.log("Liferay AMD Loader: Resolved modules",i,"to",a);var s=e._getResolutionError(a);if(s)u(s);else{var l=a.resolvedModules,c=a.moduleMap,f=a.configMap,h=a.pathMap;l.forEach(function(e){return n.addModule(e)});var p=e._getUndefinedModuleNames(l);Object.entries(c).forEach(function(e){var t=r(e,2),i=t[0],o=t[1];n.addModule(i).map=o}),n.addMappings(f),n.addPaths(h);var v=e._setRejectTimeout(i,a,u);t.loadModules(p).then(function(){return e._waitForModuleDefinitions(p)}).then(function(){clearTimeout(v),e._setModuleImplementations(p),o.apply(void 0,d(e._getModuleImplementations(i)))}).catch(function(e){clearTimeout(v),u(e)})}}).catch(u)}},{key:"_getModules",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this._config.getModules(t)}},{key:"_getUndefinedModuleNames",value:function(e){var t=this._config;return e.filter(function(e){var n=t.getModule(e);return!n||!n.defined})}},{key:"_getResolutionError",value:function(e){var t=e.resolvedModules.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});return t.length>0?Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.join("\n")),{resolutionErrors:t}):null}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout(function(){var i=t.resolvedModules,o=i.filter(function(e){var t=r.getModule(e);return!t||!t.implemented}),u=o.filter(function(e){var t=r.getModule(e);return t&&t.fetched}),a=o.filter(function(e){var t=r.getModule(e);return!t||!t.fetched}),s=i.filter(function(e){var t=r.getModule(e);return t&&t.defined}),l=i.filter(function(e){var t=r.getModule(e);return t&&t.implemented}),c=Object.assign(new Error("Load timeout for modules: "+e),{modules:e,resolution:t,missingDependencies:{all:o,fetched:u,unfetched:a},definedDependencies:s,implementedDependencies:l});n(c)},r.waitTimeout)}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.define}))}},{key:"_setModuleImplementations",value:function(e){var t=this,n=this._config,r={};if(n.getModules(e).filter(function(e){return!e.implemented}).forEach(function(e){try{var i={exports:{}},o=e.dependencies.map(function(r){if("exports"===r)return i.exports;if("module"===r)return i;if("require"===r)return t._createLocalRequire(e);var o=n.getDependency(e.name,r);if(!o)throw new Error("Unsatisfied dependency: "+r);return o.implementation}),u=e.factory.apply(e,d(o));e.implementation=void 0!==u?u:i.exports,e.implement.resolve(e.implementation)}catch(t){e.implement.fulfilled||e.implement.reject(t),r[e.name]=t}}),Object.keys(r).length>0)throw Object.assign(new Error("Factory invocation failed for some modules"),{errors:r})}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=this._pathResolver,i=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));var s=r.resolvePath(e.name,i),l=n.getDependency(e.name,s);if(!(l&&"implementation"in l))throw new Error('Module "'+i+'" has not been loaded yet for context: '+e.name);return l.implementation};return i.toUrl=function(e){return t._urlBuilder.build([e])[0].url},i}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map(function(e){return e.implementation})}}]),e}();t.default=h,h.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=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}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(5));var u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3)}return i(e,[{key:"addModule",value:function(e){var t=this._modules[e];return t||(this._modules[e]=t=new o.default(e)),t}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.length>0?t.map(function(t){return e.getModule(t)}):Object.values(this._modules)}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var i=this._mapModule(t,n.map);r=this._modules[i]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=e.hasOwnProperty(t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":r(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{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:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=u},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=function(e){return e&&e.__esModule?e:{default:e}}(n(6));var 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._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation=void 0,this._state={_fetch:i.default.new(),_define:i.default.new(),_implement:i.default.new()}}return r(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){if(this._implementation)throw new Error("Implementation of module "+this.name+" already set");this._implementation=e}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function i(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise(function(t,n){e._resolve=t,e._reject=n});return Object.assign(t,e,{fulfilled:!1,resolved:!1,rejected:!1,resolution:void 0,rejection:void 0}),t.resolve=function(e){return function(e,t){i(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){i(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch(function(){}),t}},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=function(e){return e&&e.__esModule?e:{default:e}}(n(0));var 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._config=t,this._pathResolver=new i.default,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise(function(r,i){var o=t._cachedResolutions[e];if(o)r(o);else{var u="modules="+encodeURIComponent(e),a=n.resolvePath+"?"+u,s={};a.length>n.urlMaxLength&&(a=n.resolvePath,s={method:"POST",body:u}),fetch(a,s).then(function(e){return e.text()}).then(function(n){var i=JSON.parse(n);t._cachedResolutions[e]=i,r(i)}).catch(i)}})}}]),e}();t.default=o},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=function(e){return e&&e.__esModule?e:{default:e}}(n(1));var o=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._urlBuilder=new i.default(n),this._injectedScripts={}}return r(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map(function(e){return t._loadScript(e)});return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config,r=n.getModules(e.modules),i=this._injectedScripts[e.url];return i||((i=this._document.createElement("script")).src=e.url,i.async=!1,i.onload=i.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(i.onload=i.onreadystatechange=null,i.onerror=null,r.forEach(function(e){e.fetch.fulfilled?n.showWarnings&&console.warn("Liferay AMD Loader: Module '"+e.name+"' is being fetched from\n"+i.src+"\nbut was already fetched from\n"+(e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src)):e.fetch.resolve(i)}))},i.onerror=function(){i.onload=i.onreadystatechange=null,i.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{url:e.url,modules:e.modules,script:i});r.forEach(function(e){return e.fetch.reject(t)})},this._injectedScripts[e.url]=i,this._document.head.appendChild(i)),Promise.all(r.map(function(e){return e.fetch}))}}]),e}();t.default=o},function(e,t){e.exports={name:"liferay-amd-loader",version:"4.0.0-alpha.2",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 --runInBand",format:"prettier-eslint --write 'src/**/*.js'",lint:"eslint 'src/**/*.js' && eslint 'bin/**/*.js'","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test"},repository:{type:"git",url:"git+https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],testURL:"http://localhost/"},author:{name:"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","prettier-eslint-cli":"^4.7.0","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^3.10.0"}}},function(e,t,n){(function(t,n){
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.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=2)}([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 o=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("/"),o=r.splice(-1,1),i=0;i<r.length;i++){var u=r[i];if("."!==u)if(".."===u){if(!n.length){n=n.concat(r.slice(i));break}n.splice(-1,1)}else n.push(u)}return n.push(o),n.join("/")}}]),e}();t.default=o},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 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._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],u=n.basePath;return u.length&&"/"!==u.charAt(u.length-1)&&(u+="/"),e.forEach(function(e){var a=n.getModule(e),s=t._getModulePath(a);n.combine?(r.push(s),o.push(a.name)):i.push({modules:[a.name],url:t._getURLWithParams(n.url+u+s)})}),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:u,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,u={modules:[e[0]],url:n.url+r+t[0]},a=1;a<t.length;a++){var s=e[a],l=t[a];u.url.length+r.length+l.length+1<i?(u.modules.push(s),u.url+="&"+r+l):(o.push(u),u={modules:[s],url:n.url+r+l})}return u.url=this._getURLWithParams(u.url),o.push(u),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach(function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))}),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.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,n){"use strict";var r=i(n(3)),o=i(n(10));function i(e){return e&&e.__esModule?e:{default:e}}void 0===window.Promise&&(window.Promise=o.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(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=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=f(n(4)),u=f(n(7)),a=f(n(8)),s=f(n(0)),l=f(n(1)),c=f(n(9));function f(e){return e&&e.__esModule?e:{default:e}}function d(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 h=function(){function e(){var t=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,e),this._pathResolver=new s.default,this._config=new i.default(t||window.__CONFIG__),this._dependencyResolver=new u.default(this._config),this._urlBuilder=new l.default(this._config),this._scriptLoader=new a.default(n||window.document,this._config)}return o(e,[{key:"version",value:function(){return c.default.version}},{key:"define",value:function(){for(var e=this,t=this._config,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=r[0],u=t.getModule(i);if(u&&u.defined)t.showWarnings&&console.warn("Liferay AMD Loader: Module '"+i+"' is being redefined; only the first definition will be used");else{var a=r[1],s=r[2];if(2==r.length&&(s=a,a=["require","exports","module"]),"function"!=typeof s){var l=s;s=function(){return l}}(u=t.addModule(i)).define.resolve(r),u.factory=s,u.dependencies=a.map(function(t){return e._pathResolver.resolvePath(i,t)})}}},{key:"require",value:function(){for(var e=this,t=this._scriptLoader,n=this._config,o=void 0,i=void 0,u=void 0,a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];if(1==s.length)o=s[0],i=void 0,u=void 0;else if(2==s.length){var c=s[s.length-1];"function"==typeof c?(o=s[0],i=c,u=void 0):null==c?(o=s[0],i=void 0,u=void 0):(o=s,i=void 0,u=void 0)}else{var f=s[s.length-1],h=!1;if("function"!=typeof f&&null!=f||(h=!0),h){var p=s[s.length-2],v=!1;"function"!=typeof p&&null!=p||(v=!0),v?(o=s.slice(0,s.length-2),i=p,u=f):(o=s.slice(0,s.length-1),i=f,u=void 0)}else o=s,i=void 0,u=void 0}if("string"==typeof o)o=[o];else if(1==o.length&&Array.isArray(o[0])){var m;o=(m=[]).concat.apply(m,d(o))}if(void 0===i&&(i=function(){}),void 0===u){var y=new Error("Require caller stack trace");u=function(e){n.explainResolutions&&(console.log("---------------------------------------"),console.log("Liferay AMD Loader: Unhandled require failure:"),console.log(" · modules:",o),console.log(" · origin:",y),console.log(" · error:",e),["definedDependencies","implementedDependencies","missingDependencies","errors"].forEach(function(t){e[t]&&console.log(" · "+t+":",e[t])}),console.log("---------------------------------------"))}}this._dependencyResolver.resolve(o).then(function(a){n.explainResolutions&&console.log("Liferay AMD Loader: Resolved modules",o,"to",a);var s=e._getResolutionError(a);if(s)u(s);else{var l=a.resolvedModules,c=a.moduleMap,f=a.configMap,h=a.pathMap;l.forEach(function(e){return n.addModule(e)});var p=e._getUndefinedModuleNames(l);Object.entries(c).forEach(function(e){var t=r(e,2),o=t[0],i=t[1];n.addModule(o).map=i}),n.addMappings(f),n.addPaths(h);var v=e._setRejectTimeout(o,a,u);t.loadModules(p).then(function(){return e._waitForModuleDefinitions(p)}).then(function(){clearTimeout(v),e._setModuleImplementations(p);var t=e._getModuleImplementations(o);try{i.apply(void 0,d(t))}catch(e){console.error(e)}}).catch(function(e){clearTimeout(v),u(e)})}}).catch(u)}},{key:"_getModules",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this._config.getModules(t)}},{key:"_getUndefinedModuleNames",value:function(e){var t=this._config;return e.filter(function(e){var n=t.getModule(e);return!n||!n.defined})}},{key:"_getResolutionError",value:function(e){var t=e.resolvedModules.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});return t.length>0?Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.join("\n")),{resolutionErrors:t}):null}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout(function(){var o=t.resolvedModules,i=o.filter(function(e){var t=r.getModule(e);return!t||!t.implemented}),u=i.filter(function(e){var t=r.getModule(e);return t&&t.fetched}),a=i.filter(function(e){var t=r.getModule(e);return!t||!t.fetched}),s=o.filter(function(e){var t=r.getModule(e);return t&&t.defined}),l=o.filter(function(e){var t=r.getModule(e);return t&&t.implemented}),c=Object.assign(new Error("Load timeout for modules: "+e),{modules:e,resolution:t,missingDependencies:{all:i,fetched:u,unfetched:a},definedDependencies:s,implementedDependencies:l});n(c)},r.waitTimeout)}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.define}))}},{key:"_setModuleImplementations",value:function(e){var t=this,n=this._config,r={};if(n.getModules(e).filter(function(e){return!e.implemented}).forEach(function(e){try{var o={exports:{}},i=e.dependencies.map(function(r){if("exports"===r)return o.exports;if("module"===r)return o;if("require"===r)return t._createLocalRequire(e);var i=n.getDependency(e.name,r);if(!i)throw new Error("Unsatisfied dependency: "+r);return i.implementation}),u=e.factory.apply(e,d(i));e.implementation=void 0!==u?u:o.exports,e.implement.resolve(e.implementation)}catch(t){e.implement.fulfilled||e.implement.reject(t),r[e.name]=t}}),Object.keys(r).length>0)throw Object.assign(new Error("Factory invocation failed for some modules"),{errors:r})}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=this._pathResolver,o=function(o){for(var i=arguments.length,u=Array(i>1?i-1:0),a=1;a<i;a++)u[a-1]=arguments[a];if(u.length>0)return t.require.apply(t,[o].concat(u));var s=r.resolvePath(e.name,o),l=n.getDependency(e.name,s);if(!(l&&"implementation"in l))throw new Error('Module "'+o+'" has not been loaded yet for context: '+e.name);return l.implementation};return o.toUrl=function(e){return t._urlBuilder.build([e])[0].url},o}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map(function(e){return e.implementation})}}]),e}();t.default=h,h.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=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=function(e){return e&&e.__esModule?e:{default:e}}(n(5));var u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3)}return o(e,[{key:"addModule",value:function(e){var t=this._modules[e];return t||(this._modules[e]=t=new i.default(e)),t}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.length>0?t.map(function(t){return e.getModule(t)}):Object.values(this._modules)}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=e.hasOwnProperty(t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":r(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{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:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=u},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}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(6));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._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation=void 0,this._state={_fetch:o.default.new(),_define:o.default.new(),_implement:o.default.new()}}return r(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){if(this._implementation)throw new Error("Implementation of module "+this.name+" already set");this._implementation=e}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise(function(t,n){e._resolve=t,e._reject=n});return Object.assign(t,e,{fulfilled:!1,resolved:!1,rejected:!1,resolution:void 0,rejection:void 0}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch(function(){}),t}},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}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(0));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=t,this._pathResolver=new o.default,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise(function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var u="modules="+encodeURIComponent(e),a=n.resolvePath+"?"+u,s={};a.length>n.urlMaxLength&&(a=n.resolvePath,s={method:"POST",body:u}),fetch(a,s).then(function(e){return e.text()}).then(function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)}).catch(o)}})}}]),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}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(1));var i=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._urlBuilder=new o.default(n),this._injectedScripts={}}return r(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map(function(e){return t._loadScript(e)});return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config,r=n.getModules(e.modules),o=this._injectedScripts[e.url];return o||((o=this._document.createElement("script")).src=e.url,o.async=!1,o.onload=o.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(o.onload=o.onreadystatechange=null,o.onerror=null,r.forEach(function(e){e.fetch.fulfilled?n.showWarnings&&console.warn("Liferay AMD Loader: Module '"+e.name+"' is being fetched from\n"+o.src+"\nbut was already fetched from\n"+(e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src)):e.fetch.resolve(o)}))},o.onerror=function(){o.onload=o.onreadystatechange=null,o.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{url:e.url,modules:e.modules,script:o});r.forEach(function(e){return e.fetch.reject(t)})},this._injectedScripts[e.url]=o,this._document.head.appendChild(o)),Promise.all(r.map(function(e){return e.fetch}))}}]),e}();t.default=i},function(e,t){e.exports={name:"liferay-amd-loader",version:"4.0.0-alpha.3",description:"AMD Loader with support for combo URL and conditional loading",scripts:{clean:"rm -rf build",build:"node bin/build-loader.js",ci:"npm run format:check && 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 --runInBand",format:"prettier --write '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","format:check":"prettier --list-different '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",lint:"eslint '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","lint:fix":"eslint --fix '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test"},repository:{type:"git",url:"git+https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],testPathIgnorePatterns:[".eslintrc.js"],testURL:"http://localhost/"},author:{name:"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.js",".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:"^5.15.1","eslint-config-liferay":"^3.0.0","fs-extra":"^5.0.0",globby:"^7.1.1","http-server":"^0.11.1",jest:"^22.2.1",prettier:"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^3.10.0"}}},function(e,t,n){(function(t,n){
/*!

@@ -9,3 +9,3 @@ * @overview es6-promise - a tiny implementation of Promises/A+.

*/
!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,o=void 0,u=void 0,a=function(e,t){p[i]=e,p[i+1]=t,2===(i+=2)&&(u?u(v):m())};var s="undefined"!=typeof window?window:void 0,l=s||{},c=l.MutationObserver||l.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(v,1)}}var p=new Array(1e3);function v(){for(var e=0;e<i;e+=2){(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0}i=0}var m=void 0;function y(e,t){var n=this,r=new this.constructor(b);void 0===r[g]&&C(r);var i=n._state;if(i){var o=arguments[i-1];a(function(){return S(i,r,o,n._result)})}else A(n,r,e,t);return r}function _(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(b);return E(t,e),t}m=f?function(){return t.nextTick(v)}:c?function(){var e=0,t=new c(v),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}():d?function(){var e=new MessageChannel;return e.port1.onmessage=v,function(){return e.port2.postMessage(0)}}():void 0===s?function(){try{var e=Function("return this")().require("vertx");return void 0!==(o=e.runOnLoop||e.runOnContext)?function(){o(v)}:h()}catch(e){return h()}}():h();var g=Math.random().toString(36).substring(2);function b(){}var w=void 0,M=1,j=2,k={error:null};function P(e){try{return e.then}catch(e){return k.error=e,k}}function O(t,n,r){n.constructor===t.constructor&&r===y&&n.constructor.resolve===_?function(e,t){t._state===M?L(e,t._result):t._state===j?T(e,t._result):A(t,void 0,function(t){return E(e,t)},function(t){return T(e,t)})}(t,n):r===k?(T(t,k.error),k.error=null):void 0===r?L(t,n):e(r)?function(e,t,n){a(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?E(e,n):L(e,n))},function(t){r||(r=!0,T(e,t))},e._label);!r&&i&&(r=!0,T(e,i))},e)}(t,n,r):L(t,n)}function E(e,t){e===t?T(e,new TypeError("You cannot resolve a promise with itself")):!function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}(t)?L(e,t):O(e,t,P(t))}function x(e){e._onerror&&e._onerror(e._result),R(e)}function L(e,t){e._state===w&&(e._result=t,e._state=M,0!==e._subscribers.length&&a(R,e))}function T(e,t){e._state===w&&(e._state=j,e._result=t,a(x,e))}function A(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+M]=n,i[o+j]=r,0===o&&e._state&&a(R,e)}function R(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?S(n,r,i,o):i(o);e._subscribers.length=0}}function S(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 k.error=e,k}}(r,i))===k?(l=!0,a=u.error,u.error=null):s=!0,n===u)return void T(n,new TypeError("A promises callback cannot return that same promise."))}else u=i,s=!0;n._state!==w||(o&&s?E(n,u):l?T(n,a):t===M?L(n,u):t===j&&T(n,u))}var D=0;function C(e){e[g]=D++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[g]||C(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?L(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&L(this.promise,this._result))):T(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===w&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===_){var i=P(e);if(i===y&&e._state!==w)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===I){var o=new n(b);O(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===w&&(this._remaining--,e===j?T(r,n):this._result[t]=n),0===this._remaining&&L(r,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;A(e,void 0,function(e){return n._settledAt(M,t,e)},function(e){return n._settledAt(j,t,e)})},e}();var I=function(){function t(e){this[g]=D++,this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t(function(t){E(e,t)},function(t){T(e,t)})}catch(t){T(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 t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var n=this.constructor;return e(t)?this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})}):this.then(t,t)},t}();return I.prototype.then=y,I.all=function(e){return new U(this,e).promise},I.race=function(e){var t=this;return r(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."))})},I.resolve=_,I.reject=function(e){var t=new this(b);return T(t,e),t},I._setScheduler=function(e){u=e},I._setAsap=function(e){a=e},I._asap=a,I.polyfill=function(){var e=void 0;if(void 0!==n)e=n;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 r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=I},I.Promise=I,I})}).call(t,n(11),n(12))},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(t,n){e.exports=n()}(0,function(){"use strict";function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,i=void 0,u=void 0,a=function(e,t){p[o]=e,p[o+1]=t,2===(o+=2)&&(u?u(v):m())};var s="undefined"!=typeof window?window:void 0,l=s||{},c=l.MutationObserver||l.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(v,1)}}var p=new Array(1e3);function v(){for(var e=0;e<o;e+=2){(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0}o=0}var m=void 0;function y(e,t){var n=this,r=new this.constructor(b);void 0===r[g]&&C(r);var o=n._state;if(o){var i=arguments[o-1];a(function(){return S(o,r,i,n._result)})}else A(n,r,e,t);return r}function _(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(b);return E(t,e),t}m=f?function(){return t.nextTick(v)}:c?function(){var e=0,t=new c(v),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}():d?function(){var e=new MessageChannel;return e.port1.onmessage=v,function(){return e.port2.postMessage(0)}}():void 0===s?function(){try{var e=Function("return this")().require("vertx");return void 0!==(i=e.runOnLoop||e.runOnContext)?function(){i(v)}:h()}catch(e){return h()}}():h();var g=Math.random().toString(36).substring(2);function b(){}var w=void 0,M=1,j=2,k={error:null};function P(e){try{return e.then}catch(e){return k.error=e,k}}function O(t,n,r){n.constructor===t.constructor&&r===y&&n.constructor.resolve===_?function(e,t){t._state===M?L(e,t._result):t._state===j?T(e,t._result):A(t,void 0,function(t){return E(e,t)},function(t){return T(e,t)})}(t,n):r===k?(T(t,k.error),k.error=null):void 0===r?L(t,n):e(r)?function(e,t,n){a(function(e){var r=!1,o=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,function(n){r||(r=!0,t!==n?E(e,n):L(e,n))},function(t){r||(r=!0,T(e,t))},e._label);!r&&o&&(r=!0,T(e,o))},e)}(t,n,r):L(t,n)}function E(e,t){e===t?T(e,new TypeError("You cannot resolve a promise with itself")):!function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}(t)?L(e,t):O(e,t,P(t))}function x(e){e._onerror&&e._onerror(e._result),R(e)}function L(e,t){e._state===w&&(e._result=t,e._state=M,0!==e._subscribers.length&&a(R,e))}function T(e,t){e._state===w&&(e._state=j,e._result=t,a(x,e))}function A(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+M]=n,o[i+j]=r,0===i&&e._state&&a(R,e)}function R(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,o=void 0,i=e._result,u=0;u<t.length;u+=3)r=t[u],o=t[u+n],r?S(n,r,o,i):o(i);e._subscribers.length=0}}function S(t,n,r,o){var i=e(r),u=void 0,a=void 0,s=void 0,l=void 0;if(i){if((u=function(e,t){try{return e(t)}catch(e){return k.error=e,k}}(r,o))===k?(l=!0,a=u.error,u.error=null):s=!0,n===u)return void T(n,new TypeError("A promises callback cannot return that same promise."))}else u=o,s=!0;n._state!==w||(i&&s?E(n,u):l?T(n,a):t===M?L(n,u):t===j&&T(n,u))}var D=0;function C(e){e[g]=D++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[g]||C(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?L(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&L(this.promise,this._result))):T(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===w&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===_){var o=P(e);if(o===y&&e._state!==w)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===I){var i=new n(b);O(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===w&&(this._remaining--,e===j?T(r,n):this._result[t]=n),0===this._remaining&&L(r,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;A(e,void 0,function(e){return n._settledAt(M,t,e)},function(e){return n._settledAt(j,t,e)})},e}();var I=function(){function t(e){this[g]=D++,this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t(function(t){E(e,t)},function(t){T(e,t)})}catch(t){T(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 t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var n=this.constructor;return e(t)?this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})}):this.then(t,t)},t}();return I.prototype.then=y,I.all=function(e){return new U(this,e).promise},I.race=function(e){var t=this;return r(e)?new t(function(n,r){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,r)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},I.resolve=_,I.reject=function(e){var t=new this(b);return T(t,e),t},I._setScheduler=function(e){u=e},I._setAsap=function(e){a=e},I._asap=a,I.polyfill=function(){var e=void 0;if(void 0!==n)e=n;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 r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=I},I.Promise=I,I})}).call(t,n(11),n(12))},function(e,t){var n,r,o=e.exports={};function i(){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===i||!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:i}catch(e){n=i}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(){}o.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)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.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}]);
//# sourceMappingURL=loader-min.js.map
{
"name": "liferay-amd-loader",
"version": "4.0.0-alpha.2",
"version": "4.0.0-alpha.3",
"description": "AMD Loader with support for combo URL and conditional loading",

@@ -8,8 +8,10 @@ "scripts": {

"build": "node bin/build-loader.js",
"ci": "prettier-eslint --list-different && npm run lint && npm run build && npm run build-demo && npm test",
"ci": "npm run format:check && 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 --runInBand",
"format": "prettier-eslint --write 'src/**/*.js'",
"lint": "eslint 'src/**/*.js' && eslint 'bin/**/*.js'",
"format": "prettier --write '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"format:check": "prettier --list-different '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"lint": "eslint '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"lint:fix": "eslint --fix '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"publish-please": "publish-please",

@@ -29,2 +31,5 @@ "prepublishOnly": "npm run build && npm run build-demo && npm test"

],
"testPathIgnorePatterns": [
".eslintrc.js"
],
"testURL": "http://localhost/"

@@ -48,3 +53,3 @@ },

".babelrc",
".eslintrc",
".eslintrc.js",
".publishrc",

@@ -67,4 +72,4 @@ "LICENSE.md",

"combohandler": "^0.4.0",
"eslint": "^4.17.0",
"eslint-config-liferay": "^2.0.18",
"eslint": "^5.15.1",
"eslint-config-liferay": "^3.0.0",
"fs-extra": "^5.0.0",

@@ -74,3 +79,3 @@ "globby": "^7.1.1",

"jest": "^22.2.1",
"prettier-eslint-cli": "^4.7.0",
"prettier": "^1.16.4",
"publish-please": "^2.3.1",

@@ -77,0 +82,0 @@ "uglifyjs-webpack-plugin": "^1.2.0",

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
__CONFIG__ = {

@@ -2,0 +8,0 @@ url: 'http://localhost:8080',

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define('constants@1.0.0/index', {one: 1, two: 2});

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define('isarray@1.0.0/index', ['module'], function(module) {
module.exports = 'Hello from isarray@1.0.0';
});

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define('isarray@1.1.0/index', ['module'], function(module) {
module.exports = 'Hello from isarray@1.1.0';
});

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Liferay.Loader.define(

@@ -2,0 +8,0 @@ 'isobject@1.0.0/index',

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('export-false', ['module'], module => {
module.exports = false;
});

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('export-null', ['module'], module => {
module.exports = null;
});

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('export-undefined', ['module'], module => {
module.exports = undefined;
});

@@ -0,3 +1,9 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('issue-140/a', ['module'], function(module) {
module.exports = 'a';
});

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('issue-140/m1', ['module', 'require', 'issue-140/a'], function(

@@ -6,3 +12,3 @@ module,

module.exports = function() {
let result = {};
const result = {};

@@ -9,0 +15,0 @@ try {

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('issue-140/m2/m2', ['module', 'issue-140/m1'], function(

@@ -2,0 +8,0 @@ module,

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('local-require/a', ['module'], module => {

@@ -2,0 +8,0 @@ module.exports = {

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define(

@@ -2,0 +8,0 @@ 'local-require/failure',

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define(

@@ -2,0 +8,0 @@ 'local-require/rel-path',

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define(

@@ -2,0 +8,0 @@ 'local-require/sync',

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define(

@@ -2,0 +8,0 @@ 'local-require/to-url',

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('say-goodbye', ['module'], module => {

@@ -2,0 +8,0 @@ module.exports = function() {

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
Loader.define('say-hello', ['module'], module => {

@@ -2,0 +8,0 @@ module.exports = function() {

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Config from '../config';

@@ -91,3 +97,3 @@

config.addMappings({
'liferay': 'liferay@1.0.0',
liferay: 'liferay@1.0.0',
'*': name => name + 'test',

@@ -108,3 +114,3 @@ });

config.addMappings({
'liferay': 'liferay@2.0.0',
liferay: 'liferay@2.0.0',
'liferay/index': {

@@ -137,3 +143,3 @@ value: 'liferay@1.0.0/index',

config.addMappings({
'liferay': 'this-should-not-be-applied',
liferay: 'this-should-not-be-applied',
'liferay/index': {value: 'liferay/index', exactMatch: true},

@@ -140,0 +146,0 @@ });

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Config from '../config';

@@ -2,0 +8,0 @@ import DependencyResolver from '../dependency-resolver';

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import fs from 'fs';

@@ -2,0 +8,0 @@ import path from 'path';

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Module from '../module';

@@ -15,3 +21,5 @@

it('name should be read only', () => {
expect(() => (module.name = 'x')).toThrow();
expect(() => {
module.name = 'x';
}).toThrow();
});

@@ -28,3 +36,5 @@

expect(() => (module.dependencies = dependencies)).toThrow();
expect(() => {
module.dependencies = dependencies;
}).toThrow();

@@ -43,3 +53,5 @@ expect(module.dependencies).toBe(dependencies);

expect(() => (module.factory = factory)).toThrow();
expect(() => {
module.factory = factory;
}).toThrow();

@@ -58,3 +70,5 @@ expect(module.factory).toBe(factory);

expect(() => (module.implementation = implementation)).toThrow();
expect(() => {
module.implementation = implementation;
}).toThrow();

@@ -61,0 +75,0 @@ expect(module.implementation).toBe(implementation);

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import PathResolver from '../path-resolver';

@@ -49,3 +55,3 @@

it('should ignore "require" path', () => {
let result = pathResolver.resolvePath('a/b/c/c1', 'require');
const result = pathResolver.resolvePath('a/b/c/c1', 'require');

@@ -56,3 +62,3 @@ expect(result).toBe('require');

it('should ignore "exports" path', () => {
let result = pathResolver.resolvePath('a/b/c/c1', 'exports');
const result = pathResolver.resolvePath('a/b/c/c1', 'exports');

@@ -63,3 +69,3 @@ expect(result).toBe('exports');

it('should ignore "module" path', () => {
let result = pathResolver.resolvePath('a/b/c/c1', 'module');
const result = pathResolver.resolvePath('a/b/c/c1', 'module');

@@ -66,0 +72,0 @@ expect(result).toBe('module');

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import ResolvablePromise from '../resolvable-promise';

@@ -29,7 +35,11 @@

resolvablePromise.then(() => (preCalled = 'pre'));
resolvablePromise.then(() => {
preCalled = 'pre';
});
resolvablePromise.resolve();
resolvablePromise.then(() => (postCalled = 'post'));
resolvablePromise.then(() => {
postCalled = 'post';
});

@@ -47,7 +57,11 @@ setTimeout(() => {

resolvablePromise.catch(() => (preCalled = 'pre'));
resolvablePromise.catch(() => {
preCalled = 'pre';
});
resolvablePromise.reject();
resolvablePromise.catch(() => (postCalled = 'post'));
resolvablePromise.catch(() => {
postCalled = 'post';
});

@@ -54,0 +68,0 @@ setTimeout(() => {

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Config from '../config';

@@ -2,0 +8,0 @@ import ScriptLoader from '../script-loader';

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Config from '../config';

@@ -2,0 +8,0 @@ import URLBuilder from '../url-builder';

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Loader from './loader.js';

@@ -2,0 +8,0 @@ import Promise from 'es6-promise';

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Module from './module';

@@ -270,3 +276,3 @@

_mapExactMatch(module, maps) {
for (let alias in maps) {
for (const alias in maps) {
if (Object.prototype.hasOwnProperty.call(maps, alias)) {

@@ -293,3 +299,3 @@ const aliasValue = maps[alias];

_mapPartialMatch(module, maps) {
for (let alias in maps) {
for (const alias in maps) {
if (Object.prototype.hasOwnProperty.call(maps, alias)) {

@@ -296,0 +302,0 @@ let aliasValue = maps[alias];

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import PathResolver from './path-resolver';

@@ -2,0 +8,0 @@

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import Config from './config';

@@ -8,2 +14,4 @@ import DependencyResolver from './dependency-resolver';

/* eslint-disable no-console */
/**

@@ -187,2 +195,6 @@ *

failure = error => {
if (!config.explainResolutions) {
return;
}
console.log('---------------------------------------');

@@ -277,3 +289,11 @@ console.log('Liferay AMD Loader: Unhandled require failure:');

success(...this._getModuleImplementations(moduleNames));
const implementations = this._getModuleImplementations(
moduleNames
);
try {
success(...implementations);
} catch (err) {
console.error(err);
}
})

@@ -504,3 +524,3 @@ .catch(err => {

} else {
let resolvedPath = pathResolver.resolvePath(
const resolvedPath = pathResolver.resolvePath(
module.name,

@@ -510,3 +530,3 @@ moduleName

let dependencyModule = config.getDependency(
const dependencyModule = config.getDependency(
module.name,

@@ -513,0 +533,0 @@ resolvedPath

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import ResolvablePromise from './resolvable-promise';

@@ -2,0 +8,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* A class to resolve paths inside modules.

@@ -36,3 +42,3 @@ */

for (let i = 0; i < dependencyParts.length; i++) {
let dependencyPart = dependencyParts[i];
const dependencyPart = dependencyParts[i];

@@ -39,0 +45,0 @@ if (dependencyPart === '.') {

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
* A Promise with resolve() and reject() methods so that it can be fulfilled

@@ -15,3 +21,3 @@ * asynchronously from outside instead of the callback.

throw new Error(
'Don\'t construct ResolvablePromise objects directly: ' +
"Don't construct ResolvablePromise objects directly: " +
'rely on ResolvablePromise.new() instead'

@@ -18,0 +24,0 @@ );

@@ -0,3 +1,11 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import URLBuilder from './url-builder';
/* eslint-disable no-console */
/**

@@ -4,0 +12,0 @@ * A class responsible for loading the script resources that contain modules

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/**
*
*/
export default class URLBuilder {

@@ -33,3 +39,3 @@ /**

for (let moduleName of moduleNames) {
moduleNames.forEach(moduleName => {
const module = config.getModule(moduleName);

@@ -47,3 +53,3 @@ const path = this._getModulePath(module);

}
}
});

@@ -54,3 +60,3 @@ // Add to the result all modules, which have to be combined.

this._generateBufferURLs(modulesURL, bufferURL, {
basePath: basePath,
basePath,
url: config.url,

@@ -76,5 +82,5 @@ urlMaxLength: config.urlMaxLength,

_generateBufferURLs(modules, urls, config) {
let basePath = config.basePath;
let result = [];
let urlMaxLength = config.urlMaxLength;
const basePath = config.basePath;
const result = [];
const urlMaxLength = config.urlMaxLength;

@@ -81,0 +87,0 @@ let urlResult = {

@@ -0,1 +1,7 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/* eslint-env node */

@@ -2,0 +8,0 @@

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