Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'node-pre-gyp' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
'use strict'
/* global describe it before */
/*
This utility file is intended to run in a different process space
than the main tests. This helps to ensure that things do get
written to disk properly. Doing these tests in the same process
space where the tests are written is problematic as Boost shares
allocators.
*/
const binary = require('node-pre-gyp')
const path = require('path')
const mmap_obj_path = binary.find(path.resolve(path.join(__dirname, '../package.json')))
const MmapObject = require(mmap_obj_path)
const expect = require('chai').expect
const BigKeySize = 1000
const BiggerKeySize = 10000
describe('Interprocess', function () {
before(function () {
this.reader = new MmapObject.Open(process.env.TESTFILE)
})
it('reads a string', function () {
expect(this.reader.first).to.equal('value for first')
})
it('reads a string that was written twice', function () {
expect(this.reader.samekey).to.equal('first value and a new value too')
}
}
return false;
}
var package_json = require('../package.json');
if (only_one(package_json)) {
return;
}
var binary = require('node-pre-gyp');
var exists = require('fs').existsSync || require('path').existsSync;
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
var settings_path = path.join(path.dirname(binding_path),'mapnik_settings.js');
var settings = require(settings_path);
var separator = (process.platform === 'win32') ? ';' : ':';
// set custom env settings before loading mapnik
if (settings.env) {
var process_keys = Object.keys(process.env);
for (var key in settings.env) {
if (process_keys.indexOf(key) == -1) {
process.env[key] = settings.env[key];
} else {
if (key === 'PATH') {
process.env[key] = settings.env[key] + separator + process.env[key];
}
}
#!/usr/bin/env node
'use strict';
var binary = require('node-pre-gyp'),
path = require('path'),
bindingPath = binary.find(path.resolve(__dirname, '..', 'package.json')),
program = path.join(path.dirname(bindingPath), 'bin', 'mapnik-index'),
spawn = require('child_process').spawn,
fs = require('fs');
if (!fs.existsSync(program)) {
// assume it is not packaged but still on PATH
program = 'mapnik-index';
}
var proc = spawn(program, process.argv.slice(2))
.on('error', function(err) {
if (err && err.code == 'ENOENT') {
throw new Error("mapnik-index not found at " + program);
}
throw err;
})
function isInspectorCompatible(electronVersion: string): boolean {
// require.resolve() will throw if it fails to find the module
let packageDir = path.dirname(
require.resolve(path.join(__dirname, '../node_modules/v8-profiler'))
);
let binaryFile = findNativeModule(
path.join(packageDir, 'package.json'),
{ runtime: 'electron', target: electronVersion }
);
if (!fs.existsSync(binaryFile)) {
return false;
}
packageDir = path.dirname(require.resolve(path.join(__dirname, '../node_modules/v8-debug')));
binaryFile = findNativeModule(
path.join(packageDir, 'package.json'),
{ runtime: 'electron', target: electronVersion }
);
return fs.existsSync(binaryFile);
}
const binary = require("node-pre-gyp");
const path = require("path");
const bindingPath = binary.find(path.resolve(path.join(__dirname, "../package.json")));
const binding = require(bindingPath);
module.exports = binding;// was require("../build/Release/occ");
//xx module.exports = require("../build/Debug/occ");
'use strict';
var fs = require('fs');
if (!fs.existsSync('package.json')) {
fs.writeFileSync('package.json', '{}');
}
var Run = require('node-pre-gyp').Run;
var r = new Run();
try {
r.commands.clean();
} catch (e) {
if (e.message.indexOf('undefined package.json is not node-pre-gyp ready') >= 0) {
console.log('ok');
}
}
(function next(err) {
if (err) {
console.log(err.message);
process.exit(1);
}
var target = targets.pop();
if (!target) process.exit(0);
var prog = new gyp.Run();
prog.opts = target;
prog.commands.install([], next);
})();
module.exports = function prepublish(err) {
if (err) {
console.log(err.message);
return process.exit(1);
}
var target = targets.pop();
if (!target) process.exit(0);
var prog = extend(new gyp.Run(), {opts: target});
prog.commands.install([], prepublish);
};
import * as stream from 'stream';
import * as path from 'path';
import * as fs from 'fs';
import * as binary from 'node-pre-gyp';
const bindingPath: string = binary.find(path.resolve(path.join(__dirname, '../../package.json')));
const SnowboyDetectNative: SnowboyDetectNativeInterface = require(bindingPath).SnowboyDetect;
enum DetectionResult {
SILENCE = -2,
ERROR = -1,
SOUND = 0
}
enum ModelType {
PMDL,
UMDL
}
export interface HotwordModel {
file: string;
sensitivity?: string;
/**
* Copyright (c) Jonathan Cardoso Machado. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const path = require('path')
const binary = require('node-pre-gyp')
const bindingPath = binary.find(
path.resolve(path.join(__dirname, './../package.json')),
)
/**
* Multi handle constructor
*
* @constructor
* @alias module:node-libcurl.Multi
*/
const Multi = (module.exports = require(bindingPath).Multi)
/**
* Use {@link module:node-libcurl.Curl.multi} for predefined constants.
*
* Official libcurl documentation: [curl_multi_setopt()]{@link http://curl.haxx.se/libcurl/c/curl_multi_setopt.html}
*