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

@resvg/resvg-js

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@resvg/resvg-js - npm Package Compare versions

Comparing version 2.4.1 to 2.5.0

8

index.d.ts

@@ -5,7 +5,7 @@ /// <reference types="node" />

font?: {
loadSystemFonts?: boolean
fontFiles?: string[]
fontDirs?: string[]
loadSystemFonts?: boolean // Default: true. if set to false, it will be faster.
fontFiles?: string[] // A list of local font file paths to load.
fontDirs?: string[] // A list of local font directories to load.
defaultFontSize?: number // Default: 12
defaultFontFamily?: string
defaultFontSize?: number
serifFamily?: string

@@ -12,0 +12,0 @@ sansSerifFamily?: string

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

"use strict";const{existsSync,readFileSync}=require("fs"),{join}=require("path"),{platform,arch}=process;let nativeBinding=null,localFileExisted=!1,loadError=null;function isMusl(){if(!process.report||typeof process.report.getReport!="function")try{const e=require("child_process").execSync("which ldd").toString().trim();return readFileSync(e,"utf8").includes("musl")}catch(e){return!0}else{const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}}switch(platform){case"android":switch(arch){case"arm64":localFileExisted=existsSync(join(__dirname,"resvgjs.android-arm64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.android-arm64.node"):nativeBinding=require("@resvg/resvg-js-android-arm64")}catch(e){loadError=e}break;case"arm":localFileExisted=existsSync(join(__dirname,"resvgjs.android-arm-eabi.node"));try{localFileExisted?nativeBinding=require("./resvgjs.android-arm-eabi.node"):nativeBinding=require("@resvg/resvg-js-android-arm-eabi")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Android ${arch}`)}break;case"win32":switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"resvgjs.win32-x64-msvc.node"));try{localFileExisted?nativeBinding=require("./resvgjs.win32-x64-msvc.node"):nativeBinding=require("@resvg/resvg-js-win32-x64-msvc")}catch(e){loadError=e}break;case"ia32":localFileExisted=existsSync(join(__dirname,"resvgjs.win32-ia32-msvc.node"));try{localFileExisted?nativeBinding=require("./resvgjs.win32-ia32-msvc.node"):nativeBinding=require("@resvg/resvg-js-win32-ia32-msvc")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"resvgjs.win32-arm64-msvc.node"));try{localFileExisted?nativeBinding=require("./resvgjs.win32-arm64-msvc.node"):nativeBinding=require("@resvg/resvg-js-win32-arm64-msvc")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Windows: ${arch}`)}break;case"darwin":localFileExisted=existsSync(join(__dirname,"resvgjs.darwin-universal.node"));try{localFileExisted?nativeBinding=require("./resvgjs.darwin-universal.node"):nativeBinding=require("@resvg/resvg-js-darwin-universal");break}catch(e){}switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"resvgjs.darwin-x64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.darwin-x64.node"):nativeBinding=require("@resvg/resvg-js-darwin-x64")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"resvgjs.darwin-arm64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.darwin-arm64.node"):nativeBinding=require("@resvg/resvg-js-darwin-arm64")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on macOS: ${arch}`)}break;case"freebsd":if(arch!=="x64")throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);localFileExisted=existsSync(join(__dirname,"resvgjs.freebsd-x64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.freebsd-x64.node"):nativeBinding=require("@resvg/resvg-js-freebsd-x64")}catch(e){loadError=e}break;case"linux":switch(arch){case"x64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"resvgjs.linux-x64-musl.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-x64-musl.node"):nativeBinding=require("@resvg/resvg-js-linux-x64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"resvgjs.linux-x64-gnu.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-x64-gnu.node"):nativeBinding=require("@resvg/resvg-js-linux-x64-gnu")}catch(e){loadError=e}}break;case"arm64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"resvgjs.linux-arm64-musl.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-arm64-musl.node"):nativeBinding=require("@resvg/resvg-js-linux-arm64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"resvgjs.linux-arm64-gnu.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-arm64-gnu.node"):nativeBinding=require("@resvg/resvg-js-linux-arm64-gnu")}catch(e){loadError=e}}break;case"arm":localFileExisted=existsSync(join(__dirname,"resvgjs.linux-arm-gnueabihf.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-arm-gnueabihf.node"):nativeBinding=require("@resvg/resvg-js-linux-arm-gnueabihf")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Linux: ${arch}`)}break;default:throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)}if(!nativeBinding)throw loadError||new Error("Failed to load native binding");const{BBox,Resvg,RenderedImage,renderAsync}=nativeBinding;module.exports.BBox=BBox,module.exports.Resvg=Resvg,module.exports.RenderedImage=RenderedImage,module.exports.renderAsync=renderAsync;
"use strict";const{existsSync,readFileSync}=require("fs"),{join}=require("path"),{platform,arch}=process;let nativeBinding=null,localFileExisted=!1,loadError=null;function isMusl(){if(!process.report||typeof process.report.getReport!="function")try{const e=require("child_process").execSync("which ldd").toString().trim();return readFileSync(e,"utf8").includes("musl")}catch{return!0}else{const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}}switch(platform){case"android":switch(arch){case"arm64":localFileExisted=existsSync(join(__dirname,"resvgjs.android-arm64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.android-arm64.node"):nativeBinding=require("@resvg/resvg-js-android-arm64")}catch(e){loadError=e}break;case"arm":localFileExisted=existsSync(join(__dirname,"resvgjs.android-arm-eabi.node"));try{localFileExisted?nativeBinding=require("./resvgjs.android-arm-eabi.node"):nativeBinding=require("@resvg/resvg-js-android-arm-eabi")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Android ${arch}`)}break;case"win32":switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"resvgjs.win32-x64-msvc.node"));try{localFileExisted?nativeBinding=require("./resvgjs.win32-x64-msvc.node"):nativeBinding=require("@resvg/resvg-js-win32-x64-msvc")}catch(e){loadError=e}break;case"ia32":localFileExisted=existsSync(join(__dirname,"resvgjs.win32-ia32-msvc.node"));try{localFileExisted?nativeBinding=require("./resvgjs.win32-ia32-msvc.node"):nativeBinding=require("@resvg/resvg-js-win32-ia32-msvc")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"resvgjs.win32-arm64-msvc.node"));try{localFileExisted?nativeBinding=require("./resvgjs.win32-arm64-msvc.node"):nativeBinding=require("@resvg/resvg-js-win32-arm64-msvc")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Windows: ${arch}`)}break;case"darwin":localFileExisted=existsSync(join(__dirname,"resvgjs.darwin-universal.node"));try{localFileExisted?nativeBinding=require("./resvgjs.darwin-universal.node"):nativeBinding=require("@resvg/resvg-js-darwin-universal");break}catch{}switch(arch){case"x64":localFileExisted=existsSync(join(__dirname,"resvgjs.darwin-x64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.darwin-x64.node"):nativeBinding=require("@resvg/resvg-js-darwin-x64")}catch(e){loadError=e}break;case"arm64":localFileExisted=existsSync(join(__dirname,"resvgjs.darwin-arm64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.darwin-arm64.node"):nativeBinding=require("@resvg/resvg-js-darwin-arm64")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on macOS: ${arch}`)}break;case"freebsd":if(arch!=="x64")throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);localFileExisted=existsSync(join(__dirname,"resvgjs.freebsd-x64.node"));try{localFileExisted?nativeBinding=require("./resvgjs.freebsd-x64.node"):nativeBinding=require("@resvg/resvg-js-freebsd-x64")}catch(e){loadError=e}break;case"linux":switch(arch){case"x64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"resvgjs.linux-x64-musl.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-x64-musl.node"):nativeBinding=require("@resvg/resvg-js-linux-x64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"resvgjs.linux-x64-gnu.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-x64-gnu.node"):nativeBinding=require("@resvg/resvg-js-linux-x64-gnu")}catch(e){loadError=e}}break;case"arm64":if(isMusl()){localFileExisted=existsSync(join(__dirname,"resvgjs.linux-arm64-musl.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-arm64-musl.node"):nativeBinding=require("@resvg/resvg-js-linux-arm64-musl")}catch(e){loadError=e}}else{localFileExisted=existsSync(join(__dirname,"resvgjs.linux-arm64-gnu.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-arm64-gnu.node"):nativeBinding=require("@resvg/resvg-js-linux-arm64-gnu")}catch(e){loadError=e}}break;case"arm":localFileExisted=existsSync(join(__dirname,"resvgjs.linux-arm-gnueabihf.node"));try{localFileExisted?nativeBinding=require("./resvgjs.linux-arm-gnueabihf.node"):nativeBinding=require("@resvg/resvg-js-linux-arm-gnueabihf")}catch(e){loadError=e}break;default:throw new Error(`Unsupported architecture on Linux: ${arch}`)}break;default:throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)}if(!nativeBinding)throw loadError||new Error("Failed to load native binding");const{BBox,Resvg,RenderedImage,renderAsync}=nativeBinding;module.exports.BBox=BBox,module.exports.Resvg=Resvg,module.exports.RenderedImage=RenderedImage,module.exports.renderAsync=renderAsync;
{
"name": "@resvg/resvg-js",
"version": "2.4.1",
"version": "2.5.0",
"description": "A high-performance SVG renderer and toolkit, powered by Rust based resvg and napi-rs",

@@ -76,23 +76,24 @@ "main": "index.js",

"devDependencies": {
"@napi-rs/cli": "^2.14.6",
"@swc-node/register": "^1.5.1",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.30.3",
"@typescript-eslint/parser": "^5.30.3",
"ava": "^5.0.0",
"@napi-rs/cli": "^2.16.3",
"@swc-node/register": "1.6.4",
"@swc/core": "^1.3.88",
"@types/node": "^20.6.5",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"ava": "^5.3.1",
"copyfiles": "^2.4.1",
"dts-bundle-generator": "^6.12.0",
"esbuild": "^0.17.0",
"eslint": "^8.19.0",
"dts-bundle-generator": "^8.0.1",
"esbuild": "^0.19.3",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-sonarjs": "^0.18.0",
"eslint-plugin-sonarjs": "^0.21.0",
"husky": "^8.0.0",
"jimp-compact": "^0.16.1-2",
"lint-staged": "^12.5.0",
"lint-staged": "^14.0.0",
"node-fetch": "2.x",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"typescript": "^4.7.4"
"typescript": "^5.2.2"
},

@@ -137,17 +138,17 @@ "lint-staged": {

},
"packageManager": "yarn@3.4.1",
"packageManager": "yarn@3.6.3",
"optionalDependencies": {
"@resvg/resvg-js-win32-x64-msvc": "2.4.1",
"@resvg/resvg-js-darwin-x64": "2.4.1",
"@resvg/resvg-js-linux-x64-gnu": "2.4.1",
"@resvg/resvg-js-linux-x64-musl": "2.4.1",
"@resvg/resvg-js-linux-arm64-gnu": "2.4.1",
"@resvg/resvg-js-win32-ia32-msvc": "2.4.1",
"@resvg/resvg-js-linux-arm-gnueabihf": "2.4.1",
"@resvg/resvg-js-darwin-arm64": "2.4.1",
"@resvg/resvg-js-android-arm64": "2.4.1",
"@resvg/resvg-js-android-arm-eabi": "2.4.1",
"@resvg/resvg-js-linux-arm64-musl": "2.4.1",
"@resvg/resvg-js-win32-arm64-msvc": "2.4.1"
"@resvg/resvg-js-win32-x64-msvc": "2.5.0",
"@resvg/resvg-js-darwin-x64": "2.5.0",
"@resvg/resvg-js-linux-x64-gnu": "2.5.0",
"@resvg/resvg-js-linux-x64-musl": "2.5.0",
"@resvg/resvg-js-linux-arm64-gnu": "2.5.0",
"@resvg/resvg-js-win32-ia32-msvc": "2.5.0",
"@resvg/resvg-js-linux-arm-gnueabihf": "2.5.0",
"@resvg/resvg-js-darwin-arm64": "2.5.0",
"@resvg/resvg-js-android-arm64": "2.5.0",
"@resvg/resvg-js-android-arm-eabi": "2.5.0",
"@resvg/resvg-js-linux-arm64-musl": "2.5.0",
"@resvg/resvg-js-win32-arm64-msvc": "2.5.0"
}
}

@@ -10,2 +10,4 @@ # resvg-js

Please use all lowercase `resvg-js` when referencing project names.
## Features

@@ -39,2 +41,7 @@

## Docs
- Node.js see [index.d.ts](./index.d.ts)
- Wasm see [wasm/index.d.ts](./wasm/index.d.ts)
## Example

@@ -90,3 +97,3 @@

loadSystemFonts: false, // It will be faster to disable loading system fonts.
defaultFontFamily: 'Source Han Serif CN Light',
// defaultFontFamily: 'Source Han Serif CN Light', // You can omit this.
},

@@ -107,2 +114,10 @@ }

### Bun
Starting with [Bun 0.8.1](https://github.com/oven-sh/bun/issues/172#issuecomment-1692930718), resvg-js can be run directly in Bun without any modification to the JS files, and is fully compatible with the syntax in Node.js.
```shell
bun example/index.js
```
### Deno

@@ -153,2 +168,9 @@

await resvg.initWasm(fetch('https://unpkg.com/@resvg/resvg-wasm/index_bg.wasm'))
const font = await fetch('./fonts/Pacifico-Regular.woff2')
if (!font.ok) return
const fontData = await font.arrayBuffer()
const buffer = new Uint8Array(fontData)
const opts = {

@@ -159,2 +181,5 @@ fitTo: {

},
font: {
fontBuffers: [buffer], // New in 2.5.0, loading custom fonts
},
}

@@ -281,4 +306,6 @@

Please use all lowercase `resvg-js` when referencing project names.
[MPLv2.0](https://www.mozilla.org/en-US/MPL/)
Copyright (c) 2021-present, yisibl(一丝)
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