Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vercel/og

Package Overview
Dependencies
Maintainers
215
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/og - npm Package Compare versions

Comparing version 0.0.25 to 0.0.26

2

dist/index.js

@@ -1,3 +0,3 @@

import S,{init as b}from"satori/wasm";import N from"yoga-wasm-web";import*as i from"@resvg/resvg-wasm";import T from"../vendor/resvg.simd.wasm?module";import C from"../vendor/yoga.wasm?module";var v=String.fromCharCode(8205),y=/\uFE0F/g;function m(t){return j(t.indexOf(v)<0?t.replace(y,""):t)}function j(t){for(var n=[],o=0,e=0,s=0;s<t.length;)o=t.charCodeAt(s++),e?(n.push((65536+(e-55296<<10)+(o-56320)).toString(16)),e=0):55296<=o&&o<=56319?e=o:n.push(o.toString(16));return n.join("-")}var r={twemoji:t=>"https://twemoji.maxcdn.com/v/latest/svg/"+t.toLowerCase()+".svg",openmoji:"https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/",blobmoji:"https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/",noto:"https://cdn.jsdelivr.net/gh/svgmoji/svgmoji/packages/svgmoji__noto/svg/",fluent:t=>"https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/"+t.toLowerCase()+"_color.svg",fluentFlat:t=>"https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/"+t.toLowerCase()+"_flat.svg"};function c(t,n){(!n||!r[n])&&(n="twemoji");let o=r[n];return fetch(typeof o=="function"?o(t):`${o}${t.toUpperCase()}.svg`)}var E=i.initWasm(T),R=N(C).then(t=>b(t)),x=fetch(new URL("../vendor/noto-sans-v27-latin-regular.ttf",import.meta.url)).then(t=>t.arrayBuffer()),f,h,_=((h=(f=globalThis==null?void 0:globalThis.process)==null?void 0:f.env)==null?void 0:h.NODE_ENV)==="development",l={"ja-JP":"Noto+Sans+JP","ko-KR":"Noto+Sans+KR","zh-CN":"Noto+Sans+SC","zh-TW":"Noto+Sans+TC","zh-HK":"Noto+Sans+HK","th-TH":"Noto+Sans+Thai","bn-IN":"Noto+Sans+Bengali","ar-AR":"Noto+Sans+Arabic","ta-IN":"Noto+Sans+Tamil","ml-IN":"Noto+Sans+Malayalam","he-IL":"Noto+Sans+Hebrew","te-IN":"Noto+Sans+Telugu",devanagari:"Noto+Sans+Devanagari",kannada:"Noto+Sans+Kannada",symbol:["Noto+Sans+Symbols","Noto+Sans+Symbols+2"],math:"Noto+Sans+Math",unknown:"Noto+Sans"};async function k(t,n){if(!t||!n)return;let o=`https://fonts.googleapis.com/css2?family=${t}&text=${encodeURIComponent(n)}`,s=(await(await fetch(o,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1"}})).text()).match(/src: url\((.+)\) format\('(opentype|truetype)'\)/);if(!s)throw new Error("Failed to load font");return fetch(s[1]).then(a=>a.arrayBuffer())}var g=new Map,I=({emoji:t})=>{let n=async(o,e)=>{if(o==="emoji")return"data:image/svg+xml;base64,"+btoa(await(await c(m(e),t)).text());l[o]||(o="unknown");try{let s=await k(l[o],e);if(s)return{name:`satori_${o}_fallback_${e}`,data:s,weight:400,style:"normal"}}catch(s){console.error("Failed to load dynamic font for",e,". Error:",s)}};return async(...o)=>{let e=JSON.stringify(o),s=g.get(e);if(s)return s;let a=await n(...o);return g.set(e,a),a}},p=class{constructor(n,o={}){let e=Object.assign({width:1200,height:630,debug:!1},o),s=new ReadableStream({async start(a){await R,await E;let u=await x,d=await S(n,{width:e.width,height:e.height,debug:e.debug,fonts:e.fonts||[{name:"sans serif",data:u,weight:700,style:"normal"}],loadAdditionalAsset:I({emoji:e.emoji})}),w=new i.Resvg(d,{fitTo:{mode:"width",value:e.width}});a.enqueue(w.render()),a.close()}});return new Response(s,{headers:{"content-type":"image/png","cache-control":_?"no-cache, no-store":"public, immutable, no-transform, max-age=31536000",...e.headers},status:e.status,statusText:e.statusText})}};export{p as ImageResponse};
import S,{init as b}from"satori/wasm";import N from"yoga-wasm-web";import*as i from"@resvg/resvg-wasm";import T from"../vendor/resvg.simd.wasm?module";import C from"../vendor/yoga.wasm?module";var v=String.fromCharCode(8205),j=/\uFE0F/g;function c(t){return y(t.indexOf(v)<0?t.replace(j,""):t)}function y(t){for(var n=[],o=0,e=0,s=0;s<t.length;)o=t.charCodeAt(s++),e?(n.push((65536+(e-55296<<10)+(o-56320)).toString(16)),e=0):55296<=o&&o<=56319?e=o:n.push(o.toString(16));return n.join("-")}var r={twemoji:t=>"https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/"+t.toLowerCase()+".svg",openmoji:"https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/",blobmoji:"https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/",noto:"https://cdn.jsdelivr.net/gh/svgmoji/svgmoji/packages/svgmoji__noto/svg/",fluent:t=>"https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/"+t.toLowerCase()+"_color.svg",fluentFlat:t=>"https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/"+t.toLowerCase()+"_flat.svg"};function m(t,n){(!n||!r[n])&&(n="twemoji");let o=r[n];return fetch(typeof o=="function"?o(t):`${o}${t.toUpperCase()}.svg`)}var E=i.initWasm(T),R=N(C).then(t=>b(t)),x=fetch(new URL("../vendor/noto-sans-v27-latin-regular.ttf",import.meta.url)).then(t=>t.arrayBuffer()),f,u,_=((u=(f=globalThis==null?void 0:globalThis.process)==null?void 0:f.env)==null?void 0:u.NODE_ENV)==="development",l={"ja-JP":"Noto+Sans+JP","ko-KR":"Noto+Sans+KR","zh-CN":"Noto+Sans+SC","zh-TW":"Noto+Sans+TC","zh-HK":"Noto+Sans+HK","th-TH":"Noto+Sans+Thai","bn-IN":"Noto+Sans+Bengali","ar-AR":"Noto+Sans+Arabic","ta-IN":"Noto+Sans+Tamil","ml-IN":"Noto+Sans+Malayalam","he-IL":"Noto+Sans+Hebrew","te-IN":"Noto+Sans+Telugu",devanagari:"Noto+Sans+Devanagari",kannada:"Noto+Sans+Kannada",symbol:["Noto+Sans+Symbols","Noto+Sans+Symbols+2"],math:"Noto+Sans+Math",unknown:"Noto+Sans"};async function k(t,n){if(!t||!n)return;let o=`https://fonts.googleapis.com/css2?family=${t}&text=${encodeURIComponent(n)}`,s=(await(await fetch(o,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1"}})).text()).match(/src: url\((.+)\) format\('(opentype|truetype)'\)/);if(!s)throw new Error("Failed to load font");return fetch(s[1]).then(a=>a.arrayBuffer())}var g=new Map,I=({emoji:t})=>{let n=async(o,e)=>{if(o==="emoji")return"data:image/svg+xml;base64,"+btoa(await(await m(c(e),t)).text());l[o]||(o="unknown");try{let s=await k(l[o],e);if(s)return{name:`satori_${o}_fallback_${e}`,data:s,weight:400,style:"normal"}}catch(s){console.error("Failed to load dynamic font for",e,". Error:",s)}};return async(...o)=>{let e=JSON.stringify(o),s=g.get(e);if(s)return s;let a=await n(...o);return g.set(e,a),a}},p=class{constructor(n,o={}){let e=Object.assign({width:1200,height:630,debug:!1},o),s=new ReadableStream({async start(a){await R,await E;let d=await x,h=await S(n,{width:e.width,height:e.height,debug:e.debug,fonts:e.fonts||[{name:"sans serif",data:d,weight:700,style:"normal"}],loadAdditionalAsset:I({emoji:e.emoji})}),w=new i.Resvg(h,{fitTo:{mode:"width",value:e.width}});a.enqueue(w.render()),a.close()}});return new Response(s,{headers:{"content-type":"image/png","cache-control":_?"no-cache, no-store":"public, immutable, no-transform, max-age=31536000",...e.headers},status:e.status,statusText:e.statusText})}};export{p as ImageResponse};
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */
//# sourceMappingURL=index.js.map
{
"name": "@vercel/og",
"version": "0.0.25",
"version": "0.0.26",
"description": "Generate Open Graph Images dynamically from HTML/CSS without a browser",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc