UNPKG

@codefast/image-loader

Version:

Simple, functional image loader for Next.js supporting multiple CDN providers

1 lines 1.78 kB
"use strict";const __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var _ in t)__webpack_require__.o(t,_)&&!__webpack_require__.o(e,_)&&Object.defineProperty(e,_,{enumerable:!0,get:t[_]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};function isDomainMatch(e,t){try{let _=new URL(e);return _.hostname===t||_.hostname.endsWith(`.${t}`)}catch{return!1}}function isPathMatch(e,t){try{return new URL(e).pathname.includes(t)}catch{return!1}}function isLocalPath(e){try{if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return!0;let t=new URL(e);return"localhost"===t.hostname||"127.0.0.1"===t.hostname||t.hostname.endsWith(".localhost")||t.hostname.endsWith(".local")}catch{return e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}}for(var __webpack_i__ in __webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{isDomainMatch:()=>isDomainMatch,isLocalPath:()=>isLocalPath,isPathMatch:()=>isPathMatch}),exports.isDomainMatch=__webpack_exports__.isDomainMatch,exports.isLocalPath=__webpack_exports__.isLocalPath,exports.isPathMatch=__webpack_exports__.isPathMatch,__webpack_exports__)-1===["isDomainMatch","isLocalPath","isPathMatch"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});