Compare commits
5 Commits
llm_test/a
...
feature/ni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0ad2848ba | ||
|
|
b079d98908 | ||
|
|
1c731e11fd | ||
|
|
8e6af0cd74 | ||
|
|
835137fa30 |
115
.github/workflows/npm.yml
vendored
115
.github/workflows/npm.yml
vendored
@@ -31,38 +31,82 @@ jobs:
|
||||
- host: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
|
||||
build: yarn build --target x86_64-unknown-linux-gnu
|
||||
build: |
|
||||
set -e &&
|
||||
rustup toolchain install 1.90.0 &&
|
||||
rustup default 1.90.0 &&
|
||||
yarn build --target x86_64-unknown-linux-gnu
|
||||
- host: ubuntu-latest
|
||||
target: x86_64-unknown-linux-musl
|
||||
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||
build: yarn build --target x86_64-unknown-linux-musl
|
||||
build: |
|
||||
set -e &&
|
||||
rustup toolchain install 1.90.0 &&
|
||||
rustup default 1.90.0 &&
|
||||
yarn build --target x86_64-unknown-linux-musl
|
||||
- host: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
build: yarn build --target aarch64-apple-darwin
|
||||
build: |
|
||||
set -e &&
|
||||
rustup toolchain install 1.90.0 &&
|
||||
rustup default 1.90.0 &&
|
||||
yarn build --target aarch64-apple-darwin
|
||||
- host: ubuntu-latest
|
||||
target: aarch64-unknown-linux-gnu
|
||||
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
|
||||
build: yarn build --target aarch64-unknown-linux-gnu
|
||||
build: |
|
||||
set -e &&
|
||||
rustup toolchain install 1.90.0 &&
|
||||
rustup default 1.90.0 &&
|
||||
rustup target add aarch64-unknown-linux-gnu &&
|
||||
yarn build --target aarch64-unknown-linux-gnu
|
||||
- host: ubuntu-latest
|
||||
target: armv7-unknown-linux-gnueabihf
|
||||
setup: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-arm-linux-gnueabihf -y
|
||||
build: yarn build --target armv7-unknown-linux-gnueabihf
|
||||
- host: ubuntu-latest
|
||||
target: armv7-unknown-linux-musleabihf
|
||||
build: yarn build --target armv7-unknown-linux-musleabihf
|
||||
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
|
||||
build: |
|
||||
set -e
|
||||
rustup toolchain install 1.90.0
|
||||
rustup default 1.90.0
|
||||
export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc
|
||||
export AR_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar
|
||||
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
|
||||
export PKG_CONFIG_ALLOW_CROSS=1
|
||||
yarn build --target armv7-unknown-linux-gnueabihf
|
||||
# - host: ubuntu-latest
|
||||
# target: armv7-unknown-linux-musleabihf
|
||||
# build: |
|
||||
# set -e
|
||||
# rustup toolchain install 1.90.0
|
||||
# rustup default 1.90.0
|
||||
# # Use Zig as the MUSL cross C toolchain
|
||||
# export CC_armv7_unknown_linux_musleabihf="zig cc -target armv7-linux-musleabihf -mfpu=vfpv3-d16 -mfloat-abi=hard"
|
||||
# export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER="zig cc -target armv7-linux-musleabihf -mfpu=vfpv3-d16 -mfloat-abi=hard"
|
||||
# export AR_armv7_unknown_linux_musleabihf="zig ar"
|
||||
# export PKG_CONFIG_ALLOW_CROSS=1
|
||||
# yarn build --target armv7-unknown-linux-musleabihf
|
||||
- host: ubuntu-latest
|
||||
target: aarch64-linux-android
|
||||
build: yarn build --target aarch64-linux-android
|
||||
build: |
|
||||
set -e &&
|
||||
rustup toolchain install 1.90.0 &&
|
||||
rustup default 1.90.0 &&
|
||||
yarn build --target aarch64-linux-android
|
||||
- host: ubuntu-latest
|
||||
target: armv7-linux-androideabi
|
||||
build: yarn build --target armv7-linux-androideabi
|
||||
build: |
|
||||
set -e &&
|
||||
rustup toolchain install 1.90.0 &&
|
||||
rustup default 1.90.0 &&
|
||||
yarn build --target armv7-linux-androideabi
|
||||
- host: ubuntu-latest
|
||||
target: aarch64-unknown-linux-musl
|
||||
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||
build: |-
|
||||
set -e &&
|
||||
rustup toolchain install 1.90.0 &&
|
||||
rustup default 1.90.0 &&
|
||||
rustup target add aarch64-unknown-linux-musl &&
|
||||
yarn build --target aarch64-unknown-linux-musl
|
||||
- host: windows-latest
|
||||
@@ -92,7 +136,7 @@ jobs:
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
if: ${{ !matrix.settings.docker }}
|
||||
with:
|
||||
toolchain: stable
|
||||
toolchain: 1.90.0
|
||||
targets: ${{ matrix.settings.target }}
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v4
|
||||
@@ -144,7 +188,6 @@ jobs:
|
||||
- host: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
node:
|
||||
- '18'
|
||||
- '20'
|
||||
runs-on: ${{ matrix.settings.host }}
|
||||
defaults:
|
||||
@@ -179,7 +222,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
- '18'
|
||||
- '20'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
@@ -213,7 +255,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
- '18'
|
||||
- '20'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
@@ -249,7 +290,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
- '18'
|
||||
- '20'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
@@ -320,48 +360,6 @@ jobs:
|
||||
run: |
|
||||
set -e
|
||||
yarn test
|
||||
test-linux-arm-gnueabihf-binding:
|
||||
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
|
||||
needs:
|
||||
- build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
- '18'
|
||||
- '20'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./bindings/nodejs
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bindings-armv7-unknown-linux-gnueabihf
|
||||
path: bindings/nodejs/
|
||||
- name: List packages
|
||||
run: ls -R .
|
||||
shell: bash
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn config set supportedArchitectures.cpu "arm"
|
||||
yarn install
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: arm
|
||||
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
- name: Setup and run tests
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: node:${{ matrix.node }}-bullseye-slim
|
||||
options: '--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build/bindings/nodejs'
|
||||
run: |
|
||||
set -e
|
||||
yarn test
|
||||
ls -la
|
||||
universal-macOS:
|
||||
name: Build universal macOS binary
|
||||
needs:
|
||||
@@ -410,7 +408,6 @@ jobs:
|
||||
- test-linux-x64-musl-binding
|
||||
- test-linux-aarch64-gnu-binding
|
||||
- test-linux-aarch64-musl-binding
|
||||
- test-linux-arm-gnueabihf-binding
|
||||
- universal-macOS
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
74
Cargo.lock
generated
74
Cargo.lock
generated
@@ -218,9 +218,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.6.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
|
||||
checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
@@ -288,14 +288,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.2.9"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501"
|
||||
checksum = "67773048316103656a637612c4a62477603b777d91d9c62ff2290f9cde178fdb"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"ctor-proc-macro",
|
||||
"dtor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor-proc-macro"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2"
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.3.11"
|
||||
@@ -316,6 +322,21 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtor"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e58a0764cddb55ab28955347b45be00ade43d4d6f3ba4bf3dc354e4ec9432934"
|
||||
dependencies = [
|
||||
"dtor-proc-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtor-proc-macro"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.10.0"
|
||||
@@ -537,33 +558,34 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "napi"
|
||||
version = "2.16.13"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "214f07a80874bb96a8433b3cdfc84980d56c7b02e1a0d7ba4ba0db5cef785e2b"
|
||||
checksum = "f1b74e3dce5230795bb4d2821b941706dee733c7308752507254b0497f39cad7"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"ctor",
|
||||
"napi-derive",
|
||||
"napi-build",
|
||||
"napi-sys",
|
||||
"once_cell",
|
||||
"nohash-hasher",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "napi-build"
|
||||
version = "2.1.4"
|
||||
version = "2.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db836caddef23662b94e16bf1f26c40eceb09d6aee5d5b06a7ac199320b69b19"
|
||||
checksum = "dcae8ad5609d14afb3a3b91dee88c757016261b151e9dcecabf1b2a31a6cab14"
|
||||
|
||||
[[package]]
|
||||
name = "napi-derive"
|
||||
version = "2.16.13"
|
||||
version = "3.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cbe2585d8ac223f7d34f13701434b9d5f4eb9c332cccce8dee57ea18ab8ab0c"
|
||||
checksum = "7552d5a579b834614bbd496db5109f1b9f1c758f08224b0dee1e408333adf0d0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"convert_case",
|
||||
"ctor",
|
||||
"napi-derive-backend",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -572,28 +594,32 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "napi-derive-backend"
|
||||
version = "1.0.75"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1639aaa9eeb76e91c6ae66da8ce3e89e921cd3885e99ec85f4abacae72fc91bf"
|
||||
checksum = "5f6a81ac7486b70f2532a289603340862c06eea5a1e650c1ffeda2ce1238516a"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"semver",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "napi-sys"
|
||||
version = "2.4.0"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3"
|
||||
checksum = "3e4e7135a8f97aa0f1509cce21a8a1f9dcec1b50d8dee006b48a5adb69a9d64d"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nohash-hasher"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
@@ -871,6 +897,12 @@ version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.21"
|
||||
|
||||
@@ -8,8 +8,8 @@ crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
|
||||
napi = { version = "2.12.2", default-features = false, features = ["napi4", "serde-json"] }
|
||||
napi-derive = "2.12.2"
|
||||
napi = { version = "3.3", default-features = false, features = ["napi4", "serde-json"] }
|
||||
napi-derive = "3.2"
|
||||
ironcalc = { path = "../../xlsx", version = "0.6.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
|
||||
16
bindings/nodejs/index.d.ts
vendored
16
bindings/nodejs/index.d.ts
vendored
@@ -1,8 +1,5 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
/* eslint-disable */
|
||||
export declare class Model {
|
||||
constructor(name: string, locale: string, timezone: string)
|
||||
static fromXlsx(filePath: string, locale: string, tz: string): Model
|
||||
@@ -39,8 +36,10 @@ export declare class Model {
|
||||
newDefinedName(name: string, scope: number | undefined | null, formula: string): void
|
||||
updateDefinedName(name: string, scope: number | undefined | null, newName: string, newScope: number | undefined | null, newFormula: string): void
|
||||
deleteDefinedName(name: string, scope?: number | undefined | null): void
|
||||
testPanic(): void
|
||||
moveColumn(sheet: number, column: number, delta: number): void
|
||||
moveRow(sheet: number, row: number, delta: number): void
|
||||
}
|
||||
|
||||
export declare class UserModel {
|
||||
constructor(name: string, locale: string, timezone: string)
|
||||
static fromBytes(bytes: Uint8Array): UserModel
|
||||
@@ -59,12 +58,13 @@ export declare class UserModel {
|
||||
setSheetColor(sheet: number, color: string): void
|
||||
rangeClearAll(sheet: number, startRow: number, startColumn: number, endRow: number, endColumn: number): void
|
||||
rangeClearContents(sheet: number, startRow: number, startColumn: number, endRow: number, endColumn: number): void
|
||||
rangeClearFormatting(sheet: number, startRow: number, startColumn: number, endRow: number, endColumn: number): void
|
||||
insertRows(sheet: number, row: number, rowCount: number): void
|
||||
insertColumns(sheet: number, column: number, columnCount: number): void
|
||||
deleteRows(sheet: number, row: number, rowCount: number): void
|
||||
deleteColumns(sheet: number, column: number, columnCount: number): void
|
||||
setRowHeight(sheet: number, row: number, height: number): void
|
||||
setColumnWidth(sheet: number, column: number, width: number): void
|
||||
setRowsHeight(sheet: number, rowStart: number, rowEnd: number, height: number): void
|
||||
setColumnsWidth(sheet: number, columnStart: number, columnEnd: number, width: number): void
|
||||
getRowHeight(sheet: number, row: number): number
|
||||
getColumnWidth(sheet: number, column: number): number
|
||||
setUserInput(sheet: number, row: number, column: number, input: string): void
|
||||
@@ -112,4 +112,6 @@ export declare class UserModel {
|
||||
newDefinedName(name: string, scope: number | undefined | null, formula: string): void
|
||||
updateDefinedName(name: string, scope: number | undefined | null, newName: string, newScope: number | undefined | null, newFormula: string): void
|
||||
deleteDefinedName(name: string, scope?: number | undefined | null): void
|
||||
moveColumn(sheet: number, column: number, delta: number): void
|
||||
moveRow(sheet: number, row: number, delta: number): void
|
||||
}
|
||||
|
||||
@@ -1,316 +1,579 @@
|
||||
/* tslint:disable */
|
||||
// prettier-ignore
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
|
||||
// @ts-nocheck
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
const { existsSync, readFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
|
||||
const { platform, arch } = process
|
||||
const { createRequire } = require('node:module')
|
||||
require = createRequire(__filename)
|
||||
|
||||
const { readFileSync } = require('node:fs')
|
||||
let nativeBinding = null
|
||||
let localFileExisted = false
|
||||
let loadError = null
|
||||
const loadErrors = []
|
||||
|
||||
function isMusl() {
|
||||
// For Node 10
|
||||
if (!process.report || typeof process.report.getReport !== 'function') {
|
||||
try {
|
||||
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
||||
return readFileSync(lddPath, 'utf8').includes('musl')
|
||||
} catch (e) {
|
||||
return true
|
||||
const isMusl = () => {
|
||||
let musl = false
|
||||
if (process.platform === 'linux') {
|
||||
musl = isMuslFromFilesystem()
|
||||
if (musl === null) {
|
||||
musl = isMuslFromReport()
|
||||
}
|
||||
} else {
|
||||
const { glibcVersionRuntime } = process.report.getReport().header
|
||||
return !glibcVersionRuntime
|
||||
if (musl === null) {
|
||||
musl = isMuslFromChildProcess()
|
||||
}
|
||||
}
|
||||
return musl
|
||||
}
|
||||
|
||||
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
||||
|
||||
const isMuslFromFilesystem = () => {
|
||||
try {
|
||||
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
switch (platform) {
|
||||
case 'android':
|
||||
switch (arch) {
|
||||
case 'arm64':
|
||||
localFileExisted = existsSync(join(__dirname, 'nodejs.android-arm64.node'))
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.android-arm64.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-android-arm64')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
break
|
||||
case 'arm':
|
||||
localFileExisted = existsSync(join(__dirname, 'nodejs.android-arm-eabi.node'))
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.android-arm-eabi.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-android-arm-eabi')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unsupported architecture on Android ${arch}`)
|
||||
const isMuslFromReport = () => {
|
||||
let report = null
|
||||
if (typeof process.report?.getReport === 'function') {
|
||||
process.report.excludeNetwork = true
|
||||
report = process.report.getReport()
|
||||
}
|
||||
if (!report) {
|
||||
return null
|
||||
}
|
||||
if (report.header && report.header.glibcVersionRuntime) {
|
||||
return false
|
||||
}
|
||||
if (Array.isArray(report.sharedObjects)) {
|
||||
if (report.sharedObjects.some(isFileMusl)) {
|
||||
return true
|
||||
}
|
||||
break
|
||||
case 'win32':
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.win32-x64-msvc.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.win32-x64-msvc.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-win32-x64-msvc')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
break
|
||||
case 'ia32':
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.win32-ia32-msvc.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.win32-ia32-msvc.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-win32-ia32-msvc')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
break
|
||||
case 'arm64':
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.win32-arm64-msvc.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.win32-arm64-msvc.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-win32-arm64-msvc')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
||||
}
|
||||
break
|
||||
case 'darwin':
|
||||
localFileExisted = existsSync(join(__dirname, 'nodejs.darwin-universal.node'))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const isMuslFromChildProcess = () => {
|
||||
try {
|
||||
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
||||
} catch (e) {
|
||||
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function requireNative() {
|
||||
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.darwin-universal.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-darwin-universal')
|
||||
return 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('./nodejs.android-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
break
|
||||
} catch {}
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
localFileExisted = existsSync(join(__dirname, 'nodejs.darwin-x64.node'))
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.darwin-x64.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-darwin-x64')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-android-arm64')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-android-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
break
|
||||
case 'arm64':
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.darwin-arm64.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.darwin-arm64.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-darwin-arm64')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./nodejs.android-arm-eabi.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-android-arm-eabi')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-android-arm-eabi/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
||||
}
|
||||
break
|
||||
case 'freebsd':
|
||||
if (arch !== 'x64') {
|
||||
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
||||
} else if (process.platform === 'win32') {
|
||||
if (process.arch === 'x64') {
|
||||
if (process.report?.getReport?.()?.header?.osName?.startsWith?.('MINGW')) {
|
||||
try {
|
||||
return require('./nodejs.win32-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-win32-x64-gnu')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-win32-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./nodejs.win32-x64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-win32-x64-msvc')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-win32-x64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ia32') {
|
||||
try {
|
||||
return require('./nodejs.win32-ia32-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-win32-ia32-msvc')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-win32-ia32-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./nodejs.win32-arm64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-win32-arm64-msvc')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-win32-arm64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
||||
}
|
||||
localFileExisted = existsSync(join(__dirname, 'nodejs.freebsd-x64.node'))
|
||||
} else if (process.platform === 'darwin') {
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.freebsd-x64.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-freebsd-x64')
|
||||
}
|
||||
return require('./nodejs.darwin-universal.node')
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
loadErrors.push(e)
|
||||
}
|
||||
break
|
||||
case 'linux':
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
if (isMusl()) {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-x64-musl.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-x64-musl.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-x64-musl')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
} else {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-x64-gnu.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-x64-gnu.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-x64-gnu')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-darwin-universal')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-darwin-universal/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./nodejs.darwin-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-darwin-x64')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-darwin-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
break
|
||||
case 'arm64':
|
||||
if (isMusl()) {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-arm64-musl.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-arm64-musl.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-arm64-musl')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
} else {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-arm64-gnu.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-arm64-gnu.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-arm64-gnu')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./nodejs.darwin-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-darwin-arm64')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-darwin-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
break
|
||||
case 'arm':
|
||||
if (isMusl()) {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-arm-musleabihf.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-arm-musleabihf.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-arm-musleabihf')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
} else {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-arm-gnueabihf.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-arm-gnueabihf.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-arm-gnueabihf')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'freebsd') {
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./nodejs.freebsd-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-freebsd-x64')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-freebsd-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
break
|
||||
case 'riscv64':
|
||||
if (isMusl()) {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-riscv64-musl.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-riscv64-musl.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-riscv64-musl')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
} else {
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-riscv64-gnu.node')
|
||||
)
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-riscv64-gnu.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-riscv64-gnu')
|
||||
}
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./nodejs.freebsd-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-freebsd-arm64')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-freebsd-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
break
|
||||
case 's390x':
|
||||
localFileExisted = existsSync(
|
||||
join(__dirname, 'nodejs.linux-s390x-gnu.node')
|
||||
)
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'linux') {
|
||||
if (process.arch === 'x64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
if (localFileExisted) {
|
||||
nativeBinding = require('./nodejs.linux-s390x-gnu.node')
|
||||
} else {
|
||||
nativeBinding = require('@ironcalc/nodejs-linux-s390x-gnu')
|
||||
}
|
||||
return require('./nodejs.linux-x64-musl.node')
|
||||
} catch (e) {
|
||||
loadError = e
|
||||
loadErrors.push(e)
|
||||
}
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-x64-musl')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-x64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./nodejs.linux-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-x64-gnu')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./nodejs.linux-arm64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-arm64-musl')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-arm64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./nodejs.linux-arm64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-arm64-gnu')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-arm64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./nodejs.linux-arm-musleabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-arm-musleabihf')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-arm-musleabihf/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./nodejs.linux-arm-gnueabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-arm-gnueabihf')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-arm-gnueabihf/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'loong64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./nodejs.linux-loong64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-loong64-musl')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-loong64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./nodejs.linux-loong64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-loong64-gnu')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-loong64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'riscv64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./nodejs.linux-riscv64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-riscv64-musl')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-riscv64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./nodejs.linux-riscv64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-riscv64-gnu')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-riscv64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ppc64') {
|
||||
try {
|
||||
return require('./nodejs.linux-ppc64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-ppc64-gnu')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-ppc64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 's390x') {
|
||||
try {
|
||||
return require('./nodejs.linux-s390x-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-linux-s390x-gnu')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-linux-s390x-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
||||
}
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
||||
} else if (process.platform === 'openharmony') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./nodejs.openharmony-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-openharmony-arm64')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-openharmony-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./nodejs.openharmony-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-openharmony-x64')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-openharmony-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./nodejs.openharmony-arm.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@ironcalc/nodejs-openharmony-arm')
|
||||
const bindingPackageVersion = require('@ironcalc/nodejs-openharmony-arm/package.json').version
|
||||
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
||||
}
|
||||
}
|
||||
|
||||
nativeBinding = requireNative()
|
||||
|
||||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
let wasiBinding = null
|
||||
let wasiBindingError = null
|
||||
try {
|
||||
wasiBinding = require('./nodejs.wasi.cjs')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
wasiBindingError = err
|
||||
}
|
||||
}
|
||||
if (!nativeBinding) {
|
||||
try {
|
||||
wasiBinding = require('@ironcalc/nodejs-wasm32-wasi')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
wasiBindingError.cause = err
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
||||
error.cause = wasiBindingError
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding) {
|
||||
if (loadError) {
|
||||
throw loadError
|
||||
if (loadErrors.length > 0) {
|
||||
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.reduce((err, cur) => {
|
||||
cur.cause = err
|
||||
return cur
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
throw new Error(`Failed to load native binding`)
|
||||
}
|
||||
|
||||
const { Model, UserModel } = nativeBinding
|
||||
|
||||
module.exports.Model = Model
|
||||
module.exports.UserModel = UserModel
|
||||
module.exports = nativeBinding
|
||||
module.exports.Model = nativeBinding.Model
|
||||
module.exports.UserModel = nativeBinding.UserModel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-android-arm-eabi",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-android-arm64",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-darwin-arm64",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-darwin-universal",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-darwin-x64",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-linux-arm-gnueabihf",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-linux-arm-musleabihf",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-linux-arm64-gnu",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-linux-arm64-musl",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-linux-riscv64-gnu",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-linux-x64-gnu",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-linux-x64-musl",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-win32-arm64-msvc",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs-win32-x64-msvc",
|
||||
"version": "0.2.0",
|
||||
"version": "0.6.0",
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
|
||||
2215
bindings/nodejs/package-lock.json
generated
2215
bindings/nodejs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,27 @@
|
||||
{
|
||||
"name": "@ironcalc/nodejs",
|
||||
"version": "0.5.1",
|
||||
"version": "0.6.0",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"napi": {
|
||||
"name": "nodejs",
|
||||
"triples": {
|
||||
"additional": [
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-linux-android",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"aarch64-unknown-linux-musl",
|
||||
"aarch64-pc-windows-msvc",
|
||||
"armv7-unknown-linux-gnueabihf",
|
||||
"armv7-unknown-linux-musleabihf",
|
||||
"x86_64-unknown-linux-musl",
|
||||
"armv7-linux-androideabi",
|
||||
"universal-apple-darwin",
|
||||
"riscv64gc-unknown-linux-gnu"
|
||||
]
|
||||
}
|
||||
"binaryName": "nodejs",
|
||||
"targets": [
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-linux-android",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"aarch64-unknown-linux-musl",
|
||||
"aarch64-pc-windows-msvc",
|
||||
"armv7-unknown-linux-gnueabihf",
|
||||
"armv7-unknown-linux-musleabihf",
|
||||
"x86_64-unknown-linux-musl",
|
||||
"armv7-linux-androideabi",
|
||||
"universal-apple-darwin",
|
||||
"riscv64gc-unknown-linux-gnu"
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "^2.18.4",
|
||||
"@napi-rs/cli": "^3.3",
|
||||
"ava": "^6.0.1"
|
||||
},
|
||||
"ava": {
|
||||
@@ -38,7 +36,7 @@
|
||||
"build:debug": "napi build --platform",
|
||||
"prepublishOnly": "napi prepublish -t npm",
|
||||
"test": "ava",
|
||||
"universal": "napi universal",
|
||||
"universal": "napi universalize",
|
||||
"version": "napi version"
|
||||
}
|
||||
}
|
||||
}
|
||||
1359
bindings/nodejs/pnpm-lock.yaml
generated
1359
bindings/nodejs/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#![deny(clippy::all)]
|
||||
|
||||
use napi::{self, bindgen_prelude::*, JsUnknown, Result};
|
||||
use napi::{self, bindgen_prelude::*, Result, Unknown};
|
||||
use serde::Serialize;
|
||||
|
||||
use ironcalc::{
|
||||
@@ -127,7 +127,7 @@ impl Model {
|
||||
sheet: u32,
|
||||
row: i32,
|
||||
column: i32,
|
||||
style: JsUnknown,
|
||||
style: Unknown,
|
||||
) -> Result<()> {
|
||||
let style: Style = env
|
||||
.from_js_value(style)
|
||||
@@ -140,12 +140,12 @@ impl Model {
|
||||
|
||||
#[napi(js_name = "getCellStyle")]
|
||||
pub fn get_cell_style(
|
||||
&mut self,
|
||||
&'_ self,
|
||||
env: Env,
|
||||
sheet: u32,
|
||||
row: i32,
|
||||
column: i32,
|
||||
) -> Result<JsUnknown> {
|
||||
) -> Result<Unknown<'_>> {
|
||||
let style = self
|
||||
.model
|
||||
.get_style_for_cell(sheet, row, column)
|
||||
@@ -246,11 +246,11 @@ impl Model {
|
||||
.map_err(to_js_error)
|
||||
}
|
||||
|
||||
// I don't _think_ serializing to JsUnknown can't fail
|
||||
// I don't _think_ serializing to Unknown can't fail
|
||||
// FIXME: Remove this clippy directive
|
||||
#[napi(js_name = "getWorksheetsProperties")]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
pub fn get_worksheets_properties(&self, env: Env) -> JsUnknown {
|
||||
pub fn get_worksheets_properties(&'_ self, env: Env) -> Unknown<'_> {
|
||||
env
|
||||
.to_js_value(&self.model.get_worksheets_properties())
|
||||
.unwrap()
|
||||
@@ -288,7 +288,7 @@ impl Model {
|
||||
}
|
||||
|
||||
#[napi(js_name = "getDefinedNameList")]
|
||||
pub fn get_defined_name_list(&self, env: Env) -> Result<JsUnknown> {
|
||||
pub fn get_defined_name_list(&'_ self, env: Env) -> Result<Unknown<'_>> {
|
||||
let data: Vec<DefinedName> = self
|
||||
.model
|
||||
.workbook
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use napi::{self, bindgen_prelude::*, JsUnknown, Result};
|
||||
use napi::{self, bindgen_prelude::*, Result, Unknown};
|
||||
|
||||
use ironcalc::base::{
|
||||
expressions::types::Area,
|
||||
@@ -305,7 +305,7 @@ impl UserModel {
|
||||
pub fn update_range_style(
|
||||
&mut self,
|
||||
env: Env,
|
||||
range: JsUnknown,
|
||||
range: Unknown,
|
||||
style_path: String,
|
||||
value: String,
|
||||
) -> Result<()> {
|
||||
@@ -320,12 +320,12 @@ impl UserModel {
|
||||
|
||||
#[napi(js_name = "getCellStyle")]
|
||||
pub fn get_cell_style(
|
||||
&mut self,
|
||||
&'_ mut self,
|
||||
env: Env,
|
||||
sheet: u32,
|
||||
row: i32,
|
||||
column: i32,
|
||||
) -> Result<JsUnknown> {
|
||||
) -> Result<Unknown<'_>> {
|
||||
let style = self
|
||||
.model
|
||||
.get_cell_style(sheet, row, column)
|
||||
@@ -337,7 +337,7 @@ impl UserModel {
|
||||
}
|
||||
|
||||
#[napi(js_name = "onPasteStyles")]
|
||||
pub fn on_paste_styles(&mut self, env: Env, styles: JsUnknown) -> Result<()> {
|
||||
pub fn on_paste_styles(&mut self, env: Env, styles: Unknown) -> Result<()> {
|
||||
let styles: &Vec<Vec<Style>> = &env
|
||||
.from_js_value(styles)
|
||||
.map_err(|e| to_js_error(e.to_string()))?;
|
||||
@@ -362,11 +362,11 @@ impl UserModel {
|
||||
)
|
||||
}
|
||||
|
||||
// I don't _think_ serializing to JsUnknown can't fail
|
||||
// I don't _think_ serializing to Unknown can't fail
|
||||
// FIXME: Remove this clippy directive
|
||||
#[napi(js_name = "getWorksheetsProperties")]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
pub fn get_worksheets_properties(&self, env: Env) -> JsUnknown {
|
||||
pub fn get_worksheets_properties(&'_ self, env: Env) -> Unknown<'_> {
|
||||
env
|
||||
.to_js_value(&self.model.get_worksheets_properties())
|
||||
.unwrap()
|
||||
@@ -383,11 +383,11 @@ impl UserModel {
|
||||
vec![sheet as i32, row, column]
|
||||
}
|
||||
|
||||
// I don't _think_ serializing to JsUnknown can't fail
|
||||
// I don't _think_ serializing to Unknown can't fail
|
||||
// FIXME: Remove this clippy directive
|
||||
#[napi(js_name = "getSelectedView")]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
pub fn get_selected_view(&self, env: Env) -> JsUnknown {
|
||||
pub fn get_selected_view(&'_ self, env: Env) -> Unknown<'_> {
|
||||
env.to_js_value(&self.model.get_selected_view()).unwrap()
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ impl UserModel {
|
||||
}
|
||||
|
||||
#[napi(js_name = "autoFillRows")]
|
||||
pub fn auto_fill_rows(&mut self, env: Env, source_area: JsUnknown, to_row: i32) -> Result<()> {
|
||||
pub fn auto_fill_rows(&mut self, env: Env, source_area: Unknown, to_row: i32) -> Result<()> {
|
||||
let area: Area = env
|
||||
.from_js_value(source_area)
|
||||
.map_err(|e| to_js_error(e.to_string()))?;
|
||||
@@ -454,7 +454,7 @@ impl UserModel {
|
||||
pub fn auto_fill_columns(
|
||||
&mut self,
|
||||
env: Env,
|
||||
source_area: JsUnknown,
|
||||
source_area: Unknown,
|
||||
to_column: i32,
|
||||
) -> Result<()> {
|
||||
let area: Area = env
|
||||
@@ -536,8 +536,8 @@ impl UserModel {
|
||||
pub fn set_area_with_border(
|
||||
&mut self,
|
||||
env: Env,
|
||||
area: JsUnknown,
|
||||
border_area: JsUnknown,
|
||||
area: Unknown,
|
||||
border_area: Unknown,
|
||||
) -> Result<()> {
|
||||
let range: Area = env
|
||||
.from_js_value(area)
|
||||
@@ -568,7 +568,7 @@ impl UserModel {
|
||||
}
|
||||
|
||||
#[napi(js_name = "copyToClipboard")]
|
||||
pub fn copy_to_clipboard(&self, env: Env) -> Result<JsUnknown> {
|
||||
pub fn copy_to_clipboard(&'_ self, env: Env) -> Result<Unknown<'_>> {
|
||||
let data = self
|
||||
.model
|
||||
.copy_to_clipboard()
|
||||
@@ -584,8 +584,8 @@ impl UserModel {
|
||||
&mut self,
|
||||
env: Env,
|
||||
source_sheet: u32,
|
||||
source_range: JsUnknown,
|
||||
clipboard: JsUnknown,
|
||||
source_range: Unknown,
|
||||
clipboard: Unknown,
|
||||
is_cut: bool,
|
||||
) -> Result<()> {
|
||||
let source_range: (i32, i32, i32, i32) = env
|
||||
@@ -601,7 +601,7 @@ impl UserModel {
|
||||
}
|
||||
|
||||
#[napi(js_name = "pasteCsvText")]
|
||||
pub fn paste_csv_string(&mut self, env: Env, area: JsUnknown, csv: String) -> Result<()> {
|
||||
pub fn paste_csv_string(&mut self, env: Env, area: Unknown, csv: String) -> Result<()> {
|
||||
let range: Area = env
|
||||
.from_js_value(area)
|
||||
.map_err(|e| to_js_error(e.to_string()))?;
|
||||
@@ -612,7 +612,7 @@ impl UserModel {
|
||||
}
|
||||
|
||||
#[napi(js_name = "getDefinedNameList")]
|
||||
pub fn get_defined_name_list(&self, env: Env) -> Result<JsUnknown> {
|
||||
pub fn get_defined_name_list(&'_ self, env: Env) -> Result<Unknown<'_>> {
|
||||
let data: Vec<DefinedName> = self
|
||||
.model
|
||||
.get_defined_name_list()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user