@prass/betterimage
Version:
BetterImage is a Next.js-focused library for building optimized image components with advanced features, including fallback animations. It enhances Next.js's built-in Image component, offering seamless optimization and an improved user experience for your
45 lines (43 loc) • 1.61 kB
JavaScript
;
"use client";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/lib/index.ts
var lib_exports = {};
__export(lib_exports, {
getNextOptimizedUrl: () => getNextOptimizedUrl,
pras: () => pras
});
module.exports = __toCommonJS(lib_exports);
// src/lib/utils.ts
var pras = /* @__PURE__ */ __name((...args) => {
return args.filter(Boolean).join(" ");
}, "pras");
var getNextOptimizedUrl = /* @__PURE__ */ __name((url, width, quality = 75) => {
const origin = window.location.origin;
return `${origin}/_next/image?url=${encodeURIComponent(
url
)}&w=${width}&q=${quality}`;
}, "getNextOptimizedUrl");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getNextOptimizedUrl,
pras
});
//# sourceMappingURL=lib.js.map