@opensea/seadn
Advanced tools
Comparing version 2.3.4 to 2.3.5
@@ -1,2 +0,2 @@ | ||
"use strict";var f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var g=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},w=(n,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of U(e))!L.call(n,t)&&t!==r&&f(n,t,{get:()=>e[t],enumerable:!(i=R(e,t))||i.enumerable});return n};var M=n=>w(f({},"__esModule",{value:!0}),n);var v={};g(v,{optimize:()=>m,originalURL:()=>x});module.exports=M(v);var u=[80,250,500,750,1e3,2e3,4e3];function F(n,e){let r=u.find(t=>t>=n),i=u.find(t=>t>=e);if(i===r){let t=u.indexOf(i);i=u[t+1]}return i||u[u.length-1]}function a(n,e){if(e===void 0||e<=1)return n;let r=Number(n)*e;return F(Number(n),r)}function m(n,{width:e,height:r,format:i,quality:t,fit:p,frameTime:s,boost:b}){try{typeof n=="string"&&(n=new URL(n))}catch(B){return n.toString()}if(!(n instanceof URL))return n;let l=N(n);if(!y(n)&&!l)return n.toString();if(c(n)&&s===void 0)return n.hostname=h(n),n.toString();let o=new URLSearchParams;if(s!==void 0)l&&o.set("frame-time",String(s));else if(c(n))return n.toString();if(r!==void 0&&o.set("h",String(a(r,b))),e!==void 0&&o.set("w",String(a(e,b))),i!==void 0&&o.set("format",i),t){if(Number(t)<=0||Number(t)>100)throw new Error("Quality has to be a positive number between 1 and 100");o.set("q",String(t))}return p!==void 0&&o.set("fit",p),n.search=o.toString(),n.toString()}function c(n){let e=d(n);return e==="mp4"||e==="mov"}function N(n){return c(n)||d(n)==="gif"}function y(n){if(!S(n))return!1;switch(d(n)){case"jpg":case"png":case"jpeg":case"webp":case"avif":case"ico":case"gif":case void 0:return!0;default:return!1}}function d(n){let e=n.pathname.split(".");if(!(e.length<=1))return e[e.length-1]}function S(n){return n.hostname.endsWith("seadn.io")}function x(n){try{typeof n=="string"&&(n=new URL(n))}catch(e){return n.toString()}return S(n)&&(n.hostname=h(n)),n.toString()}function h(n){return n.hostname.replace("i2c","raw2").replace("i2","raw2")}0&&(module.exports={optimize,originalURL}); | ||
"use strict";var f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var g=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},w=(n,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of U(e))!L.call(n,t)&&t!==r&&f(n,t,{get:()=>e[t],enumerable:!(i=R(e,t))||i.enumerable});return n};var M=n=>w(f({},"__esModule",{value:!0}),n);var v={};g(v,{optimize:()=>l,originalURL:()=>x});module.exports=M(v);var u=[80,250,500,750,1e3,2e3,4e3];function F(n,e){let r=u.find(t=>t>=n),i=u.find(t=>t>=e);if(i===r){let t=u.indexOf(i);i=u[t+1]}return i||u[u.length-1]}function a(n,e){if(e===void 0||e<=1)return n;let r=Number(n)*e;return F(Number(n),r)}function l(n,{width:e,height:r,format:i,quality:t,fit:p,frameTime:s,boost:b}){try{typeof n=="string"&&(n=new URL(n))}catch(B){return n.toString()}if(!(n instanceof URL))return n;let m=N(n);if(!y(n)&&!m)return n.toString();if(c(n)&&s===void 0)return n.hostname=h(n),n.toString();let o=new URLSearchParams;if(s!==void 0)m&&o.set("frame-time",String(s));else if(c(n))return n.toString();if(r!==void 0&&o.set("h",String(a(r,b))),e!==void 0&&o.set("w",String(a(e,b))),i!==void 0&&o.set("format",i),t){if(Number(t)<=0||Number(t)>100)throw new Error("Quality has to be a positive number between 1 and 100");o.set("q",String(t))}return p!==void 0&&o.set("fit",p),n.search=o.toString(),n.toString()}function c(n){let e=d(n);return e==="mp4"||e==="mov"}function N(n){return c(n)||d(n)==="gif"}function y(n){if(!S(n))return!1;switch(d(n)){case"jpg":case"png":case"jpeg":case"webp":case"avif":case"ico":case"bmp":case"gif":case void 0:return!0;default:return!1}}function d(n){let e=n.pathname.split(".");if(!(e.length<=1))return e[e.length-1]}function S(n){return n.hostname.endsWith("seadn.io")}function x(n){try{typeof n=="string"&&(n=new URL(n))}catch(e){return n.toString()}return S(n)&&(n.hostname=h(n)),n.toString()}function h(n){return n.hostname.replace("i2c","raw2").replace("i2","raw2")}0&&(module.exports={optimize,originalURL}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@opensea/seadn", | ||
"version": "2.3.4", | ||
"version": "2.3.5", | ||
"description": "Javascript SDK to work with SeaDN", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "0.17.0", | ||
"@arethetypeswrong/cli": "0.17.1", | ||
"tsup": "8.3.5", | ||
@@ -19,0 +19,0 @@ "typescript": "5.7.2", |
@@ -122,2 +122,7 @@ import { test, expect } from "vitest"; | ||
[ | ||
"https://i2.seadn.io/moonbird.bmp", | ||
{ width: 24, height: 24 } satisfies MediaParams, | ||
"https://i2.seadn.io/moonbird.bmp?h=24&w=24", | ||
], | ||
[ | ||
"https://i2.seadn.io/bored-ape.png", | ||
@@ -124,0 +129,0 @@ { width: 24, height: 24, boost: 1 } satisfies MediaParams, |
@@ -97,2 +97,3 @@ import { boostSize } from "./boost"; | ||
case "ico": | ||
case "bmp": | ||
case "gif": | ||
@@ -99,0 +100,0 @@ case undefined: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29352
348