New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

svg2png-wasm

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg2png-wasm - npm Package Compare versions

Comparing version 0.6.1 to 1.0.0

NOTICE

3

dist/index.min.js

@@ -0,1 +1,4 @@

/**
* @file This library uses [resvg](https://github.com/RazrFalcon/resvg), which is licensed unser MPL-2.0. The source code for resvg can be found [here](https://github.com/RazrFalcon/resvg).
*/
var svg2pngWasm=(()=>{var O=Object.defineProperty;var P=e=>O(e,"__esModule",{value:!0});var D=(e,n)=>{P(e);for(var t in n)O(e,t,{get:n[t],enumerable:!0})};var J={};D(J,{createSvg2png:()=>T,initialize:()=>$,svg2png:()=>G});var i,x=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});x.decode();var p=null;function d(){return(p===null||p.buffer!==i.memory.buffer)&&(p=new Uint8Array(i.memory.buffer)),p}function A(e,n){return x.decode(d().subarray(e,e+n))}var u=new Array(32).fill(void 0);u.push(void 0,null,!0,!1);var b=u.length;function S(e){b===u.length&&u.push(u.length+1);let n=b;return b=u[n],u[n]=e,n}function I(e){return u[e]}function q(e){e<36||(u[e]=b,b=e)}function W(e){let n=I(e);return q(e),n}var f=0;function B(e,n){let t=n(e.length*1);return d().set(e,t/1),f=e.length,t}var y=new TextEncoder("utf-8"),N=typeof y.encodeInto=="function"?function(e,n){return y.encodeInto(e,n)}:function(e,n){let t=y.encode(e);return n.set(t),{read:e.length,written:t.length}};function w(e,n,t){if(t===void 0){let a=y.encode(e),l=n(a.length);return d().subarray(l,l+a.length).set(a),f=a.length,l}let o=e.length,r=n(o),c=d(),s=0;for(;s<o;s++){let a=e.charCodeAt(s);if(a>127)break;c[r+s]=a}if(s!==o){s!==0&&(e=e.slice(s)),r=t(r,o,o=s+e.length*3);let a=d().subarray(r+s,r+o);s+=N(e,a).written}return f=s,r}function _(e){return e==null}var m=null;function v(){return(m===null||m.buffer!==i.memory.buffer)&&(m=new Int32Array(i.memory.buffer)),m}function H(e,n){return d().subarray(e/1,e/1+n)}function E(e,n,t,o,r){var c=_(e)?0:w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),s=f,a=_(n)?0:w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),l=f,F=_(t)?0:w(t,i.__wbindgen_malloc,i.__wbindgen_realloc),g=f,k=_(o)?0:w(o,i.__wbindgen_malloc,i.__wbindgen_realloc),z=f,R=_(r)?0:w(r,i.__wbindgen_malloc,i.__wbindgen_realloc),j=f,L=i.createConverter(c,s,a,l,F,g,k,z,R,j);return h.__wrap(L)}var h=class{static __wrap(n){let t=Object.create(h.prototype);return t.ptr=n,t}__destroy_into_raw(){let n=this.ptr;return this.ptr=0,n}free(){let n=this.__destroy_into_raw();i.__wbg_converter_free(n)}registerFont(n){var t=B(n,i.__wbindgen_malloc),o=f;i.converter_registerFont(this.ptr,t,o)}convert(n,t,o,r){try{let g=i.__wbindgen_add_to_stack_pointer(-16);var c=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=f;i.converter_convert(g,this.ptr,c,s,!_(t),_(t)?0:t,!_(o),_(o)?0:o,!_(r),_(r)?0:r);var a=v()[g/4+0],l=v()[g/4+1],F=H(a,l).slice();return i.__wbindgen_free(a,l*1),F}finally{i.__wbindgen_add_to_stack_pointer(16)}}};async function V(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(o){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{let t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}async function U(e){typeof e=="undefined"&&(e=new URL("svg2png_wasm_bg.wasm",undefined));let n={};n.wbg={},n.wbg.__wbindgen_string_new=function(r,c){var s=A(r,c);return S(s)},n.wbg.__wbg_new_693216e109162396=function(){var r=new Error;return S(r)},n.wbg.__wbg_stack_0ddaca5d1abfb52f=function(r,c){var s=I(c).stack,a=w(s,i.__wbindgen_malloc,i.__wbindgen_realloc),l=f;v()[r/4+1]=l,v()[r/4+0]=a},n.wbg.__wbg_error_09919627ac0992f5=function(r,c){try{console.error(A(r,c))}finally{i.__wbindgen_free(r,c)}},n.wbg.__wbindgen_object_drop_ref=function(r){W(r)},n.wbg.__wbindgen_throw=function(r,c){throw new Error(A(r,c))},n.wbg.__wbindgen_rethrow=function(r){throw W(r)},(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:o}=await V(await e,n);return i=t.exports,U.__wbindgen_wasm_module=o,i.__wbindgen_start(),i}var M=U;var C=!1,$=async e=>{if(C)throw new Error("Already initialized. The `initialize` function can be used only once.");await M(await e),C=!0},T=e=>{if(!C)throw new Error("WASM has not been initialized. Call `initialize` function.");let n;n=E(e?.defaultFontFamily?.serifFamily,e?.defaultFontFamily?.sansSerifFamily,e?.defaultFontFamily?.cursiveFamily,e?.defaultFontFamily?.fantasyFamily,e?.defaultFontFamily?.monospaceFamily);for(let o of e?.fonts??[])n.registerFont(o);let t=(o,r)=>new Promise((c,s)=>{try{let a=n?.convert(o,r?.scale,r?.width,r?.height);if(a)c(a);else throw new Error("Converter already disposed.")}catch(a){a instanceof Error?s(a):s(new Error(`${a}`))}});return t.dispose=()=>{n?.free(),n=void 0},t},G=(e,n)=>{let t=T(n);return t(e,n).finally(()=>t.dispose())};return J;})();

