Comparing version 0.3.2 to 0.3.3
@@ -109,2 +109,3 @@ /*! (C) 2017 by Andrea Giammarchi */ | ||
if (!window.module) { | ||
window.global = window; | ||
window.module = module; | ||
@@ -111,0 +112,0 @@ module._cache = Object.create(null); |
/*! (C) 2017 by Andrea Giammarchi */ | ||
"object"==typeof module?module.constructor.prototype.import=function(e){var t=this;return new Promise(function(n){n(t.require(e))})}:!function e(t,n){var o=/^[a-zA-Z_-]/,i=t._||n.getAttribute("data-main").replace(o,"./$&"),r=function(e){o.test(e)&&(l=e.indexOf("/"),u=e.length,e="https://unpkg.com/"+e.slice(0,l<0?u:l)+"@latest"+(l<0?"":e.slice(l)));for(var t,n=/^(?:[a-z]+:)?\/\//.test(e),r=n?e:i.slice(0,i.lastIndexOf("/")),u=n?0:e.length,l=0,c=0;l<u;c=l+1)if(l=e.indexOf("/",c),l<0)l=u,r+="/"+e.slice(c),/\.js$/i.test(r)||(r+=".js");else if(0===l)r="";else{for(t=c,c=l;c&&"."===e.charAt(c-1);)--c;switch(l-c){case 0:r+="/"+e.slice(t,l);break;case 1:break;case 2:r=r.slice(0,r.lastIndexOf("/"))}}return r},u=function(){var t=this._,n=this.$,o=document.documentElement,i=document.createElement("script");i.setAttribute("nonce",window.module._nonce),i.textContent="module.$(function(){var module="+e+'(arguments[0]),__filename=module.filename,__dirname=__filename.slice(0,__filename.lastIndexOf("/")),require=module.require,exports=module.exports;(function(){"use strict";'+this.responseText+";\n}.call(exports));return module.exports;}(module));",window.module._=t,window.module.$=function(e){n(window.module._cache[t]=e)},setTimeout(function(){o.removeChild(i)},1),o.appendChild(i)},l=function(e){var t,n=new XMLHttpRequest;return n.open("GET",e,!1),n._=e,n.$=function(e){t=e},n.send(null),u.call(n),t},c={},s={filename:i,exports:c,require:function(e){var t=r(e);return window.module._cache[t]||l(t)},import:function(e){var t=r(e);return Promise.resolve(window.module._cache[t]||(window.module._cache[t]=new Promise(function(e,n){var o=new XMLHttpRequest;o.open("GET",t,!0),o._=t,o.$=e,o.onerror=n,o.onload=u,o.send(null)})))}};return window.module||(window.module=s,s._cache=Object.create(null),s._nonce=n.getAttribute("nonce"),s.import("./"+i.split("/").pop())),s}({_:null},document.getElementById("common-js")); | ||
"object"==typeof module?module.constructor.prototype.import=function(e){var n=this;return new Promise(function(t){t(n.require(e))})}:!function e(n,t){var o=/^[a-zA-Z_-]/,i=n._||t.getAttribute("data-main").replace(o,"./$&"),r=function(e){o.test(e)&&(u=e.indexOf("/"),l=e.length,e="https://unpkg.com/"+e.slice(0,u<0?l:u)+"@latest"+(u<0?"":e.slice(u)));for(var n,t=/^(?:[a-z]+:)?\/\//.test(e),r=t?e:i.slice(0,i.lastIndexOf("/")),l=t?0:e.length,u=0,c=0;u<l;c=u+1)if(u=e.indexOf("/",c),u<0)u=l,r+="/"+e.slice(c),/\.js$/i.test(r)||(r+=".js");else if(0===u)r="";else{for(n=c,c=u;c&&"."===e.charAt(c-1);)--c;switch(u-c){case 0:r+="/"+e.slice(n,u);break;case 1:break;case 2:r=r.slice(0,r.lastIndexOf("/"))}}return r},l=function(){var n=this._,t=this.$,o=document.documentElement,i=document.createElement("script");i.setAttribute("nonce",window.module._nonce),i.textContent="module.$(function(){var module="+e+'(arguments[0]),__filename=module.filename,__dirname=__filename.slice(0,__filename.lastIndexOf("/")),require=module.require,exports=module.exports;(function(){"use strict";'+this.responseText+";\n}.call(exports));return module.exports;}(module));",window.module._=n,window.module.$=function(e){t(window.module._cache[n]=e)},setTimeout(function(){o.removeChild(i)},1),o.appendChild(i)},u=function(e){var n,t=new XMLHttpRequest;return t.open("GET",e,!1),t._=e,t.$=function(e){n=e},t.send(null),l.call(t),n},c={},s={filename:i,exports:c,require:function(e){var n=r(e);return window.module._cache[n]||u(n)},import:function(e){var n=r(e);return Promise.resolve(window.module._cache[n]||(window.module._cache[n]=new Promise(function(e,t){var o=new XMLHttpRequest;o.open("GET",n,!0),o._=n,o.$=e,o.onerror=t,o.onload=l,o.send(null)})))}};return window.module||(window.global=window,window.module=s,s._cache=Object.create(null),s._nonce=t.getAttribute("nonce"),s.import("./"+i.split("/").pop())),s}({_:null},document.getElementById("common-js")); |
@@ -1,1 +0,1 @@ | ||
TszSP9e00eZjd0DcWWelEuKmZgAXUE8Ppb7+RRwjJ6Y= | ||
Eop9ZZOXdqXHDKWk8zebBDEZC98wh/cKy+DVef4ISKE= |
@@ -1,1 +0,1 @@ | ||
js2H2QOX4S04sFpiLivyr8cnWjsCC90sRkDP3+OkY0w= | ||
cS9HV5fgB+uA6f9pQWLC7ZIrzWMrwkDCgAhGUTxX4ss= |
{ | ||
"name": "common-js", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "module.exports and module.import for browsers too", | ||
@@ -5,0 +5,0 @@ "main": "common.js", |
@@ -93,3 +93,3 @@ # CommonJS + module.import() [![build status](https://secure.travis-ci.org/WebReflection/common-js.svg)](http://travis-ci.org/WebReflection/common-js) | ||
* **Is there a CDN I can use to test?** | ||
There is always one for npm modules. [https://unpkg.com/common-js@latest](https://unpkg.com/common-js@0.3.2/common.min.js) should be already OK. | ||
There is always one for npm modules. [https://unpkg.com/common-js@latest](https://unpkg.com/common-js@0.3.3/common.min.js) should be already OK. | ||
* **Is this using eval?** | ||
@@ -96,0 +96,0 @@ No. It's using a technique that is even compatible with highest security standards such [Content Security Policy](https://w3c.github.io/webappsec-csp/) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11713
117