feat: upgrade all deps (#132)

This commit is contained in:
LongYinan 2025-06-27 04:24:12 -07:00 committed by GitHub
parent cc953eac62
commit 89631c32fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
67 changed files with 5450 additions and 5408 deletions

View File

@ -1,7 +1,7 @@
[target.i686-pc-windows-msvc]
rustflags = ["-C", "target-feature=+sse4.2"]
rustflags = ["-C", "target-feature=+avx2"]
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "target-feature=+sse4.2"]
rustflags = ["-C", "target-feature=+avx2"]
[target.x86_64-unknown-linux-musl]
rustflags = ["-C", "target-feature=-crt-static"]
[target.aarch64-unknown-linux-gnu]

View File

@ -45,6 +45,17 @@ jobs:
python -m pip install meson
yarn workspace @napi-rs/image build --target x86_64-pc-windows-msvc --features with_simd
target: x86_64-pc-windows-msvc
- host: macos-latest
target: aarch64-pc-windows-msvc
setup: |
brew update
brew install meson llvm
build: |
export XWIN_CACHE_DIR="$(pwd)/.xwin"
export XWIN_ARCH=aarch64
export PATH="$(brew --prefix llvm)/bin:$PATH"
clang --version
CFLAGS="-mneon /FIintrin.h" yarn workspace @napi-rs/image build -x --features with_simd --target aarch64-pc-windows-msvc
- host: macos-latest
setup: |
brew update
@ -52,12 +63,12 @@ jobs:
build: |
export XWIN_CACHE_DIR="$(pwd)/.xwin"
export XWIN_ARCH=x86
export CFLAGS="-mavx2 -mpclmul"
export CFLAGS="-mavx2 -mpclmul /FIintrin.h"
export CXXFLAGS="-mavx2 -mpclmul"
export CARGO_PROFILE_RELEASE_LTO="false"
export PATH="$(brew --prefix llvm)/bin:$PATH"
clang --version
CARGO="cargo-xwin" yarn workspace @napi-rs/image build --features with_simd --target i686-pc-windows-msvc
yarn workspace @napi-rs/image build -x --features with_simd --target i686-pc-windows-msvc
target: i686-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
@ -74,17 +85,16 @@ jobs:
chmod -R 777 target
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
docker: ghcr.io/brooooooklyn/canvas/musl-builder:lts
build: >-
set -e &&
unset RUSTFLAGS &&
unset CC &&
unset CXX &&
apk add --update --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing --no-cache perl nasm aom-dev meson &&
export LIB_AOM_STATIC_LIB_PATH=/usr/lib &&
export LIB_AOM_INCLUDE_PATH=/usr/include/aom/aom &&
export LIB_AOM_PKG_CONFIG_PATH=/usr/lib/pkgconfig &&
yarn workspace @napi-rs/image build --target x86_64-unknown-linux-musl --features with_simd &&
apk add libc++-dev libc++-static &&
cp /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/*.o /usr/lib/ &&
cp /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/libgcc.a /usr/lib/ &&
cp /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/libgcc_eh.a /usr/lib/ &&
wget "https://github.com/Brooooooklyn/canvas/releases/download/libcxxabi-$(cat llvm-version)/libc++abi-x86_64.a" &&
mv libc++abi-x86_64.a /usr/lib/libc++abi.a &&
CXXFLAGS="-std=c++20 -stdlib=libc++ -static -fPIC -fno-cxx-exceptions -fno-exceptions -I/usr/include/c++/v1" CC=clang CXX=clang++ yarn workspace @napi-rs/image build --target x86_64-unknown-linux-musl --features with_simd &&
chmod -R 777 target
- host: macos-latest
target: aarch64-apple-darwin
@ -113,15 +123,6 @@ jobs:
export CXXFLAGS="-fuse-ld=lld -mcrc -B/usr/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/4.8.5 --sysroot=/usr/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot -L/usr/aarch64-unknown-linux-gnu/lib/llvm-18/lib -stdlib=libc++" &&
yarn workspace @napi-rs/image build --features with_simd --target aarch64-unknown-linux-gnu &&
chmod -R 777 target
- host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
setup: |
sudo apt-get update
sudo apt-get install meson gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
build: |
export CC="arm-linux-gnueabihf-gcc"
export CARGO_CFG_TARGET_FEATURE="neon"
yarn workspace @napi-rs/image build --target armv7-unknown-linux-gnueabihf --features oxipng_libdeflater --use-napi-cross
- host: ubuntu-latest
target: aarch64-linux-android
build: |
@ -153,7 +154,7 @@ jobs:
export CMAKE_BUILD_PARALLEL_LEVEL=2
yarn workspace @napi-rs/image build --target wasm32-wasip1-threads
name: stable - ${{ matrix.settings.target }} - node@20
name: stable - ${{ matrix.settings.target }} - node@22
runs-on: ${{ matrix.settings.host }}
env:
RUST_TARGET: ${{ matrix.settings.target }}
@ -162,14 +163,14 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: yarn
- name: Setup nasm
uses: ilammy/setup-nasm@v1
if: matrix.settings.target == 'x86_64-pc-windows-msvc' || matrix.settings.target == 'x86_64-apple-darwin' || matrix.settings.target == 'i686-pc-windows-msvc'
- name: Install cargo-xwin
uses: taiki-e/install-action@v2
if: matrix.settings.target == 'i686-pc-windows-msvc'
if: matrix.settings.target == 'i686-pc-windows-msvc' || matrix.settings.target == 'aarch64-pc-windows-msvc'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
@ -194,11 +195,16 @@ jobs:
- uses: goto-bus-stop/setup-zig@v2
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.13.0
version: 0.14.1
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
with:
version: '20'
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Build in docker
@ -220,6 +226,59 @@ jobs:
packages/*/*.node
packages/*/*.wasm
if-no-files-found: error
build-armv7-linux-gnueabihf:
name: Build armv7-unknown-linux-gnueabihf
runs-on: ubuntu-latest
container:
image: debian:buster
steps:
- name: Setup tools
run: |
apt-get update
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libatomic1-armhf-cross git build-essential cmake ninja-build wget curl gnupg
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-18 main" >> /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-18 main" >> /etc/apt/sources.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
apt-get update
apt-get install -y clang-18
ln -s /usr/bin/clang-18 /usr/bin/clang
ln -s /usr/bin/clang++-18 /usr/bin/clang++
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.x'
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: 'armv7-unknown-linux-gnueabihf'
- name: Install dependencies
run: |
corepack enable
yarn install --immutable --mode=skip-build
- name: Config git
run: git config --global --add safe.directory "$(pwd)"
- name: Build
run: |
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
yarn workspace @napi-rs/image build --target armv7-unknown-linux-gnueabihf --features oxipng_libdeflater
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-armv7-unknown-linux-gnueabihf
path: |
packages/*/*.node
if-no-files-found: error
build-freebsd:
runs-on: ubuntu-latest
name: Build FreeBSD
@ -227,7 +286,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build
id: build
uses: cross-platform-actions/action@v0.26.0
uses: cross-platform-actions/action@v0.28.0
env:
DEBUG: 'napi:*'
RUSTUP_HOME: /home/runner/rustup
@ -235,7 +294,7 @@ jobs:
RUSTUP_IO_THREADS: 1
with:
operating_system: freebsd
version: '14.0'
version: '14.2'
memory: 8G
cpu_count: 3
environment_variables: 'DEBUG RUSTUP_IO_THREADS'
@ -284,8 +343,8 @@ jobs:
- host: macos-latest
target: aarch64-apple-darwin
node:
- '18'
- '20'
- '22'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
@ -310,6 +369,8 @@ jobs:
with:
name: bindings-${{ matrix.settings.target }}
path: artifacts
- name: Create npm dirs
run: yarn workspace @napi-rs/image napi create-npm-dirs
- name: Move artifacts
run: yarn artifacts
shell: bash
@ -332,8 +393,8 @@ jobs:
fail-fast: false
matrix:
node:
- '18'
- '20'
- '22'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -349,6 +410,8 @@ jobs:
with:
name: bindings-x86_64-unknown-linux-gnu
path: artifacts
- name: Create npm dirs
run: yarn workspace @napi-rs/image napi create-npm-dirs
- name: Move artifacts
run: yarn artifacts
shell: bash
@ -365,8 +428,8 @@ jobs:
fail-fast: false
matrix:
node:
- '18'
- '20'
- '22'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -382,6 +445,8 @@ jobs:
with:
name: bindings-x86_64-unknown-linux-musl
path: artifacts
- name: Create npm dirs
run: yarn workspace @napi-rs/image napi create-npm-dirs
- name: Move artifacts
run: yarn artifacts
shell: bash
@ -409,6 +474,8 @@ jobs:
path: artifacts
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Create npm dirs
run: yarn workspace @napi-rs/image napi create-npm-dirs
- name: Move artifacts
run: yarn artifacts
shell: bash
@ -429,13 +496,13 @@ jobs:
test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
needs:
- build
- build-armv7-linux-gnueabihf
strategy:
fail-fast: false
matrix:
node:
- '18'
- '20'
- '22'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -446,6 +513,8 @@ jobs:
path: artifacts
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Create npm dirs
run: yarn workspace @napi-rs/image napi create-npm-dirs
- name: Move artifacts
run: yarn artifacts
shell: bash
@ -477,6 +546,8 @@ jobs:
path: artifacts
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Create npm dirs
run: yarn workspace @napi-rs/image napi create-npm-dirs
- name: Move artifacts
run: yarn artifacts
shell: bash
@ -504,10 +575,12 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: yarn
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Create npm dirs
run: yarn workspace @napi-rs/image napi create-npm-dirs
- name: Download all artifacts
uses: actions/download-artifact@v4
with:

1
.gitignore vendored
View File

@ -24,3 +24,4 @@ nasa-small.*
output-overlay-png.png
output-debian.jpeg
*.wasm
packages/binding/npm

File diff suppressed because one or more lines are too long

942
.yarn/releases/yarn-4.9.2.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.6.0.cjs
yarnPath: .yarn/releases/yarn-4.9.2.cjs

1
llvm-version Normal file
View File

@ -0,0 +1 @@
19.1.7

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -12,20 +12,20 @@
"website"
],
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.59",
"@napi-rs/cli": "^3.0.0-alpha.91",
"@taplo/cli": "^0.7.0",
"@types/node": "^22.0.0",
"@types/node": "^24.0.4",
"@types/sharp": "^0.32.0",
"ava": "^6.1.3",
"ava": "^6.4.0",
"blurhash": "^2.0.5",
"chalk": "^5.3.0",
"electron": "^33.0.0",
"lerna": "^8.1.6",
"npm-run-all2": "^7.0.0",
"prettier": "^3.3.3",
"rxjs": "^7.8.1",
"sharp": "^0.33.4",
"typescript": "^5.5.3"
"chalk": "^5.4.1",
"electron": "^37.0.0",
"lerna": "^8.2.2",
"npm-run-all2": "^8.0.4",
"prettier": "^3.6.1",
"rxjs": "^7.8.2",
"sharp": "^0.34.2",
"typescript": "^5.8.3"
},
"scripts": {
"artifacts": "lerna run artifacts",
@ -70,6 +70,6 @@
"pre-commit": "lint-staged && cargo fmt --all"
}
},
"packageManager": "yarn@4.6.0",
"packageManager": "yarn@4.9.2",
"repository": "git@github.com:Brooooooklyn/Image.git"
}

View File

@ -23,13 +23,13 @@ jpeg-decoder = "0.3"
libavif = { version = "0.14", default-features = false, features = ["codec-aom"] }
libc = "0.2"
lodepng = "3"
napi = { version = "3.0.0-alpha", default-features = false, features = ["napi3"] }
napi-derive = { version = "3.0.0-alpha", default-features = false, features = ["type-def"] }
napi = { version = "3.0.0-beta", default-features = false, features = ["napi3"] }
napi-derive = { version = "3.0.0-beta", default-features = false, features = ["type-def"] }
num-complex = "0.4"
num_cpus = "1"
once_cell = "1"
png = "0.17"
resvg = "0.44"
resvg = "0.45"
rexif = "0.7"
rgb = "0.8"
svgtypes = "0.15"
@ -43,10 +43,10 @@ svgtypes = "0.15"
version = "2"
[target.'cfg(not(all(target_os = "macos", target_arch = "x86_64")))'.dependencies]
libwebp-sys = { version = "0.11", default-features = false, features = ["std", "parallel", "avx2", "sse41", "neon"] }
libwebp-sys = { version = "0.12", default-features = false, features = ["std", "parallel", "avx2", "sse41", "neon"] }
[target.'cfg(all(target_os = "macos", target_arch = "x86_64"))'.dependencies]
libwebp-sys = { version = "0.11", default-features = false, features = ["std", "parallel"] }
libwebp-sys = { version = "0.12", default-features = false, features = ["std", "parallel"] }
[build-dependencies]
napi-build = "2"

View File