7

package.json
{
"name": "svg2png-wasm",
"version": "0.6.1",
"version": "1.0.0",
"description": "A svg to png converter made with wasm.",

@@ -54,3 +54,4 @@ "main": "dist/index.cjs",

"svg2png_wasm_bg.wasm",
"dist"
"dist",
"NOTICE"
],

@@ -62,3 +63,3 @@ "author": "ssssota",

},
"homepage": "https://github.com/ssssota/svg2png-wasm#readme",
"homepage": "https://ssssota.github.io/svg2png-wasm/",
"devDependencies": {

@@ -65,0 +66,0 @@ "@swc/core": "^1.2.93",

@@ -9,2 +9,4 @@ # <img src="./logo.svg" width="150px">

**[Demo site](https://ssssota.github.io/svg2png-wasm/)**
SVG to PNG converter JS library made with WASM + [resvg](https://crates.io/crates/resvg).

@@ -29,3 +31,3 @@

```html
<script src="https://unpkg.com/svg2png-wasm@0.6.0"></script>
<script src="https://unpkg.com/svg2png-wasm@0.6.1"></script>

@@ -39,8 +41,6 @@ <!-- Or, latest -->

```ts
// @deno-types="https://unpkg.com/svg2png-wasm@0.6.0/index.d.ts";
export {
createSvg2png,
initialize,
svg2png,
} from 'https://unpkg.com/svg2png-wasm@0.6.0';
// from esm.sh
export * from 'https://esm.sh/svg2png-wasm@0.6.1';
// from skypack.dev
export * from 'https://cdn.skypack.dev/svg2png-wasm@0.6.1?dts';
```

@@ -180,6 +180,9 @@

MPL-2.0 License
MIT
This library uses [resvg](https://github.com/RazrFalcon/resvg), which is licensed unser MPL-2.0.
The source code for resvg can be found [here](https://github.com/RazrFalcon/resvg).
## 🙋‍♂️ Contributing
WELCOME!

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

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