@vercel/og
Advanced tools
Comparing version 0.0.12-beta.2 to 0.0.12-beta.3
@@ -1,2 +0,2 @@ | ||
import y,{init as v}from"satori/wasm";import b from"yoga-wasm-web";import*as i from"@resvg/resvg-wasm";import S from"../vendor/resvg.simd.wasm?module";import E from"../vendor/yoga.wasm?module";var u=String.fromCharCode(8205),w=/\uFE0F/g;function m(o){return j(o.indexOf(u)<0?o.replace(w,""):o)}function j(o){for(var n=[],e=0,t=0,s=0;s<o.length;)e=o.charCodeAt(s++),t?(n.push((65536+(t-55296<<10)+(e-56320)).toString(16)),t=0):55296<=e&&e<=56319?t=e:n.push(e.toString(16));return n.join("-")}var r={openmoji:"https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/",twemoji:"https://twemoji.maxcdn.com/v/latest/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/"};function c(o,n){(!n||!r[n])&&(n="twemoji");let e=n!=="twemoji";return fetch(`${r[n]}${e?o.toUpperCase():o}.svg`)}var C=i.initWasm(S),x=b(E).then(o=>v(o)),R=fetch(new URL("../vendor/inter-v12-latin-regular.ttf",import.meta.url)).then(o=>o.arrayBuffer()),g={zh:"Noto+Sans+SC",ja:"Noto+Sans+JP",ko:"Noto+Sans+KR",th:"Noto+Sans+Thai",unknown:"Noto+Sans"};async function k(o,n){if(!o||!n)return;let e=`https://fonts.googleapis.com/css2?family=${o}&text=${encodeURIComponent(n)}`,s=(await(await fetch(e,{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 p=new Map,T=({emoji:o})=>{let n=async(e,t)=>{if(e==="emoji")return"data:image/svg+xml;base64,"+btoa(await(await c(m(t),o)).text());g[e]||(e="unknown");try{let s=await k(g[e],t);if(s)return{name:`satori_${e}_fallback_${t}`,data:s,weight:400,style:"normal"}}catch(s){console.error("Failed to load dynamic font for",t,". Error:",s)}};return async(...e)=>{let t=JSON.stringify(e),s=p.get(t);if(s)return s;let a=await n(...e);return p.set(t,a),a}},l=class{constructor(n,e={}){let t=Object.assign({width:1200,height:800,debug:!1},e),s=new ReadableStream({async start(a){await x,await C;let f=await R,d=await y(n,{width:t.width,height:t.height,debug:t.debug,fonts:t.fonts||[{name:"Inter",data:f,weight:700,style:"normal"}],loadAdditionalAsset:T({emoji:t.emoji})}),h=new i.Resvg(d,{fitTo:{mode:"width",value:t.width}});a.enqueue(h.render()),a.close()}});return new Response(s,{headers:{"content-type":"image/png","cache-control":"public, immutable, no-transform, max-age=31536000",...t.headers},status:t.status,statusText:t.statusText})}};export{l as ImageResponse}; | ||
import y,{init as v}from"satori/wasm";import b from"yoga-wasm-web";import*as i from"@resvg/resvg-wasm";import S from"../vendor/resvg.simd.wasm?module";import E from"../vendor/yoga.wasm?module";var u=String.fromCharCode(8205),w=/\uFE0F/g;function m(o){return j(o.indexOf(u)<0?o.replace(w,""):o)}function j(o){for(var n=[],e=0,t=0,s=0;s<o.length;)e=o.charCodeAt(s++),t?(n.push((65536+(t-55296<<10)+(e-56320)).toString(16)),t=0):55296<=e&&e<=56319?t=e:n.push(e.toString(16));return n.join("-")}var r={openmoji:"https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/",twemoji:"https://twemoji.maxcdn.com/v/latest/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/"};function c(o,n){(!n||!r[n])&&(n="twemoji");let e=n!=="twemoji";return fetch(`${r[n]}${e?o.toUpperCase():o}.svg`)}var C=i.initWasm(S),k=b(E).then(o=>v(o)),x=fetch(new URL("../vendor/noto-sans-v27-latin-regular.ttf",import.meta.url)).then(o=>o.arrayBuffer()),g={zh:"Noto+Sans+SC",ja:"Noto+Sans+JP",ko:"Noto+Sans+KR",th:"Noto+Sans+Thai",unknown:"Noto+Sans"};async function R(o,n){if(!o||!n)return;let e=`https://fonts.googleapis.com/css2?family=${o}&text=${encodeURIComponent(n)}`,s=(await(await fetch(e,{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 p=new Map,T=({emoji:o})=>{let n=async(e,t)=>{if(e==="emoji")return"data:image/svg+xml;base64,"+btoa(await(await c(m(t),o)).text());g[e]||(e="unknown");try{let s=await R(g[e],t);if(s)return{name:`satori_${e}_fallback_${t}`,data:s,weight:400,style:"normal"}}catch(s){console.error("Failed to load dynamic font for",t,". Error:",s)}};return async(...e)=>{let t=JSON.stringify(e),s=p.get(t);if(s)return s;let a=await n(...e);return p.set(t,a),a}},l=class{constructor(n,e={}){let t=Object.assign({width:1200,height:800,debug:!1},e),s=new ReadableStream({async start(a){await k,await C;let f=await x,d=await y(n,{width:t.width,height:t.height,debug:t.debug,fonts:t.fonts||[{name:"sans serif",data:f,weight:700,style:"normal"}],loadAdditionalAsset:T({emoji:t.emoji})}),h=new i.Resvg(d,{fitTo:{mode:"width",value:t.width}});a.enqueue(h.render()),a.close()}});return new Response(s,{headers:{"content-type":"image/png","cache-control":"public, immutable, no-transform, max-age=31536000",...t.headers},status:t.status,statusText:t.statusText})}};export{l as ImageResponse}; | ||
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */ |
{ | ||
"name": "@vercel/og", | ||
"version": "0.0.12-beta.2", | ||
"version": "0.0.12-beta.3", | ||
"description": "Vercel Open Graph Image Generation", | ||
@@ -21,3 +21,3 @@ "type": "module", | ||
"@resvg/resvg-wasm": "2.0.0-alpha.4", | ||
"satori": "0.0.29", | ||
"satori": "0.0.30-beta.1", | ||
"yoga-wasm-web": "0.1.1" | ||
@@ -24,0 +24,0 @@ }, |
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
10
1194059
+ Added@shuding/opentype.js@1.4.0-beta.0(transitive)
+ Addedsatori@0.0.30-beta.1(transitive)
- Removed@shuding/opentype.js@1.3.5(transitive)
- Removedsatori@0.0.29(transitive)
Updatedsatori@0.0.30-beta.1