@ -1,16 +1,16 @@
import {
instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
getDefaultContext as __emnapiGetDefaultContext,
WASI as __WASI,
createOnMessage as __wasmCreateOnMessageForFsProxy,
getDefaultContext as __emnapiGetDefaultContext,
instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
WASI as __WASI,
} from '@napi-rs/wasm-runtime'
import __wasmUrl from './image.wasm32-wasi.wasm?url'
const __wasi = new __WASI({
version: 'preview1',
})
const __wasmUrl = new URL('./image.wasm32-wasi.wasm', import.meta.url).href
const __emnapiContext = __emnapiGetDefaultContext()
const __sharedMemory = new WebAssembly.Memory({
@ -33,7 +33,7 @@ const {
const worker = new Worker(new URL('./wasi-worker-browser.mjs', import.meta.url), {
type: 'module',
})
return worker
},
overwriteImports(importObject) {
@ -46,42 +46,14 @@ const {
return importObject
},
beforeInit({ instance }) {
__napi_rs_initialize_modules(instance)
for (const name of Object.keys(instance.exports)) {
if (name.startsWith('__napi_register__')) {
instance.exports[name]()
}
}
},
})
function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__AvifConfig_struct_0']?.()
__napiInstance.exports['__napi_register__ChromaSubsampling_1']?.()
__napiInstance.exports['__napi_register__FastResizeFilter_2']?.()
__napiInstance.exports['__napi_register__ResizeFit_3']?.()
__napiInstance.exports['__napi_register__FastResizeOptions_struct_4']?.()
__napiInstance.exports['__napi_register__JpegCompressOptions_struct_5']?.()
__napiInstance.exports['__napi_register__compress_jpeg_sync_6']?.()
__napiInstance.exports['__napi_register__CompressJpegTask_impl_7']?.()
__napiInstance.exports['__napi_register__compress_jpeg_8']?.()
__napiInstance.exports['__napi_register__CompressionType_9']?.()
__napiInstance.exports['__napi_register__FilterType_10']?.()
__napiInstance.exports['__napi_register__PngEncodeOptions_struct_11']?.()
__napiInstance.exports['__napi_register__PngRowFilter_12']?.()
__napiInstance.exports['__napi_register__PNGLosslessOptions_struct_13']?.()
__napiInstance.exports['__napi_register__lossless_compress_png_sync_14']?.()
__napiInstance.exports['__napi_register__LosslessPngTask_impl_15']?.()
__napiInstance.exports['__napi_register__lossless_compress_png_16']?.()
__napiInstance.exports['__napi_register__PngQuantOptions_struct_17']?.()
__napiInstance.exports['__napi_register__png_quantize_sync_18']?.()
__napiInstance.exports['__napi_register__PngQuantTask_impl_19']?.()
__napiInstance.exports['__napi_register__png_quantize_20']?.()
__napiInstance.exports['__napi_register__Orientation_21']?.()
__napiInstance.exports['__napi_register__ResizeFilterType_22']?.()
__napiInstance.exports['__napi_register__JsColorType_23']?.()
__napiInstance.exports['__napi_register__Metadata_struct_24']?.()
__napiInstance.exports['__napi_register__MetadataTask_impl_25']?.()
__napiInstance.exports['__napi_register__ResizeOptions_struct_26']?.()
__napiInstance.exports['__napi_register__EncodeTask_impl_27']?.()
__napiInstance.exports['__napi_register__Transformer_struct_28']?.()
__napiInstance.exports['__napi_register__Transformer_impl_70']?.()
}
export default __napiModule.exports
export const Transformer = __napiModule.exports.Transformer
export const ChromaSubsampling = __napiModule.exports.ChromaSubsampling
export const CompressionType = __napiModule.exports.CompressionType

View File

@ -9,9 +9,9 @@ const { WASI: __nodeWASI } = require('node:wasi')
const { Worker } = require('node:worker_threads')
const {
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
getDefaultContext: __emnapiGetDefaultContext,
createOnMessage: __wasmCreateOnMessageForFsProxy,
getDefaultContext: __emnapiGetDefaultContext,
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
} = require('@napi-rs/wasm-runtime')
const __rootDir = __nodePath.parse(process.cwd()).root
@ -56,11 +56,11 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
return 4
}
})(),
reuseWorker: true,
wasi: __wasi,
onCreateWorker() {
const worker = new Worker(__nodePath.join(__dirname, 'wasi-worker.mjs'), {
env: process.env,
execArgv: ['--experimental-wasi-unstable-preview1'],
})
worker.onmessage = ({ data }) => {
__wasmCreateOnMessageForFsProxy(__nodeFs)(data)
@ -77,42 +77,14 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
return importObject
},
beforeInit({ instance }) {
__napi_rs_initialize_modules(instance)
}
for (const name of Object.keys(instance.exports)) {
if (name.startsWith('__napi_register__')) {
instance.exports[name]()
}
}
},
})
function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__AvifConfig_struct_0']?.()
__napiInstance.exports['__napi_register__ChromaSubsampling_1']?.()
__napiInstance.exports['__napi_register__FastResizeFilter_2']?.()
__napiInstance.exports['__napi_register__ResizeFit_3']?.()
__napiInstance.exports['__napi_register__FastResizeOptions_struct_4']?.()
__napiInstance.exports['__napi_register__JpegCompressOptions_struct_5']?.()
__napiInstance.exports['__napi_register__compress_jpeg_sync_6']?.()
__napiInstance.exports['__napi_register__CompressJpegTask_impl_7']?.()
__napiInstance.exports['__napi_register__compress_jpeg_8']?.()
__napiInstance.exports['__napi_register__CompressionType_9']?.()
__napiInstance.exports['__napi_register__FilterType_10']?.()
__napiInstance.exports['__napi_register__PngEncodeOptions_struct_11']?.()
__napiInstance.exports['__napi_register__PngRowFilter_12']?.()
__napiInstance.exports['__napi_register__PNGLosslessOptions_struct_13']?.()
__napiInstance.exports['__napi_register__lossless_compress_png_sync_14']?.()
__napiInstance.exports['__napi_register__LosslessPngTask_impl_15']?.()
__napiInstance.exports['__napi_register__lossless_compress_png_16']?.()
__napiInstance.exports['__napi_register__PngQuantOptions_struct_17']?.()
__napiInstance.exports['__napi_register__png_quantize_sync_18']?.()
__napiInstance.exports['__napi_register__PngQuantTask_impl_19']?.()
__napiInstance.exports['__napi_register__png_quantize_20']?.()
__napiInstance.exports['__napi_register__Orientation_21']?.()
__napiInstance.exports['__napi_register__ResizeFilterType_22']?.()
__napiInstance.exports['__napi_register__JsColorType_23']?.()
__napiInstance.exports['__napi_register__Metadata_struct_24']?.()
__napiInstance.exports['__napi_register__MetadataTask_impl_25']?.()
__napiInstance.exports['__napi_register__ResizeOptions_struct_26']?.()
__napiInstance.exports['__napi_register__EncodeTask_impl_27']?.()
__napiInstance.exports['__napi_register__Transformer_struct_28']?.()
__napiInstance.exports['__napi_register__Transformer_impl_70']?.()
}
module.exports = __napiModule.exports
module.exports.Transformer = __napiModule.exports.Transformer
module.exports.ChromaSubsampling = __napiModule.exports.ChromaSubsampling
module.exports.CompressionType = __napiModule.exports.CompressionType

View File

@ -495,4 +495,3 @@ export interface ResizeOptions {
filter?: ResizeFilterType
fit?: ResizeFit
}

View File

