Skip to content

Commit

Permalink
Update to latest dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
huming2207 committed Oct 15, 2024
1 parent 1eae874 commit 1c4e4ae
Show file tree
Hide file tree
Showing 9 changed files with 5,755 additions and 12,011 deletions.
368 changes: 176 additions & 192 deletions .github/workflows/CI.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ napi = { version = "2", default-features = false, features = [
"chrono_date"
]}
napi-derive = { version = "2", features = ["type-def"] }
image = "0.23.14"
image = "0.25"
serde = "1"
serde_derive = "1"
serde_json = "1"
Expand Down
13 changes: 5 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* tslint:disable */
/* eslint-disable */

export class ExternalObject<T> {
readonly '': {
readonly '': unique symbol
[K: symbol]: T
}
}
export function to4Bpp(
/* auto-generated by NAPI-RS */

export declare function to4Bpp(
image: Buffer,
format?: string | undefined | null,
signal?: AbortSignal | undefined | null,
): Promise<Buffer>
export function toMonochrome(
export declare function toMonochrome(
image: Buffer,
format?: string | undefined | null,
signal?: AbortSignal | undefined | null,
Expand Down
132 changes: 112 additions & 20 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,62 @@
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */

/* auto-generated by NAPI-RS */

const { existsSync, readFileSync } = require('fs')
const { join } = require('path')

const { platform, arch } = process

let nativeBinding = null
let localFileExisted = false
let isMusl = false
let loadError = null

switch (platform) {
case 'android':
if (arch !== 'arm64') {
throw new Error(`Unsupported architecture on Android ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'epaperify.android-arm64.node'))
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.android-arm64.node')
} else {
nativeBinding = require('epaperify-android-arm64')
}
const lddPath = require('child_process').execSync('which ldd').toString().trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
loadError = e
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}

switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'epaperify.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.android-arm64.node')
} else {
nativeBinding = require('epaperify-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'epaperify.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.android-arm-eabi.node')
} else {
nativeBinding = require('epaperify-android-arm-eabi')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Android ${arch}`)
}
break
case 'win32':
Expand Down Expand Up @@ -67,6 +102,15 @@ switch (platform) {
}
break
case 'darwin':
localFileExisted = existsSync(join(__dirname, 'epaperify.darwin-universal.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.darwin-universal.node')
} else {
nativeBinding = require('epaperify-darwin-universal')
}
break
} catch {}
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'epaperify.darwin-x64.node'))
Expand Down Expand Up @@ -114,8 +158,7 @@ switch (platform) {
case 'linux':
switch (arch) {
case 'x64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-x64-musl.node'))
try {
if (localFileExisted) {
Expand All @@ -140,8 +183,7 @@ switch (platform) {
}
break
case 'arm64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-arm64-musl.node'))
try {
if (localFileExisted) {
Expand All @@ -166,12 +208,62 @@ switch (platform) {
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-arm-gnueabihf.node'))
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-arm-musleabihf.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.linux-arm-musleabihf.node')
} else {
nativeBinding = require('epaperify-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-arm-gnueabihf.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('epaperify-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-riscv64-musl.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.linux-riscv64-musl.node')
} else {
nativeBinding = require('epaperify-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-riscv64-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.linux-riscv64-gnu.node')
} else {
nativeBinding = require('epaperify-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(join(__dirname, 'epaperify.linux-s390x-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./epaperify.linux-arm-gnueabihf.node')
nativeBinding = require('./epaperify.linux-s390x-gnu.node')
} else {
nativeBinding = require('epaperify-linux-arm-gnueabihf')
nativeBinding = require('epaperify-linux-s390x-gnu')
}
} catch (e) {
loadError = e
Expand Down
Loading

0 comments on commit 1c4e4ae

Please sign in to comment.