UNPKG

5.07 kBJavaScriptView Raw
1/* nucleo-amd v0.4.3 */!function(a){var b=function(){var a={},b={},c={},d={requireDeps:function(a,b,c){return f(a,b,c)},catchErrors:function(a,b,d){c.throwError("Could not find module "+b+" required by: "+d)}};c.isArray=function(a){return Object.prototype.toString.call(a).indexOf("Array")>-1},c.isPlainObject=function(a){return a&&(a.constructor===Object||void 0===a.constructor)},c.unreferencePlainObjectsAndArrays=function(a){if(c.isArray(a)){for(var b=a.length,d=[],e=0;e<b;e++)d.push(c.unreferencePlainObjectsAndArrays(a[e]));return d}if(c.isPlainObject(a)){var f,g,h={},i={};for(f in a)g=a[f],f in i&&(i[f]===g||f in h&&h[f]===g)||(i[f]=c.unreferencePlainObjectsAndArrays(g));return a.__esModule&&(i.__esModule=a.__esModule),i}return a},c.internalRequire=function(d){if(b[d])return b[d];a[d]||c.throwError("Could not find module: "+d);var e={},f=c.getDependenciesValues(e,d);return a[d].callback.apply(this,f),b[d]=e,e},c.getDependenciesValues=function(b,c){for(var e,f=a[c].deps,g=[],h=f.length,i=0;i<h;i++)if("exports"===f[i])g.push(b);else try{e=d.requireDeps(f[i],null,c),g.push(e)}catch(a){d.catchErrors(a,f[i],c)}return g},c.throwError=function(a){throw new Error(a)};var e=function(b,d,e){var f={};e?(f.deps=d,f.callback=e):(f.deps=[],f.callback=d),a[b]&&c.throwError("duplicatedModule "+b),a[b]=f},f=function(a,b){var d=c.internalRequire(a),e=b?d[b]:d,f=c.unreferencePlainObjectsAndArrays(e);return f},g=function(b){var c,d,e=[],f=b&&b.regex?b.regex:"";for(c in a)d=f&&c.match(f)||!f,d&&e.push(c);return e},h=function(a){d=a};return{define:e,require:f,list_entries:g,setCustomRequireDeps:h}},c=function(){this.errors=[],this.delimiter="{{DELIMITER}}",this.stackDelimiter="{{>>>}}",this.template=["{{title}}","PLUGINS:","{{plugins}}","STACKTRACE:","{{stacktrace}}"].join("\n")};c.prototype.hasErrors=function(){return!!this.errors.length},c.prototype.add=function(a){this.errors.push(a)},c.prototype.stringify=function(){var a=this.summary(),b=this.template,c=function(a){return Object.prototype.toString.call(a).indexOf("Array")>-1};for(var d in a)b=b.replace("{{"+d+"}}",c(a[d])?a[d].join("\n"):a[d]);return b},c.prototype.submodulesStringify=function(){for(var a,b="",c=0;c<this.errors.length;c++)this.errors[c].content.indexOf(this.delimiter)>-1&&(a=!0,b=this.errors[c].content);var d=this.errors[0].name,e=a?d+this.stackDelimiter+b:this.delimiter+JSON.stringify(this.errors);return e},c.prototype.summary=function(){if(!this.errors.length){var a="No errors available";return{title:a,plugins:a,stacktrace:a}}var b=this.getRelevantErrors(),c={title:this.formatTitle(b),plugins:this.formatPlugins(b),stacktrace:this.parseStacktrace(b)};return c},c.prototype.getRelevantErrors=function(){for(var a,b=0;b<this.errors.length;b++)if(this.errors[b].content.indexOf(this.delimiter)>-1){a=JSON.parse(this.errors[b].content.split(this.delimiter)[1]);break}return a||(a=this.errors),a},c.prototype.formatTitle=function(a){var b=a[a.length-1],c=b.referrer?" required by "+b.referrer:"",d="Error at the module: "+b.name+c;return d},c.prototype.formatPlugins=function(a){for(var b=[],c=0;c<a.length;c++)b.push("("+a[c].plugin+") "+a[c].content);return b},c.prototype.parseStacktrace=function(a){for(var b=this.errors[0].name,c=this.getMiddleStacktrace(),d=a[a.length-1].name,e=[],f=0;f<c.length;f++)c[f]&&e.push(c[f]);return b&&b!==e[0]&&e.splice(0,0,b),d&&d!==e[e.length-1]&&e.push(d),e.reverse()},c.prototype.getMiddleStacktrace=function(){for(var a="",b=0;b<this.errors.length;b++)if(this.errors[b].content.indexOf(this.delimiter)>-1){a=this.errors[b].content.split(this.delimiter)[0];break}var c=a.length?a.split(this.stackDelimiter):[];return c};var d=function(){var a=new b,d=["default"],f={},g=function(b,c,d){a.define(b,c,d)},h=function(b,g,h){for(var i,j,k=new c,l=0;l<d.length;l++){try{if(!e[d[l]])throw new Error("Missing plugin definition for: "+d[l]);i=e[d[l]].call(this,a.require,f[d[l]],b,g,h),j=!0}catch(a){k.add({name:b,plugin:d[l],submodule:g,referrer:h,content:a.message,stack:a.stack});continue}break}if(!j)throw new Error(h?k.submodulesStringify():k.stringify());return i},i=function(a){throw new Error(a.message)};return a.setCustomRequireDeps({requireDeps:h,catchErrors:i}),{define:g,require:h,list_entries:a.list_entries,plugins:function(a){for(var b in a)f[b]=a[b]},pipeline:function(a){return a&&(d=a),d},version:"0.4.3"}},e={};e.default=function(a,b,c,d,e){return a(c,d,e)},e.shortcuts=function(a,b,c,d){var e=0===c.indexOf("@");if(!e)throw new Error(c+" is not a shortcut");var f=c.substring(1).split("/"),g={name:f[0],value:f.slice(1).join("/")},h=a(b[g.name]+g.value,d);return h},e.defaultFile=function(a,b,c,d){var e=c.lastIndexOf("/")===c.length-1,f=c+(e?"":"/")+b;return a(f,d)},e.relativePaths=function(a,b,c,d,e){if("."!==c.charAt(0))throw new Error(c+" is not a relative path");if(!b)throw new Error("Relative paths are not allowed: "+c);for(var f=c.split("/"),g=e.split("/").slice(0,-1),h=0;h<f.length;h++){var i=f[h];if(".."===i)g.pop();else{if("."===i)continue;g.push(i)}}var j=g.join("/");return a(j,d,e)},a.nucleoAMD=d}(this);
\No newline at end of file