@ -1,9 +1,12 @@
// prettier-ignore
/* eslint-disable */
// @ts-nocheck
/* auto-generated by NAPI-RS */
const { readFileSync } = require('fs')
const { createRequire } = require('node:module')
require = createRequire(__filename)
const { readFileSync } = require('node:fs')
let nativeBinding = null
const loadErrors = []
@ -32,7 +35,11 @@ const isMuslFromFilesystem = () => {
}
const isMuslFromReport = () => {
const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null
let report = null
if (typeof process.report?.getReport === 'function') {
process.report.excludeNetwork = true
report = process.report.getReport()
}
if (!report) {
return null
}
@ -57,7 +64,13 @@ const isMuslFromChildProcess = () => {
}
function requireNative() {
if (process.platform === 'android') {
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
try {
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err)
}
} else if (process.platform === 'android') {
if (process.arch === 'arm64') {
try {
return require('./image.android-arm64.node')
@ -336,7 +349,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
nativeBinding = require('./image.wasi.cjs')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
console.error(err)
loadErrors.push(err)
}
}
if (!nativeBinding) {
@ -344,7 +357,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
nativeBinding = require('@napi-rs/image-wasm32-wasi')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
console.error(err)
loadErrors.push(err)
}
}
}
@ -352,15 +365,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
if (!nativeBinding) {
if (loadErrors.length > 0) {
// TODO Link to documentation with potential fixes
// - The package owner could build/publish bindings for this arch
// - The user may need to bundle the correct files
// - The user may need to re-install node_modules to get new packages
throw new Error('Failed to load native binding', { cause: loadErrors })
throw new Error(
`Cannot find native binding. ` +
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
{ cause: loadErrors }
)
}
throw new Error(`Failed to load native binding`)
}
module.exports = nativeBinding
module.exports.Transformer = nativeBinding.Transformer
module.exports.ChromaSubsampling = nativeBinding.ChromaSubsampling
module.exports.CompressionType = nativeBinding.CompressionType

View File

