@resvg/resvg-js
Advanced tools
Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3
@@ -50,1 +50,8 @@ /// <reference types="node" /> | ||
): Promise<Buffer> | ||
export class Resvg { | ||
constructor(svg: Buffer | string, options?: ResvgRenderOptions | null) | ||
toString(): string | ||
render(): Buffer | ||
get width(): number | ||
get height(): number | ||
} |
10
index.js
@@ -1,2 +0,2 @@ | ||
const { render: _render, renderAsync: _renderAsync } = require('./js-binding') | ||
const { render: _render, renderAsync: _renderAsync, Resvg: _Resvg } = require('./js-binding.js') | ||
@@ -16,1 +16,9 @@ module.exports.render = function render(svg, options) { | ||
} | ||
module.exports.Resvg = class Resvg extends _Resvg { | ||
constructor(svg, options) { | ||
super(svg, JSON.stringify(options)) | ||
} | ||
} | ||
// module.exports.Resvg = _Resvg |
@@ -6,4 +6,6 @@ /* tslint:disable */ | ||
/** Renders an SVG */ | ||
export function render(svg: string | Buffer, options?: string | undefined | null): Buffer | ||
export function renderAsync(svg: string | Buffer, options?: string | undefined | null, signal?: AbortSignal | undefined | null): Promise<Buffer> | ||
export class Resvg { | ||
get width(): number | ||
get height(): number | ||
} |
@@ -1,1 +0,1 @@ | ||
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{return readFileSync("/usr/bin/ldd","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":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{render,renderAsync}=nativeBinding;module.exports.render=render,module.exports.renderAsync=renderAsync; | ||
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{return readFileSync("/usr/bin/ldd","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":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{Resvg,renderAsync}=nativeBinding;module.exports.Resvg=Resvg,module.exports.renderAsync=renderAsync; |
{ | ||
"name": "@resvg/resvg-js", | ||
"version": "2.0.0-alpha.2", | ||
"version": "2.0.0-alpha.3", | ||
"description": "A high-performance SVG renderer, powered by Rust based resvg and napi-rs", | ||
@@ -143,15 +143,15 @@ "main": "index.js", | ||
"optionalDependencies": { | ||
"@resvg/resvg-js-win32-x64-msvc": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-darwin-x64": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-linux-x64-gnu": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-linux-x64-musl": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-linux-arm64-gnu": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-win32-ia32-msvc": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-linux-arm-gnueabihf": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-darwin-arm64": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-android-arm64": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-android-arm-eabi": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-linux-arm64-musl": "2.0.0-alpha.2", | ||
"@resvg/resvg-js-win32-arm64-msvc": "2.0.0-alpha.2" | ||
"@resvg/resvg-js-win32-x64-msvc": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-darwin-x64": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-linux-x64-gnu": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-linux-x64-musl": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-linux-arm64-gnu": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-win32-ia32-msvc": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-linux-arm-gnueabihf": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-darwin-arm64": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-android-arm64": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-android-arm-eabi": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-linux-arm64-musl": "2.0.0-alpha.3", | ||
"@resvg/resvg-js-win32-arm64-msvc": "2.0.0-alpha.3" | ||
} | ||
} |
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
37512
98