async function resolveNativeModulesDirAsync(nativeModulesDir, cwd) {
    // first try resolving the provided dir
    if (nativeModulesDir) {
        const nativeModulesDirPath = path_1.default.resolve(cwd, nativeModulesDir);
        if (await fs_extra_1.default.pathExists(nativeModulesDirPath)) {
            return nativeModulesDirPath;
        }
    }
    // if not found, try to find it relative to the package.json
    const up = await (0, find_up_1.default)('package.json', { cwd });
    if (!up) {
        return null;
    }
    const resolvedPath = path_1.default.join(up, '..', nativeModulesDir || 'modules');
    return fs_extra_1.default.existsSync(resolvedPath) ? resolvedPath : null;
}
/**
 * Finds the real path to custom native modules directory.
 * @returns resolved native modules directory or `null` if it is not found or doesn't exist.
 */
Finds the real path to custom native modules directory.
@returns resolved native modules directory or `null` if it is not found or doesn't exist.
Finds the real path to custom native modules directory . @returns resolved native modules directory or ` null ` if it is not found or doesn ' t exist .
async function resolveNativeModulesDirAsync(nativeModulesDir, cwd) {
    if (nativeModulesDir) {
        const nativeModulesDirPath = path_1.default.resolve(cwd, nativeModulesDir);
        if (await fs_extra_1.default.pathExists(nativeModulesDirPath)) {
            return nativeModulesDirPath;
        }
    }
    const up = await (0, find_up_1.default)('package.json', { cwd });
    if (!up) {
        return null;
    }
    const resolvedPath = path_1.default.join(up, '..', nativeModulesDir || 'modules');
    return fs_extra_1.default.existsSync(resolvedPath) ? resolvedPath : null;
}
async function resolveNativeModulesDirAsync ( nativeModulesDir , cwd ) { if ( nativeModulesDir ) { const nativeModulesDirPath = path_1 . default . resolve ( cwd , nativeModulesDir ) ; if ( await fs_extra_1 . default . pathExists ( nativeModulesDirPath ) ) { return nativeModulesDirPath ; } } const up = await ( 0 , find_up_1 . default ) ( 'package.json' , { cwd } ) ; if ( ! up ) { return null ; } const resolvedPath = path_1 . default . join ( up , '..' , nativeModulesDir || 'modules' ) ; return fs_extra_1 . default . existsSync ( resolvedPath ) ? resolvedPath : null ; }
Finds the real path to custom native modules directory.
Finds the real path to custom native modules directory .
// first try resolving the provided dir // if not found, try to find it relative to the package.json