@electron/rebuild
Advanced tools
Comparing version 3.6.1 to 3.6.2
@@ -15,4 +15,9 @@ import { NodeAPI } from '../node-api'; | ||
getSupportedNapiVersions(): Promise<number[] | undefined>; | ||
/** | ||
* Search dependencies for package using either `packageName` or | ||
* `@namespace/packageName` in the case of forks. | ||
*/ | ||
findPackageInDependencies(packageName: string, packageProperty?: string): Promise<string | null>; | ||
} | ||
export declare function locateBinary(basePath: string, suffix: string): Promise<string | null>; | ||
export {}; |
@@ -40,2 +40,17 @@ "use strict"; | ||
} | ||
/** | ||
* Search dependencies for package using either `packageName` or | ||
* `@namespace/packageName` in the case of forks. | ||
*/ | ||
async findPackageInDependencies(packageName, packageProperty = 'dependencies') { | ||
const dependencies = await this.packageJSONFieldWithDefault(packageProperty, {}); | ||
if (typeof dependencies !== 'object') | ||
return null; | ||
// Look for direct dependency match | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (dependencies.hasOwnProperty(packageName)) | ||
return packageName; | ||
const forkedPackage = Object.keys(dependencies).find(dependency => dependency.startsWith('@') && dependency.endsWith(`/${packageName}`)); | ||
return forkedPackage || null; | ||
} | ||
} | ||
@@ -42,0 +57,0 @@ exports.NativeModule = NativeModule; |
@@ -14,8 +14,10 @@ "use strict"; | ||
async usesTool() { | ||
const dependencies = await this.packageJSONFieldWithDefault('dependencies', {}); | ||
// eslint-disable-next-line no-prototype-builtins | ||
return dependencies.hasOwnProperty('@mapbox/node-pre-gyp'); | ||
const packageName = await this.findPackageInDependencies('node-pre-gyp'); | ||
return !!packageName; | ||
} | ||
async locateBinary() { | ||
return (0, _1.locateBinary)(this.modulePath, 'node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp'); | ||
const packageName = await this.findPackageInDependencies('node-pre-gyp'); | ||
if (!packageName) | ||
return null; | ||
return (0, _1.locateBinary)(this.modulePath, `node_modules/${packageName}/bin/node-pre-gyp`); | ||
} | ||
@@ -22,0 +24,0 @@ async run(nodePreGypPath) { |
@@ -15,8 +15,10 @@ "use strict"; | ||
async usesTool() { | ||
const dependencies = await this.packageJSONFieldWithDefault('dependencies', {}); | ||
// eslint-disable-next-line no-prototype-builtins | ||
return dependencies.hasOwnProperty('prebuild-install'); | ||
const packageName = await this.findPackageInDependencies('prebuild-install'); | ||
return !!packageName; | ||
} | ||
async locateBinary() { | ||
return (0, _1.locateBinary)(this.modulePath, 'node_modules/prebuild-install/bin.js'); | ||
const packageName = await this.findPackageInDependencies('prebuild-install'); | ||
if (!packageName) | ||
return null; | ||
return (0, _1.locateBinary)(this.modulePath, `node_modules/${packageName}/bin.js`); | ||
} | ||
@@ -23,0 +25,0 @@ async run(prebuildInstallPath) { |
@@ -36,8 +36,6 @@ "use strict"; | ||
async usesTool() { | ||
const devDependencies = await this.packageJSONFieldWithDefault('devDependencies', {}); | ||
// eslint-disable-next-line no-prototype-builtins | ||
return devDependencies.hasOwnProperty('prebuildify'); | ||
const packageName = await this.findPackageInDependencies('prebuildify', 'devDependencies'); | ||
return !!packageName; | ||
} | ||
async findPrebuiltModule() { | ||
const nodeArch = (0, arch_1.getNodeArch)(this.rebuilder.arch, process.config.variables); | ||
d(`Checking for prebuilds for "${this.moduleName}"`); | ||
@@ -49,2 +47,3 @@ const prebuildsDir = path_1.default.join(this.modulePath, 'prebuilds'); | ||
} | ||
const nodeArch = (0, arch_1.getNodeArch)(this.rebuilder.arch, process.config.variables); | ||
const prebuiltModuleDir = path_1.default.join(prebuildsDir, `${this.rebuilder.platform}-${determineNativePrebuildArch(nodeArch)}`); | ||
@@ -51,0 +50,0 @@ const nativeExt = determineNativePrebuildExtension(nodeArch); |
{ | ||
"name": "@electron/rebuild", | ||
"version": "3.6.1", | ||
"version": "3.6.2", | ||
"description": "Electron supporting package to rebuild native node modules against the currently installed electron", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161843
2173