@ -1,4 +1,4 @@
/// https://github.com/image-rs/image#generating-fractals
//! https://github.com/image-rs/image#generating-fractals
fn main() {
let imgx = 800;

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-android-arm64`
This is the **aarch64-linux-android** binary for `@napi-rs/image`

View File

@ -1,38 +0,0 @@
{
"name": "@napi-rs/image-android-arm64",
"version": "1.9.2",
"cpu": [
"arm64"
],
"main": "image.android-arm64.node",
"files": [
"image.android-arm64.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"android"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-darwin-arm64`
This is the **aarch64-apple-darwin** binary for `@napi-rs/image`

View File

@ -1,38 +0,0 @@
{
"name": "@napi-rs/image-darwin-arm64",
"version": "1.9.2",
"cpu": [
"arm64"
],
"main": "image.darwin-arm64.node",
"files": [
"image.darwin-arm64.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"darwin"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-darwin-x64`
This is the **x86_64-apple-darwin** binary for `@napi-rs/image`

View File

@ -1,38 +0,0 @@
{
"name": "@napi-rs/image-darwin-x64",
"version": "1.9.2",
"cpu": [
"x64"
],
"main": "image.darwin-x64.node",
"files": [
"image.darwin-x64.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"darwin"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-freebsd-x64`
This is the **x86_64-unknown-freebsd** binary for `@napi-rs/image`

View File

@ -1,38 +0,0 @@
{
"name": "@napi-rs/image-freebsd-x64",
"version": "1.9.2",
"cpu": [
"x64"
],
"main": "image.freebsd-x64.node",
"files": [
"image.freebsd-x64.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"freebsd"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-linux-arm-gnueabihf`
This is the **armv7-unknown-linux-gnueabihf** binary for `@napi-rs/image`

View File

@ -1,38 +0,0 @@
{
"name": "@napi-rs/image-linux-arm-gnueabihf",
"version": "1.9.2",
"cpu": [
"arm"
],
"main": "image.linux-arm-gnueabihf.node",
"files": [
"image.linux-arm-gnueabihf.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"linux"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `@napi-rs/image`

View File

@ -1,13 +0,0 @@
// Node.js 10.x, ignore
if (!process.report || typeof process.report.getReport !== 'function') {
process.exit(0)
}
// Only GNU system has this field
const { glibcVersionRuntime } = process.report.getReport().header
if (glibcVersionRuntime) {
process.exit(0)
} else {
process.exit(1)
}

View File

@ -1,41 +0,0 @@
{
"name": "@napi-rs/image-linux-arm64-gnu",
"version": "1.9.2",
"cpu": [
"arm64"
],
"main": "image.linux-arm64-gnu.node",
"files": [
"image.linux-arm64-gnu.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"linux"
],
"libc": [
"glibc"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `@napi-rs/image`

View File

@ -1,13 +0,0 @@
// Node.js 10.x, ignore
if (!process.report || typeof process.report.getReport !== 'function') {
process.exit(0)
}
// Only GNU system has this field
const { glibcVersionRuntime } = process.report.getReport().header
if (glibcVersionRuntime) {
process.exit(1)
} else {
process.exit(0)
}

View File

@ -1,41 +0,0 @@
{
"name": "@napi-rs/image-linux-arm64-musl",
"version": "1.9.2",
"cpu": [
"arm64"
],
"main": "image.linux-arm64-musl.node",
"files": [
"image.linux-arm64-musl.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"linux"
],
"libc": [
"musl"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `@napi-rs/image`

View File

@ -1,13 +0,0 @@
// Node.js 10.x, ignore
if (!process.report || typeof process.report.getReport !== 'function') {
process.exit(0)
}
// Only GNU system has this field
const { glibcVersionRuntime } = process.report.getReport().header
if (glibcVersionRuntime) {
process.exit(0)
} else {
process.exit(1)
}

View File

@ -1,41 +0,0 @@
{
"name": "@napi-rs/image-linux-x64-gnu",
"version": "1.9.2",
"cpu": [
"x64"
],
"main": "image.linux-x64-gnu.node",
"files": [
"image.linux-x64-gnu.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"linux"
],
"libc": [
"glibc"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `@napi-rs/image`

View File

@ -1,13 +0,0 @@
// Node.js 10.x, ignore
if (!process.report || typeof process.report.getReport !== 'function') {
process.exit(0)
}
// Only GNU system has this field
const { glibcVersionRuntime } = process.report.getReport().header
if (glibcVersionRuntime) {
process.exit(1)
} else {
process.exit(0)
}

View File

@ -1,41 +0,0 @@
{
"name": "@napi-rs/image-linux-x64-musl",
"version": "1.9.2",
"cpu": [
"x64"
],
"main": "image.linux-x64-musl.node",
"files": [
"image.linux-x64-musl.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"linux"
],
"libc": [
"musl"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-wasm32-wasi`
This is the **wasm32-wasi-preview1-threads** binary for `@napi-rs/image`

View File

@ -1,43 +0,0 @@
{
"name": "@napi-rs/image-wasm32-wasi",
"version": "1.9.2",
"cpu": [
"wasm32"
],
"main": "image.wasi.cjs",
"files": [
"image.wasm32-wasi.wasm",
"image.wasi.cjs",
"image.wasi-browser.js",
"wasi-worker.mjs",
"wasi-worker-browser.mjs"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">=14.0.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"browser": "image.wasi-browser.js",
"dependencies": {
"@napi-rs/wasm-runtime": "^0.2.0"
}
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `@napi-rs/image`

View File

@ -1,38 +0,0 @@
{
"name": "@napi-rs/image-win32-ia32-msvc",
"version": "1.9.2",
"cpu": [
"ia32"
],
"main": "image.win32-ia32-msvc.node",
"files": [
"image.win32-ia32-msvc.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"win32"
]
}

View File

@ -1,3 +0,0 @@
# `@napi-rs/image-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `@napi-rs/image`

View File

@ -1,38 +0,0 @@
{
"name": "@napi-rs/image-win32-x64-msvc",
"version": "1.9.2",
"cpu": [
"x64"
],
"main": "image.win32-x64-msvc.node",
"files": [
"image.win32-x64-msvc.node"
],
"description": "Image processing library",
"keywords": [
"image",
"lossless",
"compression",
"jpeg",
"jpg",
"png",
"svg"
],
"author": {
"email": "github@lyn.one",
"name": "LongYinan",
"url": "https://lyn.one"
},
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "git@github.com:Brooooooklyn/Image.git",
"os": [
"win32"
]
}

View File

@ -33,6 +33,7 @@
"targets": [
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"aarch64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"aarch64-apple-darwin",
"aarch64-linux-android",
@ -66,6 +67,6 @@
"repository": "git@github.com:Brooooooklyn/Image.git",
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.55",
"@napi-rs/wasm-runtime": "^0.2.4"
"@napi-rs/wasm-runtime": "^0.2.11"
}
}

View File

@ -39,15 +39,14 @@ pub fn compress_jpeg_sync(
})?;
return BufferSlice::from_data(&env, dest.into_inner());
}
let (buf, outsize, de_c_info, compress_c_info) =
unsafe { moz_jpeg_compress(input, &options) }?;
let (buf, outsize, de_c_info, compress_c_info) = unsafe { moz_jpeg_compress(input, &options) }?;
unsafe {
BufferSlice::from_external(
&env,
buf,
outsize,
(de_c_info, compress_c_info, buf),
|(mut input, mut output, buf), _| {
|_, (mut input, mut output, buf)| {
mozjpeg_sys::jpeg_destroy_decompress(&mut input);
mozjpeg_sys::jpeg_destroy_compress(&mut output);
libc::free(buf as *mut std::ffi::c_void);
@ -215,7 +214,7 @@ impl Task for CompressJpegTask {
buf,
len,
(de_c_info, compress_c_info, buf),
|(mut input, mut output, buf), _| {
|_, (mut input, mut output, buf)| {
mozjpeg_sys::jpeg_destroy_decompress(&mut input);
mozjpeg_sys::jpeg_destroy_compress(&mut output);
libc::free(buf as *mut std::ffi::c_void);

View File

@ -185,7 +185,7 @@ pub(crate) struct ImageMetaData {
/// `env` from `Node.js` can ensure the thread safe.
pub(crate) struct ThreadSafeDynamicImage {
raw: Uint8Array,
raw: Arc<Uint8Array>,
image: *mut Option<ImageMetaData>,
}
@ -198,7 +198,7 @@ impl Drop for ThreadSafeDynamicImage {
}
impl ThreadSafeDynamicImage {
fn new(input: Uint8Array) -> Self {
fn new(input: Arc<Uint8Array>) -> Self {
ThreadSafeDynamicImage {
image: Box::into_raw(Box::new(None)),
raw: input,
@ -412,7 +412,7 @@ struct ImageTransformArgs {
huerotate: Option<i32>,
orientation: Option<Orientation>,
crop: Option<(u32, u32, u32, u32)>,
overlay: Vec<(Uint8Array, i64, i64)>,
overlay: Vec<(Arc<Uint8Array>, i64, i64)>,
}
pub struct EncodeTask {
@ -431,7 +431,7 @@ impl EncodeOutput {
pub(crate) fn into_buffer_slice(self, env: &Env) -> Result<BufferSlice> {
match self {
EncodeOutput::Raw(ptr, len) => unsafe {
BufferSlice::from_external(env, ptr, len, ptr, |pointer, _| {
BufferSlice::from_external(env, ptr, len, ptr, |_, pointer| {
Vec::from_raw_parts(pointer, len, len);
})
},
@ -440,7 +440,7 @@ impl EncodeOutput {
let len = avif_data.len();
let data_ptr = avif_data.as_slice().as_ptr();
unsafe {
BufferSlice::from_external(env, data_ptr.cast_mut(), len, avif_data, |data, _| {
BufferSlice::from_external(env, data_ptr.cast_mut(), len, avif_data, |_, data| {
drop(data);
})
}
@ -558,7 +558,7 @@ impl Task for EncodeTask {
meta.image = meta.image.crop_imm(x, y, width, height);
}
for (buffer, x, y) in std::mem::take(&mut self.image_transform_args.overlay).into_iter() {
let top = ThreadSafeDynamicImage::new(buffer);
let top = ThreadSafeDynamicImage::new(buffer.clone());
let top_image_meta = top.get(true)?;
overlay(&mut meta.image, &top_image_meta.image, x, y);
}
@ -676,7 +676,7 @@ impl Transformer {
#[napi(constructor)]
pub fn new(input: Uint8Array) -> Transformer {
Self {
dynamic_image: Arc::new(ThreadSafeDynamicImage::new(input)),
dynamic_image: Arc::new(ThreadSafeDynamicImage::new(Arc::new(input))),
image_transform_args: ImageTransformArgs::default(),
}
}
@ -753,7 +753,7 @@ impl Transformer {
}));
Ok(Self {
dynamic_image: Arc::new(ThreadSafeDynamicImage {
raw: vec![0].into(),
raw: Arc::new(vec![0].into()),
image: Box::into_raw(image_meta),
}),
image_transform_args: Default::default(),
@ -924,7 +924,10 @@ impl Transformer {
#[napi]
/// Overlay an image at a given coordinate (x, y)
pub fn overlay(&mut self, on_top: Uint8Array, x: i64, y: i64) -> Result<&Self> {
self.image_transform_args.overlay.push((on_top, x, y));
self
.image_transform_args
.overlay
.push((Arc::new(on_top), x, y));
Ok(self)
}

3
website/.gitignore vendored
View File

@ -3,4 +3,5 @@
public/img/example.mjs
public/img/sharp.mjs
public/img/*.manipulated.webp
public/img/og.png
public/img/og.png
pages/changelog/index.md

49
website/changelog.js Normal file
View File

@ -0,0 +1,49 @@
import { writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
const packageName = '@napi-rs/image'
const locale = 'en'
const releases = await fetch(`https://api.github.com/repos/Brooooooklyn/Image/releases?per_page=100`, {
headers: { Authorization: `token ${process.env.GITHUB_TOKEN}` },
}).then((res) => res.json())
const changelog = releases
.filter(({ name }) => name?.startsWith(packageName))
.map((release) => {
const body = release.body
.replace(/&#39;/g, "'")
.replace(/@([a-zA-Z0-9_-]+)(?=(,| ))/g, '[@$1](https://github.com/$1)')
.replace(
/https:\/\/github\.com\/(\S+\/\S+\/pull\/\d+)/g,
`<a
href="$&"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">$1</a>`,
)
.replace(
/https:\/\/github\.com\/(.+?)\/(.+?)\/compare\/(.+?)@(.+?)\.\.\.(.+?)@(.+?)$/g,
`<a
href="$&"
target="_blank"
rel="noopener"
className="nx-text-primary-600">$3@$4...$5@$6</a>`,
)
return `## <a href="${release.html_url}" target="_blank" rel="noopener">${release.tag_name}</a>
${new Date(release.published_at).toLocaleDateString(locale)} \n${body}`
})
.join('\n\n')
await writeFile(
join(fileURLToPath(import.meta.url), '..', 'pages', 'changelog', 'index.md'),
`---
title: '@napi-rs/image'
description: '@napi-rs/image changelog.'
---
# @napi-rs/image
${changelog}`,
)

497
website/changelog.md Normal file
View File

@ -0,0 +1,497 @@
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.9.2" target="_blank" rel="noopener">@napi-rs/image@1.9.2</a>
4/20/2024
## What's Changed
* chore: remove libdeflater patch by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/89"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/89</a>
* chore: bump up Yarn to v4.1.1 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/90"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/90</a>
* chore: bump up electron version to v30 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/92"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/92</a>
* chore: bump up all non-major dependencies by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/91"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/91</a>
* chore: bump up @napi-rs/wasm-runtime version to ^0.2.0 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/93"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/93</a>
* refactor: use `no-const-enum` by [@kyranet](https://github.com/kyranet) in <a
href="https://github.com/Brooooooklyn/Image/pull/94"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/94</a>
## New Contributors
* [@kyranet](https://github.com/kyranet) made their first contribution in <a
href="https://github.com/Brooooooklyn/Image/pull/94"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/94</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.9.1...@napi-rs/image@1.9.2"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.9.1...@napi-rs/image@1.9.2</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.9.1" target="_blank" rel="noopener">@napi-rs/image@1.9.1</a>
2/22/2024
## What's Changed
* chore: bump up electron version to v29 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/87"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/87</a>
* fix(image): wasm fallback logic in js-binding file by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/88"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/88</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.9.0...@napi-rs/image@1.9.1"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.9.0...@napi-rs/image@1.9.1</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.9.0" target="_blank" rel="noopener">@napi-rs/image@1.9.0</a>
2/19/2024
## What's Changed
* docs: update examples and site by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/85"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/85</a>
* feat: upgrade resvg by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/86"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/86</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.8.0...@napi-rs/image@1.9.0"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.8.0...@napi-rs/image@1.9.0</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.8.0" target="_blank" rel="noopener">@napi-rs/image@1.8.0</a>
2/14/2024
## What's Changed
* chore: bump up all non-major dependencies by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/66"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/66</a>
* chore: upgrade dependencies and CI template by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/73"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/73</a>
* chore: Replace npm-run-all version with npm-run-all2 ^5.0.0 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/80"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/80</a>
* chore: bump up npm-run-all2 version to v6 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/82"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/82</a>
* feat: add wasm build by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/81"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/81</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.7.0...@napi-rs/image@1.8.0"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.7.0...@napi-rs/image@1.8.0</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.7.0" target="_blank" rel="noopener">@napi-rs/image@1.7.0</a>
9/27/2023
## 🚨Security update for CVE-2023-4863
- https://github.com/advisories/GHSA-j7hp-h8jx-5ppr
- https://blog.isosceles.com/the-webp-0day/
## What's Changed
* feat: upgrade dependencies by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/50"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/50</a>
* chore: bump up electron version to v26 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/58"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/58</a>
* chore: bump up Yarn to v3.6.2 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/59"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/59</a>
* chore: bump up Yarn to v3.6.3 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/60"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/60</a>
* chore: bump up actions/checkout action to v4 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/62"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/62</a>
* chore: bump up docker/setup-qemu-action action to v3 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/63"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/63</a>
* chore: bump up Rust crate mozjpeg-sys to v2 by [@renovate](https://github.com/renovate) in <a
href="https://github.com/Brooooooklyn/Image/pull/61"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/61</a>
* chore: upgrade dependencies by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/64"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/64</a>
## New Contributors
* [@renovate](https://github.com/renovate) made their first contribution in <a
href="https://github.com/Brooooooklyn/Image/pull/58"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/58</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.6.1...@napi-rs/image@1.7.0"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.6.1...@napi-rs/image@1.7.0</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.6.1" target="_blank" rel="noopener">@napi-rs/image@1.6.1</a>
3/12/2023
## What's Changed
* chore: bump Nextra to 2.2.16 by [@liby](https://github.com/liby) in <a
href="https://github.com/Brooooooklyn/Image/pull/45"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/45</a>
* docs: improve changelog parser by [@liby](https://github.com/liby) in <a
href="https://github.com/Brooooooklyn/Image/pull/46"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/46</a>
* fix(docs): typo correction by [@ggallon](https://github.com/ggallon) in <a
href="https://github.com/Brooooooklyn/Image/pull/47"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/47</a>
* perf(image): lazy load fontdb Database by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/49"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/49</a>
## New Contributors
* [@ggallon](https://github.com/ggallon) made their first contribution in <a
href="https://github.com/Brooooooklyn/Image/pull/47"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/47</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.6.0...@napi-rs/image@1.6.1"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.6.0...@napi-rs/image@1.6.1</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.6.0" target="_blank" rel="noopener">@napi-rs/image@1.6.0</a>
2/27/2023
## What's Changed
* change Buffer to Uint8Array in fromRgbaPixels by [@KhafraDev](https://github.com/KhafraDev) in <a
href="https://github.com/Brooooooklyn/Image/pull/41"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/41</a>
* feat(image): support Transformer from SVG by [@liby](https://github.com/liby) in <a
href="https://github.com/Brooooooklyn/Image/pull/44"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/44</a>
## New Contributors
* [@KhafraDev](https://github.com/KhafraDev) made their first contribution in <a
href="https://github.com/Brooooooklyn/Image/pull/41"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/41</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.5.1...@napi-rs/image@1.6.0"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.5.1...@napi-rs/image@1.6.0</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.5.1" target="_blank" rel="noopener">@napi-rs/image@1.5.1</a>
1/29/2023
## [1.5.1](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.5.0...@napi-rs/image@1.5.1) (2023-01-29)
### Bug Fixes
* **image:** update napi to fix electron create Buffer issues ([#39](https://github.com/Brooooooklyn/Image/issues/39)) ([e710222](https://github.com/Brooooooklyn/Image/commit/e7102224d67e390e0f897aea21a8da375676479d))
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.5.0" target="_blank" rel="noopener">@napi-rs/image@1.5.0</a>
1/17/2023
## Core updates
### Fast Resize
Powered by https://github.com/Cykooz/fast_image_resize
**Performance**
#### x86_64 (AVX2)
```
OS: Windows 11 x86_64
Kernel: 10.0.22621
CPU: AMD Ryzen 9 5950X (32) @ 3.400GHz
Memory: 2535MiB / 32055MiB
```
```
sharp resize: 415.966ms
@napi-rs/image resize: 529.884ms
fast resize: 316.731ms
```
#### ARM64 (NEON)
```
OS: macOS 13.1 22C65 arm64
Host: MacBookPro18,2
Kernel: 22.2.0
CPU: Apple M1 Max
Memory: 8915MiB / 65536MiB
```
```
sharp resize: 616.549ms
@napi-rs/image resize: 525.776ms
fast resize: 431.185ms
```
```js
const output = await new Transformer(NASA).fastResize({
width: 1024,
filter: FastResizeFilter.Lanczos3,
}).png()
```
We are keeping the `resize` API because the `ResizeFilter` algorithm is different between the `fast_image_resize` and `image` crates.
### overlay
```js
writeFileSync(
'output-overlay-png.png',
await new Transformer(PNG).overlay(PNG, 200, 200).png()
)
```
![image](https://user-images.githubusercontent.com/3468483/212720571-b8fa3a6e-e9a9-44b3-b80f-b765f09d2ce3.png)
## What's Changed
* chore: add issue form templates by [@liby](https://github.com/liby) in <a
href="https://github.com/Brooooooklyn/Image/pull/32"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/32</a>
* feat(image): implement `overlay` by [@liby](https://github.com/liby) in <a
href="https://github.com/Brooooooklyn/Image/pull/33"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/33</a>
* feat(image): provide fast resize method by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/34"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/34</a>
* perf(image): make overlay lazy by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/35"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/35</a>
## New Contributors
* [@liby](https://github.com/liby) made their first contribution in <a
href="https://github.com/Brooooooklyn/Image/pull/32"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/32</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.4.4...@napi-rs/image@1.5.0"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.4.4...@napi-rs/image@1.5.0</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.4.4" target="_blank" rel="noopener">@napi-rs/image@1.4.4</a>
1/3/2023
## What's Changed
* chore(image): fix android build by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/30"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/30</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.4.3...@napi-rs/image@1.4.4"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.4.3...@napi-rs/image@1.4.4</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.4.3" target="_blank" rel="noopener">@napi-rs/image@1.4.3</a>
1/3/2023
## What's Changed
* Update oxipng by [@Brooooooklyn](https://github.com/Brooooooklyn) in <a
href="https://github.com/Brooooooklyn/Image/pull/29"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">Brooooooklyn/Image/pull/29</a>
**Full Changelog**: <a
href="https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.4.2...@napi-rs/image@1.4.3"
target="_blank"
rel="noopener"
className="nx-text-primary-600">@napi-rs/image@1.4.2...@napi-rs/image@1.4.3</a>
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.4.2" target="_blank" rel="noopener">@napi-rs/image@1.4.2</a>
12/20/2022
## [1.4.2](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.4.1...@napi-rs/image@1.4.2) (2022-12-20)
### Bug Fixes
* **binding:** early return when input images are optimized ([#28](https://github.com/Brooooooklyn/Image/issues/28)) ([b695642](https://github.com/Brooooooklyn/Image/commit/b695642560e5aa43741e6a166119aa7b6d55145f))
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.4.1" target="_blank" rel="noopener">@napi-rs/image@1.4.1</a>
10/7/2022
## [1.4.1](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.4.0...@napi-rs/image@1.4.1) (2022-10-07)
**Note:** Version bump only for package @napi-rs/image
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.4.0" target="_blank" rel="noopener">@napi-rs/image@1.4.0</a>
8/23/2022
# [1.4.0](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.3.0...@napi-rs/image@1.4.0) (2022-08-23)
### Features
* **image:** upgrade libwebp to 0.7 ([#22](https://github.com/Brooooooklyn/Image/issues/22)) ([d3cde1c](https://github.com/Brooooooklyn/Image/commit/d3cde1c0e22bbd2b0e42ce604dcc668b6e364eb7))
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.3.0" target="_blank" rel="noopener">@napi-rs/image@1.3.0</a>
5/18/2022
# [1.3.0](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.2.0...@napi-rs/image@1.3.0) (2022-05-18)
### Features
* **image:** implement rawPixels and rawPixelsSync ([43e3938](https://github.com/Brooooooklyn/Image/commit/43e393860029cd3668aabf4d4362f8048faf4a6b))
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.2.0" target="_blank" rel="noopener">@napi-rs/image@1.2.0</a>
5/2/2022
# [1.2.0](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.1.2...@napi-rs/image@1.2.0) (2022-05-02)
### Features
* **image:** implement crop ([8bccc89](https://github.com/Brooooooklyn/Image/commit/8bccc89f54ede29897e156c01ce024ce9f13143b))
* **image:** support decode avif and webp ([#18](https://github.com/Brooooooklyn/Image/issues/18)) ([2813560](https://github.com/Brooooooklyn/Image/commit/2813560b9240c143d2c62fbea48d08918a9556af))
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.1.2" target="_blank" rel="noopener">@napi-rs/image@1.1.2</a>
4/22/2022
## [1.1.2](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.1.1...@napi-rs/image@1.1.2) (2022-04-22)
### Bug Fixes
* **image:** manipulate image has no effect ([e224c25](https://github.com/Brooooooklyn/Image/commit/e224c259d709bba704549ca34fa7851da41a6a3d))
* **image:** webp encode LumaA8 and Luma8 ([2473680](https://github.com/Brooooooklyn/Image/commit/24736809eaa38237bd618b5860b12ae0ebe91bd6))
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.1.1" target="_blank" rel="noopener">@napi-rs/image@1.1.1</a>
4/21/2022
## [1.1.1](https://github.com/Brooooooklyn/Image/compare/@napi-rs/image@1.1.0...@napi-rs/image@1.1.1) (2022-04-21)
### Bug Fixes
* **binding:** resize options and jpeg compress implementation ([b23c53b](https://github.com/Brooooooklyn/Image/commit/b23c53bf1085ef16b345a995fe130144dcf16a8f))
## <a href="https://github.com/Brooooooklyn/Image/releases/tag/%40napi-rs/image%401.1.0" target="_blank" rel="noopener">@napi-rs/image@1.1.0</a>
4/19/2022
# 1.1.0 (2022-04-19)
### Features
* async Transformer class ([#9](https://github.com/Brooooooklyn/Image/issues/9)) ([7cd00d4](https://github.com/Brooooooklyn/Image/commit/7cd00d41814fb4a683c8b26762bbea558ebb87e2))
* **image:** implement png_quantize ([66f5e0f](https://github.com/Brooooooklyn/Image/commit/66f5e0f2ef1e8c692c87963f63994e030203cf14))
* **image:** implement svg_min ([5b916b3](https://github.com/Brooooooklyn/Image/commit/5b916b3c3cb93582eb0cbfccdf6a14e2d4deea65))
* **image:** support more operations on Transformer ([af8ed99](https://github.com/Brooooooklyn/Image/commit/af8ed994b74a3c8493bd5597b490ac636574c8a2))
* **image:** support Transformer from raw rgba pixels ([8d49a8c](https://github.com/Brooooooklyn/Image/commit/8d49a8c4d3e5e04f0c9ff66a07a1620d01241d67))
* support avif ([81fc73a](https://github.com/Brooooooklyn/Image/commit/81fc73a7ec3632160fbf17264ff7ec9306c08710))
* support webp ([e90ecdc](https://github.com/Brooooooklyn/Image/commit/e90ecdc4b97630a390982e5420790390891ade7c))
* transform into monorepo ([#3](https://github.com/Brooooooklyn/Image/issues/3)) ([d0de72e](https://github.com/Brooooooklyn/Image/commit/d0de72e2a884476878f49539c8bf4e85a7e1b2d1))

View File

@ -1,46 +0,0 @@
import { useSSG } from 'nextra/ssg'
import { MDXRemote } from 'next-mdx-remote'
export const getChangelog = async (packageName, locale = 'en') => {
const releases = await fetch(`https://api.github.com/repos/Brooooooklyn/Image/releases?per_page=100`, {
headers: {
Authorization: `token ${process.env.GITHUB_TOKEN}`,
},
}).then((res) => res.json())
return {
props: {
ssg: releases
.filter(({ name }) => name?.startsWith(packageName))
.map((release) => {
const body = release.body
.replace(/&#39;/g, "'")
.replace(/@([a-zA-Z0-9_-]+)(?=(,| ))/g, '[@$1](https://github.com/$1)')
.replace(
/https:\/\/github\.com\/(\S+\/\S+\/pull\/\d+)/g,
`<a
href="$&"
target="_blank"
rel="noopener"
className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]">$1</a>`,
)
.replace(
/https:\/\/github\.com\/(.+?)\/(.+?)\/compare\/(.+?)@(.+?)\.\.\.(.+?)@(.+?)$/g,
`<a
href="$&"
target="_blank"
rel="noopener"
className="nx-text-primary-600">$3@$4...$5@$6</a>`,
)
return `## <a href="${release.html_url}" target="_blank" rel="noopener">${release.tag_name}</a>
${new Date(release.published_at).toLocaleDateString(locale)} \n${body}`
})
.join('\n\n'),
},
}
}
export function Changelog() {
const releases = useSSG()
return <MDXRemote {...releases} />
}

View File

@ -3,9 +3,9 @@ import nextra from 'nextra'
const withNextra = nextra({
theme: 'nextra-theme-docs',
themeConfig: './nextra.config.js',
staticImage: true,
staticImage: false,
latex: true,
flexsearch: {
search: {
codeblocks: false,
},
defaultShowCopyCode: true,

View File

@ -1,26 +1,15 @@
import { useRouter } from 'next/router'
import Script from 'next/script'
import { useConfig } from 'nextra-theme-docs'
/**
* @type {import('nextra-theme-docs').DocsThemeConfig}
*/
/** @type {import('nextra-theme-docs').DocsThemeConfig} */
export default {
docsRepositoryBase: 'https://github.com/Brooooooklyn/Image/blob/main/website/',
docsRepositoryBase: 'https://github.com/Brooooooklyn/Image/blob/main/website',
project: {
link: 'https://github.com/Brooooooklyn/Image',
},
chat: {
link: 'https://discord.gg/w8DAD7auZc',
},
useNextSeoProps() {
const { asPath } = useRouter()
if (asPath !== '/') {
return {
titleTemplate: '%s Image',
}
}
},
logo: () => {
return (
<>
@ -68,13 +57,8 @@ export default {
)
},
editLink: {
text: ({ locale }) => {
switch (locale) {
case 'cn':
return '在 GitHub 上编辑本页 →'
default:
return 'Edit this page on GitHub →'
}
text: () => {
return 'Edit this page on GitHub →'
},
},
footer: {

View File

@ -4,20 +4,18 @@
"version": "0.0.0",
"type": "module",
"dependencies": {
"@napi-rs/canvas": "^0.1.53",
"@napi-rs/canvas": "^0.1.72",
"@napi-rs/image": "^1.9.2",
"chalk": "^5.3.0",
"next": "^15.0.0",
"next-mdx-remote": "^5.0.0",
"nextra": "^2.13.4",
"nextra-theme-docs": "^2.13.4",
"node-fetch": "^3.3.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sharp": "^0.33.4"
"chalk": "^5.4.1",
"next": "^15.3.4",
"nextra": "^3",
"nextra-theme-docs": "^3",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"sharp": "^0.34.2"
},
"scripts": {
"build": "node generate-img.js && next build",
"build": "node generate-img.js && node changelog.js && next build",
"dev": "next dev",
"start": "next start"
}

6
website/pages/_meta.js Normal file
View File

@ -0,0 +1,6 @@
export default {
'*': { theme: { breadcrumb: false } },
index: { title: 'Introduction', display: 'hidden', theme: { sidebar: false } },
docs: { title: 'Docs', type: 'page' },
changelog: { title: 'Changelog', type: 'page' },
}

View File

@ -1,22 +0,0 @@
{
"*": {
"theme": {
"breadcrumb": false
}
},
"index": {
"title": "Introduction",
"display": "hidden",
"theme": {
"sidebar": false
}
},
"docs": {
"title": "Docs",
"type": "page"
},
"changelog": {
"title": "Changelog",
"type": "page"
}
}

View File

@ -0,0 +1,7 @@
export default {
'index': {
theme: {
sidebar: false,
}
}
}

View File

@ -1,7 +0,0 @@
{
"*": {
"theme": {
"sidebar": false
}
}
}

View File

@ -1,23 +0,0 @@
---
title: '@napi-rs/image'
description: '@napi-rs/image changelog.'
---
import { Changelog, getChangelog } from '../../components/changelog-generator'
import { serialize } from 'next-mdx-remote/serialize'
# @napi-rs/image
export const getStaticProps = async () => {
const {
props: { ssg },
} = await getChangelog('@napi-rs/image')
const mdx = await serialize(ssg)
return {
props: {
ssg: mdx,
},
}
}
<Changelog />

View File

@ -0,0 +1,4 @@
export default {
index: 'Documentation',
credits: 'Credits',
}

View File

@ -1,4 +0,0 @@
{
"index": "Documentation",
"credits": "Credits"
}

View File

@ -376,7 +376,7 @@ const imageOutputWithoutRotateWebp = await new Transformer(WITH_EXIF).resize(450
writeFileSync('output-exif.no-rotate.image.webp', imageOutputWithoutRotateWebp)
```
![output-exif.no-rotate.image.webp](../../public/img/output-exif.no-rotate.image.webp)
![output-exif.no-rotate.image.webp](/img/output-exif.no-rotate.image.webp)
With rotate:
@ -397,7 +397,7 @@ console.timeEnd('@napi-rs/image webp')
writeFileSync('output-exif.image.webp', imageOutputWebp)
```
![output-exif.image.webp](../../public/img/output-exif.image.webp)
![output-exif.image.webp](/img/output-exif.image.webp)
#### `grayscale`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

7355
yarn.lock

File diff suppressed because it is too large Load Diff