opencv4nodejs-prebuilt
Advanced tools
Comparing version 5.3.0-beta1 to 5.3.0-beta2
const path = require('path'); | ||
const opencvBuild = require(`@nut-tree/opencv-build-${process.platform}`) | ||
const { resolvePath } = require('./commons'); | ||
@@ -9,30 +8,2 @@ | ||
function tryGetOpencvBinDir() { | ||
if (process.env.OPENCV_BIN_DIR) { | ||
logDebug('tryGetOpencvBinDir', 'OPENCV_BIN_DIR environment variable is set') | ||
return process.env.OPENCV_BIN_DIR | ||
} | ||
// if the auto build is not disabled via environment do not even attempt | ||
// to read package.json | ||
if (!opencvBuild.isAutoBuildDisabled()) { | ||
logDebug('tryGetOpencvBinDir', 'auto build has not been disabled via environment variable, using opencv bin dir of opencv-build') | ||
return opencvBuild.opencvBinDir | ||
} | ||
logDebug('tryGetOpencvBinDir', 'auto build has not been explicitly disabled via environment variable, attempting to read envs from package.json...') | ||
const envs = opencvBuild.readEnvsFromPackageJson() | ||
if (!envs.disableAutoBuild) { | ||
logDebug('tryGetOpencvBinDir', 'auto build has not been disabled via package.json, using opencv bin dir of opencv-build') | ||
return opencvBuild.opencvBinDir | ||
} | ||
if (envs.opencvBinDir) { | ||
logDebug('tryGetOpencvBinDir', 'found opencv binary environment variable in package.json') | ||
return envs.opencvBinDir | ||
} | ||
logDebug('tryGetOpencvBinDir', 'failed to find opencv binary environment variable in package.json') | ||
return null | ||
} | ||
let cv = null | ||
@@ -44,18 +15,3 @@ try { | ||
logDebug('require', 'failed to require cv with exception: ' + err.toString()) | ||
logDebug('require', 'attempting to add opencv binaries to path') | ||
if (!process.env.path) { | ||
logDebug('require', 'there is no path environment variable, skipping...') | ||
throw err | ||
} | ||
const opencvBinDir = tryGetOpencvBinDir() | ||
logDebug('require', 'adding opencv binary dir to path: ' + opencvBinDir) | ||
// ensure binaries are added to path on windows | ||
if (!process.env.path.includes(opencvBinDir)) { | ||
process.env.path = `${process.env.path};${opencvBinDir};` | ||
} | ||
logDebug('require', 'process.env.path: ' + process.env.path) | ||
cv = require(requirePath); | ||
throw err | ||
} | ||
@@ -62,0 +18,0 @@ |
{ | ||
"name": "opencv4nodejs-prebuilt", | ||
"version": "5.3.0-beta1", | ||
"version": "5.3.0-beta2", | ||
"description": "Asynchronous OpenCV 3.x nodejs bindings with JavaScript and TypeScript API.", | ||
@@ -57,3 +57,3 @@ "keywords": [ | ||
}, | ||
"opencv": "4.1.1-beta4", | ||
"opencv": "4.1.1", | ||
"devDependencies": { | ||
@@ -60,0 +60,0 @@ "prebuild": "^9.1.0" |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
20
10947635
2416