From cf60315d911d962e0eb6de45cf48a17a78e7fd39 Mon Sep 17 00:00:00 2001 From: Mario Buikhuizen Date: Thu, 16 Nov 2023 15:14:03 +0100 Subject: [PATCH] fix: embed the es-module-shims script --- js/src/es-module-shims-txt.js | 2 ++ js/src/esmVueTemplate.js | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 js/src/es-module-shims-txt.js diff --git a/js/src/es-module-shims-txt.js b/js/src/es-module-shims-txt.js new file mode 100644 index 0000000..6a9aba6 --- /dev/null +++ b/js/src/es-module-shims-txt.js @@ -0,0 +1,2 @@ +/* v1.8.2 */ +export const esModuleShims = "(function(){const e=typeof window!==\"undefined\";const t=typeof document!==\"undefined\";const noop=()=>{};const r=t?document.querySelector(\"script[type=esms-options]\"):void 0;const s=r?JSON.parse(r.innerHTML):{};Object.assign(s,self.esmsInitOptions||{});let n=!t||!!s.shimMode;const a=globalHook(n&&s.onimport);const i=globalHook(n&&s.resolve);let c=s.fetch?globalHook(s.fetch):fetch;const f=s.meta?globalHook(n&&s.meta):noop;const ne=s.mapOverrides;let oe=s.nonce;if(!oe&&t){const e=document.querySelector(\"script[nonce]\");e&&(oe=e.nonce||e.getAttribute(\"nonce\"))}const ce=globalHook(s.onerror||noop);const le=s.onpolyfill?globalHook(s.onpolyfill):()=>{console.log(\"%c^^ Module TypeError above is polyfilled and can be ignored ^^\",\"font-weight:900;color:#391\")};const{revokeBlobURLs:ue,noLoadEventRetriggers:de,enforceIntegrity:pe}=s;function globalHook(e){return typeof e===\"string\"?self[e]:e}const he=Array.isArray(s.polyfillEnable)?s.polyfillEnable:[];const me=he.includes(\"css-modules\");const be=he.includes(\"json-modules\");const ke=!navigator.userAgentData&&!!navigator.userAgent.match(/Edge\\/\\d+\\.\\d+/);const we=t?document.baseURI:`${location.protocol}//${location.host}${location.pathname.includes(\"/\")?location.pathname.slice(0,location.pathname.lastIndexOf(\"/\")+1):location.pathname}`;const createBlob=(e,t=\"text/javascript\")=>URL.createObjectURL(new Blob([e],{type:t}));let{skip:ge}=s;if(Array.isArray(ge)){const e=ge.map((e=>new URL(e,we).href));ge=t=>e.some((e=>e[e.length-1]===\"/\"&&t.startsWith(e)||t===e))}else if(typeof ge===\"string\"){const e=new RegExp(ge);ge=t=>e.test(t)}else ge instanceof RegExp&&(ge=e=>ge.test(e));const eoop=e=>setTimeout((()=>{throw e}));const throwError=t=>{(self.reportError||e&&window.safari&&console.error||eoop)(t),void ce(t)};function fromParent(e){return e?` imported from ${e}`:\"\"}let ve=false;function setImportMapSrcOrLazy(){ve=true}if(!n)if(document.querySelectorAll(\"script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]\").length)n=true;else{let e=false;for(const t of document.querySelectorAll(\"script[type=module],script[type=importmap]\"))if(e){if(t.type===\"importmap\"&&e){ve=true;break}}else t.type!==\"module\"||t.ep||(e=true)}const ye=/\\\\/g;function asURL(e){try{if(e.indexOf(\":\")!==-1)return new URL(e).href}catch(e){}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||asURL(e)||resolveIfNotPlainOrUrl(\"./\"+e,t)}function resolveIfNotPlainOrUrl(e,t){const r=t.indexOf(\"#\"),s=t.indexOf(\"?\");r+s>-2&&(t=t.slice(0,r===-1?s:s===-1||s>r?r:s));e.indexOf(\"\\\\\")!==-1&&(e=e.replace(ye,\"/\"));if(e[0]===\"/\"&&e[1]===\"/\")return t.slice(0,t.indexOf(\":\")+1)+e;if(e[0]===\".\"&&(e[1]===\"/\"||e[1]===\".\"&&(e[2]===\"/\"||e.length===2&&(e+=\"/\"))||e.length===1&&(e+=\"/\"))||e[0]===\"/\"){const r=t.slice(0,t.indexOf(\":\")+1);if(r===\"blob:\")throw new TypeError(`Failed to resolve module specifier \"${e}\". Invalid relative url or base scheme isn't hierarchical.`);let s;if(t[r.length+1]===\"/\")if(r!==\"file:\"){s=t.slice(r.length+2);s=s.slice(s.indexOf(\"/\")+1)}else s=t.slice(8);else s=t.slice(r.length+(t[r.length]===\"/\"));if(e[0]===\"/\")return t.slice(0,t.length-s.length-1)+e;const n=s.slice(0,s.lastIndexOf(\"/\")+1)+e;const a=[];let i=-1;for(let e=0;e \"${e[a]}\" does not resolve`)}}let $e=!t&&(0,eval)(\"u=>import(u)\");let Se;const Oe=t&&new Promise((e=>{const t=Object.assign(document.createElement(\"script\"),{src:createBlob(\"self._d=u=>import(u)\"),ep:true});t.setAttribute(\"nonce\",oe);t.addEventListener(\"load\",(()=>{if(!(Se=!!($e=self._d))){let e;window.addEventListener(\"error\",(t=>e=t));$e=(t,r)=>new Promise(((s,n)=>{const a=Object.assign(document.createElement(\"script\"),{type:\"module\",src:createBlob(`import*as m from'${t}';self._esmsi=m`)});e=void 0;a.ep=true;oe&&a.setAttribute(\"nonce\",oe);a.addEventListener(\"error\",cb);a.addEventListener(\"load\",cb);function cb(i){document.head.removeChild(a);if(self._esmsi){s(self._esmsi,we);self._esmsi=void 0}else{n(!(i instanceof Event)&&i||e&&e.error||new Error(`Error loading ${r&&r.errUrl||t} (${a.src}).`));e=void 0}}document.head.appendChild(a)}))}document.head.removeChild(t);delete self._d;e()}));document.head.appendChild(t)}));let Le=false;let xe=false;const Ae=t&&HTMLScriptElement.supports;let Ce=Ae&&Ae.name===\"supports\"&&Ae(\"importmap\");let Ue=Se;const Ee=\"import.meta\";const Pe='import\"x\"assert{type:\"css\"}';const Ie='import\"x\"assert{type:\"json\"}';let Me=Promise.resolve(Oe).then((()=>{if(Se)return t?new Promise((e=>{const t=document.createElement(\"iframe\");t.style.display=\"none\";t.setAttribute(\"nonce\",oe);function cb({data:r}){const s=Array.isArray(r)&&r[0]===\"esms\";if(s){Ce=r[1];Ue=r[2];xe=r[3];Le=r[4];e();document.head.removeChild(t);window.removeEventListener(\"message\",cb,false)}}window.addEventListener(\"message\",cb,false);const r=`