Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snyk] Upgrade @resvg/resvg-js from 2.1.0 to 2.6.2 #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ghustavh97
Copy link
Contributor

This PR was automatically created by Snyk using the credentials of a real user.


![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)

Snyk has created this PR to upgrade @resvg/resvg-js from 2.1.0 to 2.6.2.

ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


  • The recommended version is 10 versions ahead of your current version.

  • The recommended version was released on 4 months ago.

Release notes
Package name: @resvg/resvg-js
  • 2.6.2 - 2024-03-26
    No content.
  • 2.6.1 - 2024-03-25

    What's Changed

    This version solves the problem of missing DLLs caused by not installing Visual C++ Redistributable on Windows.

    Added

    • chore(deps): update yarn to v3.8.1
    • chore(deps): update actions/cache action to v4
    • chore(deps): upgrade dependencies such as napi-rs #311
    • chore(ci): adding Node.js v20 to the CI
    • chore(ci): use macOS M1 machines
    • doc: clarify that the default value of the defaultFontFamily is empty
    • doc: improved change log documentation for M/L/C error
    • test: add a bbox test with stroke
    • fix(deps): update rust crate svgtypes to 0.14.0

    Fixed

    New Contributors

    Full Changelog: v2.6.0...v2.6.1

  • 2.6.1-beta.0 - 2024-03-11

    What's Changed

    This version solves the problem of missing DLLs caused by not installing Visual C++ Redistributable on Windows.

    Added

    • chore(deps): upgrade dependencies such as napi-rs #311
    • chore(ci): adding Node.js v20 to the CI
    • chore(ci): use macOS M1 machines
    • doc: clarify that the default value of the defaultFontFamily is empty
    • doc: improved change log documentation for M/L/C error
    • test: add a bbox test with stroke
    • fix(deps): update rust crate svgtypes to 0.14.0

    Fixed

    New Contributors

    Full Changelog: v2.6.0...v2.6.1-beta.0

  • 2.6.0 - 2023-10-20

    What's Changed

    🚀 Up to 115x faster for very large SVG files

    Now resvg has been upgraded from v0.29.0 to v0.34.0, bringing with it a host of new SVG features and performance improvements.

    • Support SVG2 mask-type property.

    • Allows quadratic Bézier curves: text might render slightly differently (better?). This is because TrueType fonts contain only quadratic curves and we were converting them to cubic before.

    • Clipping and masking is up to 20% faster.

    • Reduces the peak memory usage for SVGs with large paths (in terms of the number of segments).

    • A new rendering algorithm.

      When rendering isolated groups,
      aka layers, we have to know the layer bounding box beforehand, which is ridiculously hard in SVG.

      Previously, resvg would simply use the canvas size for all the layers.
      This means that to render a 10x10px layer on a 1000x1000px canvas, we would have to allocate and then blend
      a 1000x1000px layer, which is just a waste of CPU cycles.

      The new rendering algorithm is able to calculate layer bounding boxes, which dramatically improves
      performance when rendering a lot of tiny layers on a large canvas.

      Moreover, it makes performance more linear with a canvas size increase.

      The paris-30k.svg
      sample from google/forma is rendered 115 times faster on M1 Pro now.
      From ~33760ms down to ~290ms. 5269x3593px canvas.

      If we restrict the canvas to 1000x1000px, which would contain only the actual paris-30k.svg content,
      then we're 13 times faster. From ~3252ms down to ~253ms.

    Added

    • feat: upgrade to usvg/resvg 0.34.0. #268 Thanks to @ zimond

    Full Changelog: v2.5.0...v2.6.0

  • 2.5.0 - 2023-10-16

    What's Changed

    Added

    Now we can finally loading custom fonts in Wasm, including the WOFF2 format (see playground), thanks to the high-performance woff2-rs.

    In addition, we implemented smarter default font family fallback. the defaultFontFamily option can now be omitted. We'll read the font-family from the incoming fonts and set it to the default.

    <script src="https://unpkg.com/@ resvg/resvg-wasm"></script>
    <script>
    (async function () {
    await resvg.initWasm(fetch('https://unpkg.com/@ resvg/resvg-wasm/index_bg.wasm'))

    <span class="pl-k">const</span> <span class="pl-s1">font</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-en">fetch</span><span class="pl-kos">(</span><span class="pl-s">'./fonts/Pacifico-Regular.woff2'</span><span class="pl-kos">)</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-c1">!</span><span class="pl-s1">font</span><span class="pl-kos">.</span><span class="pl-c1">ok</span><span class="pl-kos">)</span> <span class="pl-k">return</span>
    
    <span class="pl-k">const</span> <span class="pl-s1">fontData</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">font</span><span class="pl-kos">.</span><span class="pl-en">arrayBuffer</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-k">const</span> <span class="pl-s1">buffer</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">Uint8Array</span><span class="pl-kos">(</span><span class="pl-s1">fontData</span><span class="pl-kos">)</span>
    
    <span class="pl-k">const</span> <span class="pl-s1">opts</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
      <span class="pl-c1">font</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">fontBuffers</span>: <span class="pl-kos">[</span><span class="pl-s1">buffer</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-c">// New in 2.5.0, loading custom fonts.</span>
        <span class="pl-c">// defaultFontFamily: 'Pacifico', // You can omit this.</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span>
    
    <span class="pl-k">const</span> <span class="pl-s1">svg</span> <span class="pl-c1">=</span> <span class="pl-s">'&lt;svg&gt; ... &lt;/svg&gt;'</span> <span class="pl-c">// Input SVG, String or Uint8Array</span>
    <span class="pl-k">const</span> <span class="pl-s1">resvgJS</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">resvg</span><span class="pl-kos">.</span><span class="pl-c1">Resvg</span><span class="pl-kos">(</span><span class="pl-s1">svg</span><span class="pl-kos">,</span> <span class="pl-s1">opts</span><span class="pl-kos">)</span>
    <span class="pl-k">const</span> <span class="pl-s1">pngData</span> <span class="pl-c1">=</span> <span class="pl-s1">resvgJS</span><span class="pl-kos">.</span><span class="pl-en">render</span><span class="pl-kos">(</span><span class="pl-s1">svg</span><span class="pl-kos">,</span> <span class="pl-s1">opts</span><span class="pl-kos">)</span> <span class="pl-c">// Output PNG data, Uint8Array</span>
    <span class="pl-k">const</span> <span class="pl-s1">pngBuffer</span> <span class="pl-c1">=</span> <span class="pl-s1">pngData</span><span class="pl-kos">.</span><span class="pl-en">asPng</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-k">const</span> <span class="pl-s1">svgURL</span> <span class="pl-c1">=</span> <span class="pl-c1">URL</span><span class="pl-kos">.</span><span class="pl-en">createObjectURL</span><span class="pl-kos">(</span><span class="pl-k">new</span> <span class="pl-v">Blob</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-s1">pngData</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">type</span>: <span class="pl-s">'image/png'</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
    <span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-en">getElementById</span><span class="pl-kos">(</span><span class="pl-s">'output'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">src</span> <span class="pl-c1">=</span> <span class="pl-s1">svgURL</span>
    

    })()
    </script>

    • feat: improve custom loaded fonts. Thanks to @ yisibl #209
    • feat: support for loading custom fonts in Wasm, via the fontBuffers option. Thanks to @ antmelnyk #217
    • feat: support loading WOFF2 font in Wasm. Thanks to @ yisibl #220
    • chore: Wasm uses the same logic as Node.js to find the default font family.Thanks to @ yisibl #252

    We have improved the upstream svgtypes#14, allow parsing of float rgb()/rgba() values from CSS Color 4 draft like rgb(3.14, 110, 201).

    • fix(deps): update rust crate svgtypes to 0.12.0. Thanks to @ yisibl #266

    Changed

    • test: fix test image timeout. #262

    New Contributors

    Full Changelog: v2.4.1...v2.5.0

  • 2.4.1 - 2023-02-15

    What's Changed

    New Contributors

    Full Changelog: v2.4.0...v2.4.1

  • 2.4.0 - 2023-02-09

    What's Changed

    This is a brand new version with 2-3x faster performance. It also resolves an issue with a specific SVG causing an error, and all users are advised to upgrade to this version.

    | fastest

    sharp:
    10.9 ops/s, ±31.43% | 72.47% slower

    svg2img(canvg + node-canvas):
    10.8 ops/s, ±28.52% | slowest, 72.73% slower

    The upgrade will be hard due to the big changes made to upstream resvg. resvg 0.28.0 started with the removal of the ability to output SVG string, and we had to backport that functionality to a new crate: usvg-writer.

    Eventually, we upgraded resvg for 2 successive versions, and are now at the latest 0.29.0.

    Changed

    • feat: upgrade resvg/usvg to 0.28.0. #194 Thanks to @ zimond
    • feat: upgrade resvg/usvg to 0.29.0. #199 Thanks to @ zimond
    • chore: upgrade rust-toolchain to nightly-2023-02-01. #199 Thanks to @ yisibl
    • chore: remove bench-related dependencies. #200 Thanks to @ yisibl

    Fixed

    • fix: 'the previous segment must be M/L/C' error. #204 Thanks to @ yisibl

      This is a normal error thrown by resvg when parsing Path Command, and has been confirmed as fixed in resvg 0.29.0.

      Add a test to ensure it is now fixed.

      '<unnamed>' panicked at 'the previous segment must be M/L/C'

      note: run with </span>RUST_BACKTRACE=1<span class="pl-pds"> environment variable to display a backtrace
      fatal runtime error: failed to initiate panic, error 5

    Full Changelog: v2.3.1...v2.4.0

  • 2.3.1 - 2023-02-02

    What's Changed

    Full Changelog: v2.3.0...v2.3.1

  • 2.3.0 - 2023-02-02

    What's Changed

    • fix: update napi-rs(2.10.13) to resolve Electron 21+ create Buffer issues. #195

      Electron 21 and later will have the V8 Memory Cage enabled, with implications for some native modules.
      https://www.electronjs.org/blog/v8-memory-cage

      This means that all napi-rs-based native modules will be affected. Usually there is an error like this:

      UnhandledPromiseRejectionWarning: Error: Failed to create napi buffer

      Good thing napi-rs has implemented a compatible approach in the new version, thanks to @ Brooooooklyn's work.

    • feat: add wasm file to exports. Thanks to @ hadeeb #186

      This solves the problem that direct require.resolve("@ resvg/resvg-wasm/index_bg.wasm") in tools like vite or webpack would report an error.

      Module not found: Package path ./index_bg.wasm is not exported from package
      /playground/node_modules/@ resvg/resvg-wasm (see exports field in
      /playground/node_modules/@ resvg/resvg-wasm/package.json)

      See the Node.js documentation for details about why:

      Existing packages introducing the "exports" field will prevent consumers of the package from using any entry points that are not defined

    • fix(ci): use zig to cross-compile armv7. #176

      This solves the problem of CI errors:

      Error: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.35' not found (required by /build/resvgjs.linux-arm-gnueabihf.node)

      Due to the GitHub Actions Ubuntu upgrade from 20.04 to 22.04, the glibc version became 2.35. To maintain our compatibility, zig cross-compilation is now enabled to support older versions of glibc systems.

      Distribution Glibc GCC
      CentOS 7 2.17 4.8.5
      Ubuntu 16.04 2.23 5.4.0
      Ubuntu 18.04 2.27 7.5.0
      Ubuntu 20.04 2.31 9.4.0
      Ubuntu 22.04 2.35 11.2.0
      Debian 10.12 2.28 8.3.0
      Debian 11.4 2.31 10.2.1
    • doc: add Node.js 18 to 'Support matrix'. #155

    New Contributors

    Full Changelog: v2.2.0...v2.3.0

  • 2.2.0 - 2022-11-17

    What's Changed

    Now resvg-js can be run natively (not Wasm) directly in Deno, this allows to get close to the performance of Node.js native addons in Deno.

    deno run --unstable --allow-read --allow-write --allow-ffi example/index-deno.js

    See Deno Example

    import * as path from 'https://deno.land/std@0.159.0/path/mod.ts'
    import { Resvg } from 'npm:@ resvg/resvg-js'
    const __dirname = path.dirname(path.fromFileUrl(import.meta.url))

    const svg = await Deno.readFile(path.join(__dirname, './text.svg'))
    const resvg = new Resvg(svg, opts)
    const pngData = resvg.render()
    const pngBuffer = pngData.asPng()

    await Deno.writeFile(path.join(__dirname, './text-out-deno.png'), pngBuffer)

    In addition, resvg-js can return the raw pixels data of the PNG, which can be very convenient for scenes where only pixels need to be processed.

    Added

    • feat: add .pixels() API for returning PNG pixels data (#123).
    • chore: upgrade to resvg v0.25.0 (by @ zimond in #156).
      • Partial paint-order attribute support. Markers can only be under or above the shape.
      • CSS3 writing-mode variants vertical-rl and vertical-lr. Thanks to @ yisibl.
      • (tiny-skia) AArch64 Neon SIMD support. Up to 3x faster on Apple M1.
      • Path bbox calculation scales stroke width too. Thanks to @ growler.
      • (tiny-skia) Round caps roundness. Fixes #155.

    Changed

    • build: x86_64-linux-gnu and aarch64-linux-gnu are no longer compiled using Zig. (#125)
    • doc: the dpi option is not the DPI in the PNG file. (#146)
    • chore: add deno example and docs. (#154)
    • feat: upgrade napi-rs to 2.10.0 and Node.js v18. (#157)
    • test: add image resolver API test case. (#164)
    • feat: remove the infer crate, this can reduce the size of Wasm files.
    • feat: remove the infer crate, this reduced the size of the Wasm file by about 4.3%. (#165)
      • Before: 1360609 bytes
      • After: 1302173 bytes
    • feat: error code UnrecognizedBuffer changed to UnsupportedImage. (#165)

    Fixed

    • fix: ignore png crate in renovate.json. (by @ CGQAQ in #161)

    New Contributors

    Full Changelog: v2.1.0...v2.2.0

  • 2.1.0 - 2022-07-03
from @resvg/resvg-js GitHub release notes

Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

Snyk has created this PR to upgrade @resvg/resvg-js from 2.1.0 to 2.6.2.

See this package in npm:
@resvg/resvg-js

See this project in Snyk:
https://app.snyk.io/org/oslllo.com/project/f445f92d-d23f-486c-93a3-ddd0cdcb3307?utm_source=github&utm_medium=referral&page=upgrade-pr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Library is cutting the corners of SVG
2 participants