Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions lib/node_modules/@stdlib/_tools/pkgs/addons/lib/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,36 @@ function inspect( files, clbk ) {
fpath = resolve( dir, 'src', 'Makefile' );

debug( 'Checking for add-on...' );
exists( fpath, onExists );
exists( fpath, onExistsMakefile );
}

/**
* Callback invoked upon testing if a file exists.
* Callback invoked upon testing if a `src/Makefile` exists.
*
* @private
* @param {(Error|null)} error - error object
* @param {boolean} bool - boolean indicating whether a file exists
* @returns {void}
*/
function onExistsMakefile( error, bool ) {
var gpath;
var j = i + 1;
if ( error ) {
debug( 'Encountered an error when testing for add-on: %s (%d of %d). Error: %s', files[ i ], j, total, error.message );
return done();
}
if ( !bool ) {
debug( 'Unable to detect add-on.' );
return done();
}
// A `src/Makefile` is also present in WebAssembly-only packages, so additionally require a `binding.gyp` file, which is what `node-gyp` needs to build a native add-on:
gpath = resolve( dirname( files[ i ] ), 'binding.gyp' );
debug( 'Checking for `binding.gyp`...' );
exists( gpath, onExists );
}

/**
* Callback invoked upon testing if a `binding.gyp` file exists.
*
* @private
* @param {(Error|null)} error - error object
Expand Down
4 changes: 3 additions & 1 deletion lib/node_modules/@stdlib/_tools/pkgs/addons/lib/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ function findAddons( options ) {
for ( i = 0; i < files.length; i++ ) {
dir = dirname( files[ i ] );
fpath = resolve( dir, 'src', 'Makefile' );
if ( exists( fpath ) ) {

// A `src/Makefile` is also present in WebAssembly-only packages, so additionally require a `binding.gyp` file, which is what `node-gyp` needs to build a native add-on:
if ( exists( fpath ) && exists( resolve( dir, 'binding.gyp' ) ) ) {
out.push( dir );
}
}
Expand Down