mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-25 14:57:38 +00:00
2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
!function(e){var t=e.System.constructor.prototype,n=/^[^#?]+\.(css|html|json|wasm)([?#].*)?$/;t.shouldFetch=function(e){return n.test(e)};var s=/^application\/json(;|$)/,r=/^text\/css(;|$)/,i=/^application\/wasm(;|$)/,o=t.fetch;t.fetch=function(t,n){return o(t,n).then((function(n){if(!n.ok)return n;var o=n.headers.get("content-type");return s.test(o)?n.json().then((function(e){return new Response(new Blob(['System.register([],function(e){return{execute:function(){e("default",'+JSON.stringify(e)+")}}})"],{type:"application/javascript"}))})):r.test(o)?n.text().then((function(e){return new Response(new Blob(["System.register([],function(e){return{execute:function(){var s=new CSSStyleSheet();s.replaceSync("+JSON.stringify(e)+');e("default",s)}}})'],{type:"application/javascript"}))})):i.test(o)?(WebAssembly.compileStreaming?WebAssembly.compileStreaming(n):n.arrayBuffer().then(WebAssembly.compile)).then((function(n){e.System.wasmModules||(e.System.wasmModules=Object.create(null)),e.System.wasmModules[t]=n;var s=[],r=[];return WebAssembly.Module.imports&&WebAssembly.Module.imports(n).forEach((function(e){var t=JSON.stringify(e.module);-1===s.indexOf(t)&&(s.push(t),r.push("function(m){i["+t+"]=m}"))})),new Response(new Blob(["System.register(["+s.join(",")+"],function(e){var i={};return{setters:["+r.join(",")+"],execute:function(){return WebAssembly.instantiate(System.wasmModules["+JSON.stringify(t)+"],i).then(function(m){e(m.exports)})}}})"],{type:"application/javascript"}))})):n}))}}("undefined"!=typeof self?self:global);//# sourceMappingURL=module-types.min.js.map
|