@haxtheweb/haxcms-nodejs
Version:
HAXcms single and multisite nodejs server, api, and administration
1 lines • 853 B
JavaScript
import{Router as e,Resolver as t}from"./index.js";let r,n,o,a;t.__ensureUrlAvailableOrPolyfilled=()=>{if(void 0===r){try{const e=new URL("b","http://a");e.pathname="c",r="http://a/c"===e.href}catch(e){r=!1}if(!r&&(n=document.implementation.createHTMLDocument("url"),o=n.createElement("base"),n.head.appendChild(o),a=n.createElement("a"),!a.origin)){Object.defineProperty(a,"origin",{get:()=>{const e=a.protocol,t=a.port;return`${e}//${"http:"===e&&"80"===t||"https:"===e&&"443"===t?a.hostname:a.host}`}});const e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(a),"pathname").get;Object.defineProperty(a,"pathname",{get:()=>{const t=e.apply(a);return"/"!==t.charAt(0)?"/"+t:t}})}}},t.__createUrl=(e,n)=>(t.__ensureUrlAvailableOrPolyfilled(),r?new URL(e,n):(o.href=n,a.href=e.replace(/ /g,"%20"),a.href=a.href,a));export{e as Router,t as Resolver};