@stll/fuzzy-search
Advanced tools
+435
-17
@@ -6,5 +6,59 @@ // prettier-ignore | ||
| const { readFileSync } = require('node:fs') | ||
| let nativeBinding = null | ||
| const loadErrors = [] | ||
| const isMusl = () => { | ||
| let musl = false | ||
| if (process.platform === 'linux') { | ||
| musl = isMuslFromFilesystem() | ||
| if (musl === null) { | ||
| musl = isMuslFromReport() | ||
| } | ||
| 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 | ||
| } | ||
| } | ||
| 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 | ||
| } | ||
| } | ||
| 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() { | ||
@@ -17,2 +71,108 @@ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) { | ||
| } | ||
| } else if (process.platform === 'android') { | ||
| if (process.arch === 'arm64') { | ||
| try { | ||
| return require('./fuzzy-search.android-arm64.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-android-arm64') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-android-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.android-arm-eabi.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-android-arm-eabi') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-android-arm-eabi/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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 Android ${process.arch}`)) | ||
| } | ||
| } else if (process.platform === 'win32') { | ||
| if (process.arch === 'x64') { | ||
| if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') { | ||
| try { | ||
| return require('./fuzzy-search.win32-x64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-win32-x64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-win32-x64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./fuzzy-search.win32-x64-msvc.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-win32-x64-msvc') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-win32-x64-msvc/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.win32-ia32-msvc.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-win32-ia32-msvc') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-win32-ia32-msvc/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.win32-arm64-msvc.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-win32-arm64-msvc') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-win32-arm64-msvc/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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}`)) | ||
| } | ||
| } else if (process.platform === 'darwin') { | ||
@@ -27,4 +187,4 @@ try { | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-darwin-universal/package.json').version | ||
| if (bindingPackageVersion !== '0.0.1' && 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.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -44,4 +204,4 @@ return binding | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-darwin-x64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.1' && 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.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -61,4 +221,4 @@ return binding | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-darwin-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.0.1' && 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.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -72,6 +232,6 @@ return binding | ||
| } | ||
| } else if (process.platform === 'linux') { | ||
| } else if (process.platform === 'freebsd') { | ||
| if (process.arch === 'x64') { | ||
| try { | ||
| return require('./fuzzy-search.linux-x64-gnu.node') | ||
| return require('./fuzzy-search.freebsd-x64.node') | ||
| } catch (e) { | ||
@@ -81,6 +241,6 @@ loadErrors.push(e) | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-x64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-x64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.1' && 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.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| const binding = require('@stll/fuzzy-search-freebsd-x64') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-freebsd-x64/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -93,3 +253,3 @@ return binding | ||
| try { | ||
| return require('./fuzzy-search.linux-arm64-gnu.node') | ||
| return require('./fuzzy-search.freebsd-arm64.node') | ||
| } catch (e) { | ||
@@ -99,6 +259,6 @@ loadErrors.push(e) | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-arm64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-arm64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.0.1' && 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.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| const binding = require('@stll/fuzzy-search-freebsd-arm64') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-freebsd-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -110,4 +270,262 @@ return binding | ||
| } else { | ||
| loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)) | ||
| } | ||
| } else if (process.platform === 'linux') { | ||
| if (process.arch === 'x64') { | ||
| if (isMusl()) { | ||
| try { | ||
| return require('./fuzzy-search.linux-x64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-x64-musl') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-x64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./fuzzy-search.linux-x64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-x64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-x64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.linux-arm64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-arm64-musl') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-arm64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./fuzzy-search.linux-arm64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-arm64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-arm64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.linux-arm-musleabihf.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-arm-musleabihf') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-arm-musleabihf/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./fuzzy-search.linux-arm-gnueabihf.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-arm-gnueabihf') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-arm-gnueabihf/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.linux-loong64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-loong64-musl') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-loong64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./fuzzy-search.linux-loong64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-loong64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-loong64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.linux-riscv64-musl.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-riscv64-musl') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-riscv64-musl/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
| return binding | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| } else { | ||
| try { | ||
| return require('./fuzzy-search.linux-riscv64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-riscv64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-riscv64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.linux-ppc64-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-ppc64-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-ppc64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.linux-s390x-gnu.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-linux-s390x-gnu') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-linux-s390x-gnu/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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}`)) | ||
| } | ||
| } else if (process.platform === 'openharmony') { | ||
| if (process.arch === 'arm64') { | ||
| try { | ||
| return require('./fuzzy-search.openharmony-arm64.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-openharmony-arm64') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-openharmony-arm64/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.openharmony-x64.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-openharmony-x64') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-openharmony-x64/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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('./fuzzy-search.openharmony-arm.node') | ||
| } catch (e) { | ||
| loadErrors.push(e) | ||
| } | ||
| try { | ||
| const binding = require('@stll/fuzzy-search-openharmony-arm') | ||
| const bindingPackageVersion = require('@stll/fuzzy-search-openharmony-arm/package.json').version | ||
| if (bindingPackageVersion !== '0.1.2' && 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.1.2 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 { | ||
@@ -114,0 +532,0 @@ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)) |
+7
-7
| { | ||
| "name": "@stll/fuzzy-search", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "NAPI-RS bindings for fuzzy string matching via Myers' bit-parallel algorithm for Node.js/Bun", | ||
@@ -72,7 +72,7 @@ "keywords": [ | ||
| "optionalDependencies": { | ||
| "@stll/fuzzy-search-darwin-arm64": "0.0.2", | ||
| "@stll/fuzzy-search-darwin-x64": "0.0.2", | ||
| "@stll/fuzzy-search-linux-arm64-gnu": "0.0.2", | ||
| "@stll/fuzzy-search-linux-x64-gnu": "0.0.2", | ||
| "@stll/fuzzy-search-wasm32-wasi": "0.0.2" | ||
| "@stll/fuzzy-search-darwin-x64": "0.1.2", | ||
| "@stll/fuzzy-search-darwin-arm64": "0.1.2", | ||
| "@stll/fuzzy-search-linux-x64-gnu": "0.1.2", | ||
| "@stll/fuzzy-search-linux-arm64-gnu": "0.1.2", | ||
| "@stll/fuzzy-search-wasm32-wasi": "0.1.2" | ||
| }, | ||
@@ -92,2 +92,2 @@ "napi": { | ||
| } | ||
| } | ||
| } |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
54482
50.84%701
143.4%61
221.05%