Gitlab@Informatics

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • 65160381/project-melon
1 result
Select Git revision
Show changes
Showing
with 4533 additions and 0 deletions
'use strict';
module.exports = exports = testpackage;
exports.usage = 'Tests that the staged package is valid';
const fs = require('fs');
const path = require('path');
const log = require('npmlog');
const existsAsync = fs.exists || path.exists;
const versioning = require('./util/versioning.js');
const napi = require('./util/napi.js');
const testbinary = require('./testbinary.js');
const tar = require('tar');
const makeDir = require('make-dir');
function testpackage(gyp, argv, callback) {
const package_json = gyp.package_json;
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
const tarball = opts.staged_tarball;
existsAsync(tarball, (found) => {
if (!found) {
return callback(new Error('Cannot test package because ' + tarball + ' missing: run `node-pre-gyp package` first'));
}
const to = opts.module_path;
function filter_func(entry) {
log.info('install', 'unpacking [' + entry.path + ']');
}
makeDir(to).then(() => {
tar.extract({
file: tarball,
cwd: to,
strip: 1,
onentry: filter_func
}).then(after_extract, callback);
}).catch((err) => {
return callback(err);
});
function after_extract() {
testbinary(gyp, argv, (err) => {
if (err) {
return callback(err);
} else {
console.log('[' + package_json.name + '] Package appears valid');
return callback();
}
});
}
});
}
'use strict';
module.exports = exports = unpublish;
exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)';
const log = require('npmlog');
const versioning = require('./util/versioning.js');
const napi = require('./util/napi.js');
const s3_setup = require('./util/s3_setup.js');
const url = require('url');
function unpublish(gyp, argv, callback) {
const package_json = gyp.package_json;
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
const config = {};
s3_setup.detect(opts, config);
const s3 = s3_setup.get_s3(config);
const key_name = url.resolve(config.prefix, opts.package_name);
const s3_opts = {
Bucket: config.bucket,
Key: key_name
};
s3.headObject(s3_opts, (err, meta) => {
if (err && err.code === 'NotFound') {
console.log('[' + package_json.name + '] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
return callback();
} else if (err) {
return callback(err);
} else {
log.info('unpublish', JSON.stringify(meta));
s3.deleteObject(s3_opts, (err2, resp) => {
if (err2) return callback(err2);
log.info(JSON.stringify(resp));
console.log('[' + package_json.name + '] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
return callback();
});
}
});
}
{
"0.1.14": {
"node_abi": null,
"v8": "1.3"
},
"0.1.15": {
"node_abi": null,
"v8": "1.3"
},
"0.1.16": {
"node_abi": null,
"v8": "1.3"
},
"0.1.17": {
"node_abi": null,
"v8": "1.3"
},
"0.1.18": {
"node_abi": null,
"v8": "1.3"
},
"0.1.19": {
"node_abi": null,
"v8": "2.0"
},
"0.1.20": {
"node_abi": null,
"v8": "2.0"
},
"0.1.21": {
"node_abi": null,
"v8": "2.0"
},
"0.1.22": {
"node_abi": null,
"v8": "2.0"
},
"0.1.23": {
"node_abi": null,
"v8": "2.0"
},
"0.1.24": {
"node_abi": null,
"v8": "2.0"
},
"0.1.25": {
"node_abi": null,
"v8": "2.0"
},
"0.1.26": {
"node_abi": null,
"v8": "2.0"
},
"0.1.27": {
"node_abi": null,
"v8": "2.1"
},
"0.1.28": {
"node_abi": null,
"v8": "2.1"
},
"0.1.29": {
"node_abi": null,
"v8": "2.1"
},
"0.1.30": {
"node_abi": null,
"v8": "2.1"
},
"0.1.31": {
"node_abi": null,
"v8": "2.1"
},
"0.1.32": {
"node_abi": null,
"v8": "2.1"
},
"0.1.33": {
"node_abi": null,
"v8": "2.1"
},
"0.1.90": {
"node_abi": null,
"v8": "2.2"
},
"0.1.91": {
"node_abi": null,
"v8": "2.2"
},
"0.1.92": {
"node_abi": null,
"v8": "2.2"
},
"0.1.93": {
"node_abi": null,
"v8": "2.2"
},
"0.1.94": {
"node_abi": null,
"v8": "2.2"
},
"0.1.95": {
"node_abi": null,
"v8": "2.2"
},
"0.1.96": {
"node_abi": null,
"v8": "2.2"
},
"0.1.97": {
"node_abi": null,
"v8": "2.2"
},
"0.1.98": {
"node_abi": null,
"v8": "2.2"
},
"0.1.99": {
"node_abi": null,
"v8": "2.2"
},
"0.1.100": {
"node_abi": null,
"v8": "2.2"
},
"0.1.101": {
"node_abi": null,
"v8": "2.3"
},
"0.1.102": {
"node_abi": null,
"v8": "2.3"
},
"0.1.103": {
"node_abi": null,
"v8": "2.3"
},
"0.1.104": {
"node_abi": null,
"v8": "2.3"
},
"0.2.0": {
"node_abi": 1,
"v8": "2.3"
},
"0.2.1": {
"node_abi": 1,
"v8": "2.3"
},
"0.2.2": {
"node_abi": 1,
"v8": "2.3"
},
"0.2.3": {
"node_abi": 1,
"v8": "2.3"
},
"0.2.4": {
"node_abi": 1,
"v8": "2.3"
},
"0.2.5": {
"node_abi": 1,
"v8": "2.3"
},
"0.2.6": {
"node_abi": 1,
"v8": "2.3"
},
"0.3.0": {
"node_abi": 1,
"v8": "2.5"
},
"0.3.1": {
"node_abi": 1,
"v8": "2.5"
},
"0.3.2": {
"node_abi": 1,
"v8": "3.0"
},
"0.3.3": {
"node_abi": 1,
"v8": "3.0"
},
"0.3.4": {
"node_abi": 1,
"v8": "3.0"
},
"0.3.5": {
"node_abi": 1,
"v8": "3.0"
},
"0.3.6": {
"node_abi": 1,
"v8": "3.0"
},
"0.3.7": {
"node_abi": 1,
"v8": "3.0"
},
"0.3.8": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.0": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.1": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.2": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.3": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.4": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.5": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.6": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.7": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.8": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.9": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.10": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.11": {
"node_abi": 1,
"v8": "3.1"
},
"0.4.12": {
"node_abi": 1,
"v8": "3.1"
},
"0.5.0": {
"node_abi": 1,
"v8": "3.1"
},
"0.5.1": {
"node_abi": 1,
"v8": "3.4"
},
"0.5.2": {
"node_abi": 1,
"v8": "3.4"
},
"0.5.3": {
"node_abi": 1,
"v8": "3.4"
},
"0.5.4": {
"node_abi": 1,
"v8": "3.5"
},
"0.5.5": {
"node_abi": 1,
"v8": "3.5"
},
"0.5.6": {
"node_abi": 1,
"v8": "3.6"
},
"0.5.7": {
"node_abi": 1,
"v8": "3.6"
},
"0.5.8": {
"node_abi": 1,
"v8": "3.6"
},
"0.5.9": {
"node_abi": 1,
"v8": "3.6"
},
"0.5.10": {
"node_abi": 1,
"v8": "3.7"
},
"0.6.0": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.1": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.2": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.3": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.4": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.5": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.6": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.7": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.8": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.9": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.10": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.11": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.12": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.13": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.14": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.15": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.16": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.17": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.18": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.19": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.20": {
"node_abi": 1,
"v8": "3.6"
},
"0.6.21": {
"node_abi": 1,
"v8": "3.6"
},
"0.7.0": {
"node_abi": 1,
"v8": "3.8"
},
"0.7.1": {
"node_abi": 1,
"v8": "3.8"
},
"0.7.2": {
"node_abi": 1,
"v8": "3.8"
},
"0.7.3": {
"node_abi": 1,
"v8": "3.9"
},
"0.7.4": {
"node_abi": 1,
"v8": "3.9"
},
"0.7.5": {
"node_abi": 1,
"v8": "3.9"
},
"0.7.6": {
"node_abi": 1,
"v8": "3.9"
},
"0.7.7": {
"node_abi": 1,
"v8": "3.9"
},
"0.7.8": {
"node_abi": 1,
"v8": "3.9"
},
"0.7.9": {
"node_abi": 1,
"v8": "3.11"
},
"0.7.10": {
"node_abi": 1,
"v8": "3.9"
},
"0.7.11": {
"node_abi": 1,
"v8": "3.11"
},
"0.7.12": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.0": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.1": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.2": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.3": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.4": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.5": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.6": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.7": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.8": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.9": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.10": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.11": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.12": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.13": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.14": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.15": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.16": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.17": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.18": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.19": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.20": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.21": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.22": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.23": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.24": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.25": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.26": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.27": {
"node_abi": 1,
"v8": "3.11"
},
"0.8.28": {
"node_abi": 1,
"v8": "3.11"
},
"0.9.0": {
"node_abi": 1,
"v8": "3.11"
},
"0.9.1": {
"node_abi": 10,
"v8": "3.11"
},
"0.9.2": {
"node_abi": 10,
"v8": "3.11"
},
"0.9.3": {
"node_abi": 10,
"v8": "3.13"
},
"0.9.4": {
"node_abi": 10,
"v8": "3.13"
},
"0.9.5": {
"node_abi": 10,
"v8": "3.13"
},
"0.9.6": {
"node_abi": 10,
"v8": "3.15"
},
"0.9.7": {
"node_abi": 10,
"v8": "3.15"
},
"0.9.8": {
"node_abi": 10,
"v8": "3.15"
},
"0.9.9": {
"node_abi": 11,
"v8": "3.15"
},
"0.9.10": {
"node_abi": 11,
"v8": "3.15"
},
"0.9.11": {
"node_abi": 11,
"v8": "3.14"
},
"0.9.12": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.0": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.1": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.2": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.3": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.4": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.5": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.6": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.7": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.8": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.9": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.10": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.11": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.12": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.13": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.14": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.15": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.16": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.17": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.18": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.19": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.20": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.21": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.22": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.23": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.24": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.25": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.26": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.27": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.28": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.29": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.30": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.31": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.32": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.33": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.34": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.35": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.36": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.37": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.38": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.39": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.40": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.41": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.42": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.43": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.44": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.45": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.46": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.47": {
"node_abi": 11,
"v8": "3.14"
},
"0.10.48": {
"node_abi": 11,
"v8": "3.14"
},
"0.11.0": {
"node_abi": 12,
"v8": "3.17"
},
"0.11.1": {
"node_abi": 12,
"v8": "3.18"
},
"0.11.2": {
"node_abi": 12,
"v8": "3.19"
},
"0.11.3": {
"node_abi": 12,
"v8": "3.19"
},
"0.11.4": {
"node_abi": 12,
"v8": "3.20"
},
"0.11.5": {
"node_abi": 12,
"v8": "3.20"
},
"0.11.6": {
"node_abi": 12,
"v8": "3.20"
},
"0.11.7": {
"node_abi": 12,
"v8": "3.20"
},
"0.11.8": {
"node_abi": 13,
"v8": "3.21"
},
"0.11.9": {
"node_abi": 13,
"v8": "3.22"
},
"0.11.10": {
"node_abi": 13,
"v8": "3.22"
},
"0.11.11": {
"node_abi": 14,
"v8": "3.22"
},
"0.11.12": {
"node_abi": 14,
"v8": "3.22"
},
"0.11.13": {
"node_abi": 14,
"v8": "3.25"
},
"0.11.14": {
"node_abi": 14,
"v8": "3.26"
},
"0.11.15": {
"node_abi": 14,
"v8": "3.28"
},
"0.11.16": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.0": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.1": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.2": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.3": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.4": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.5": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.6": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.7": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.8": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.9": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.10": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.11": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.12": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.13": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.14": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.15": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.16": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.17": {
"node_abi": 14,
"v8": "3.28"
},
"0.12.18": {
"node_abi": 14,
"v8": "3.28"
},
"1.0.0": {
"node_abi": 42,
"v8": "3.31"
},
"1.0.1": {
"node_abi": 42,
"v8": "3.31"
},
"1.0.2": {
"node_abi": 42,
"v8": "3.31"
},
"1.0.3": {
"node_abi": 42,
"v8": "4.1"
},
"1.0.4": {
"node_abi": 42,
"v8": "4.1"
},
"1.1.0": {
"node_abi": 43,
"v8": "4.1"
},
"1.2.0": {
"node_abi": 43,
"v8": "4.1"
},
"1.3.0": {
"node_abi": 43,
"v8": "4.1"
},
"1.4.1": {
"node_abi": 43,
"v8": "4.1"
},
"1.4.2": {
"node_abi": 43,
"v8": "4.1"
},
"1.4.3": {
"node_abi": 43,
"v8": "4.1"
},
"1.5.0": {
"node_abi": 43,
"v8": "4.1"
},
"1.5.1": {
"node_abi": 43,
"v8": "4.1"
},
"1.6.0": {
"node_abi": 43,
"v8": "4.1"
},
"1.6.1": {
"node_abi": 43,
"v8": "4.1"
},
"1.6.2": {
"node_abi": 43,
"v8": "4.1"
},
"1.6.3": {
"node_abi": 43,
"v8": "4.1"
},
"1.6.4": {
"node_abi": 43,
"v8": "4.1"
},
"1.7.1": {
"node_abi": 43,
"v8": "4.1"
},
"1.8.1": {
"node_abi": 43,
"v8": "4.1"
},
"1.8.2": {
"node_abi": 43,
"v8": "4.1"
},
"1.8.3": {
"node_abi": 43,
"v8": "4.1"
},
"1.8.4": {
"node_abi": 43,
"v8": "4.1"
},
"2.0.0": {
"node_abi": 44,
"v8": "4.2"
},
"2.0.1": {
"node_abi": 44,
"v8": "4.2"
},
"2.0.2": {
"node_abi": 44,
"v8": "4.2"
},
"2.1.0": {
"node_abi": 44,
"v8": "4.2"
},
"2.2.0": {
"node_abi": 44,
"v8": "4.2"
},
"2.2.1": {
"node_abi": 44,
"v8": "4.2"
},
"2.3.0": {
"node_abi": 44,
"v8": "4.2"
},
"2.3.1": {
"node_abi": 44,
"v8": "4.2"
},
"2.3.2": {
"node_abi": 44,
"v8": "4.2"
},
"2.3.3": {
"node_abi": 44,
"v8": "4.2"
},
"2.3.4": {
"node_abi": 44,
"v8": "4.2"
},
"2.4.0": {
"node_abi": 44,
"v8": "4.2"
},
"2.5.0": {
"node_abi": 44,
"v8": "4.2"
},
"3.0.0": {
"node_abi": 45,
"v8": "4.4"
},
"3.1.0": {
"node_abi": 45,
"v8": "4.4"
},
"3.2.0": {
"node_abi": 45,
"v8": "4.4"
},
"3.3.0": {
"node_abi": 45,
"v8": "4.4"
},
"3.3.1": {
"node_abi": 45,
"v8": "4.4"
},
"4.0.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.1.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.1.1": {
"node_abi": 46,
"v8": "4.5"
},
"4.1.2": {
"node_abi": 46,
"v8": "4.5"
},
"4.2.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.2.1": {
"node_abi": 46,
"v8": "4.5"
},
"4.2.2": {
"node_abi": 46,
"v8": "4.5"
},
"4.2.3": {
"node_abi": 46,
"v8": "4.5"
},
"4.2.4": {
"node_abi": 46,
"v8": "4.5"
},
"4.2.5": {
"node_abi": 46,
"v8": "4.5"
},
"4.2.6": {
"node_abi": 46,
"v8": "4.5"
},
"4.3.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.3.1": {
"node_abi": 46,
"v8": "4.5"
},
"4.3.2": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.1": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.2": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.3": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.4": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.5": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.6": {
"node_abi": 46,
"v8": "4.5"
},
"4.4.7": {
"node_abi": 46,
"v8": "4.5"
},
"4.5.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.6.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.6.1": {
"node_abi": 46,
"v8": "4.5"
},
"4.6.2": {
"node_abi": 46,
"v8": "4.5"
},
"4.7.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.7.1": {
"node_abi": 46,
"v8": "4.5"
},
"4.7.2": {
"node_abi": 46,
"v8": "4.5"
},
"4.7.3": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.1": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.2": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.3": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.4": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.5": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.6": {
"node_abi": 46,
"v8": "4.5"
},
"4.8.7": {
"node_abi": 46,
"v8": "4.5"
},
"4.9.0": {
"node_abi": 46,
"v8": "4.5"
},
"4.9.1": {
"node_abi": 46,
"v8": "4.5"
},
"5.0.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.1.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.1.1": {
"node_abi": 47,
"v8": "4.6"
},
"5.2.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.3.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.4.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.4.1": {
"node_abi": 47,
"v8": "4.6"
},
"5.5.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.6.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.7.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.7.1": {
"node_abi": 47,
"v8": "4.6"
},
"5.8.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.9.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.9.1": {
"node_abi": 47,
"v8": "4.6"
},
"5.10.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.10.1": {
"node_abi": 47,
"v8": "4.6"
},
"5.11.0": {
"node_abi": 47,
"v8": "4.6"
},
"5.11.1": {
"node_abi": 47,
"v8": "4.6"
},
"5.12.0": {
"node_abi": 47,
"v8": "4.6"
},
"6.0.0": {
"node_abi": 48,
"v8": "5.0"
},
"6.1.0": {
"node_abi": 48,
"v8": "5.0"
},
"6.2.0": {
"node_abi": 48,
"v8": "5.0"
},
"6.2.1": {
"node_abi": 48,
"v8": "5.0"
},
"6.2.2": {
"node_abi": 48,
"v8": "5.0"
},
"6.3.0": {
"node_abi": 48,
"v8": "5.0"
},
"6.3.1": {
"node_abi": 48,
"v8": "5.0"
},
"6.4.0": {
"node_abi": 48,
"v8": "5.0"
},
"6.5.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.6.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.7.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.8.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.8.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.9.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.9.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.9.2": {
"node_abi": 48,
"v8": "5.1"
},
"6.9.3": {
"node_abi": 48,
"v8": "5.1"
},
"6.9.4": {
"node_abi": 48,
"v8": "5.1"
},
"6.9.5": {
"node_abi": 48,
"v8": "5.1"
},
"6.10.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.10.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.10.2": {
"node_abi": 48,
"v8": "5.1"
},
"6.10.3": {
"node_abi": 48,
"v8": "5.1"
},
"6.11.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.11.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.11.2": {
"node_abi": 48,
"v8": "5.1"
},
"6.11.3": {
"node_abi": 48,
"v8": "5.1"
},
"6.11.4": {
"node_abi": 48,
"v8": "5.1"
},
"6.11.5": {
"node_abi": 48,
"v8": "5.1"
},
"6.12.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.12.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.12.2": {
"node_abi": 48,
"v8": "5.1"
},
"6.12.3": {
"node_abi": 48,
"v8": "5.1"
},
"6.13.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.13.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.14.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.14.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.14.2": {
"node_abi": 48,
"v8": "5.1"
},
"6.14.3": {
"node_abi": 48,
"v8": "5.1"
},
"6.14.4": {
"node_abi": 48,
"v8": "5.1"
},
"6.15.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.15.1": {
"node_abi": 48,
"v8": "5.1"
},
"6.16.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.17.0": {
"node_abi": 48,
"v8": "5.1"
},
"6.17.1": {
"node_abi": 48,
"v8": "5.1"
},
"7.0.0": {
"node_abi": 51,
"v8": "5.4"
},
"7.1.0": {
"node_abi": 51,
"v8": "5.4"
},
"7.2.0": {
"node_abi": 51,
"v8": "5.4"
},
"7.2.1": {
"node_abi": 51,
"v8": "5.4"
},
"7.3.0": {
"node_abi": 51,
"v8": "5.4"
},
"7.4.0": {
"node_abi": 51,
"v8": "5.4"
},
"7.5.0": {
"node_abi": 51,
"v8": "5.4"
},
"7.6.0": {
"node_abi": 51,
"v8": "5.5"
},
"7.7.0": {
"node_abi": 51,
"v8": "5.5"
},
"7.7.1": {
"node_abi": 51,
"v8": "5.5"
},
"7.7.2": {
"node_abi": 51,
"v8": "5.5"
},
"7.7.3": {
"node_abi": 51,
"v8": "5.5"
},
"7.7.4": {
"node_abi": 51,
"v8": "5.5"
},
"7.8.0": {
"node_abi": 51,
"v8": "5.5"
},
"7.9.0": {
"node_abi": 51,
"v8": "5.5"
},
"7.10.0": {
"node_abi": 51,
"v8": "5.5"
},
"7.10.1": {
"node_abi": 51,
"v8": "5.5"
},
"8.0.0": {
"node_abi": 57,
"v8": "5.8"
},
"8.1.0": {
"node_abi": 57,
"v8": "5.8"
},
"8.1.1": {
"node_abi": 57,
"v8": "5.8"
},
"8.1.2": {
"node_abi": 57,
"v8": "5.8"
},
"8.1.3": {
"node_abi": 57,
"v8": "5.8"
},
"8.1.4": {
"node_abi": 57,
"v8": "5.8"
},
"8.2.0": {
"node_abi": 57,
"v8": "5.8"
},
"8.2.1": {
"node_abi": 57,
"v8": "5.8"
},
"8.3.0": {
"node_abi": 57,
"v8": "6.0"
},
"8.4.0": {
"node_abi": 57,
"v8": "6.0"
},
"8.5.0": {
"node_abi": 57,
"v8": "6.0"
},
"8.6.0": {
"node_abi": 57,
"v8": "6.0"
},
"8.7.0": {
"node_abi": 57,
"v8": "6.1"
},
"8.8.0": {
"node_abi": 57,
"v8": "6.1"
},
"8.8.1": {
"node_abi": 57,
"v8": "6.1"
},
"8.9.0": {
"node_abi": 57,
"v8": "6.1"
},
"8.9.1": {
"node_abi": 57,
"v8": "6.1"
},
"8.9.2": {
"node_abi": 57,
"v8": "6.1"
},
"8.9.3": {
"node_abi": 57,
"v8": "6.1"
},
"8.9.4": {
"node_abi": 57,
"v8": "6.1"
},
"8.10.0": {
"node_abi": 57,
"v8": "6.2"
},
"8.11.0": {
"node_abi": 57,
"v8": "6.2"
},
"8.11.1": {
"node_abi": 57,
"v8": "6.2"
},
"8.11.2": {
"node_abi": 57,
"v8": "6.2"
},
"8.11.3": {
"node_abi": 57,
"v8": "6.2"
},
"8.11.4": {
"node_abi": 57,
"v8": "6.2"
},
"8.12.0": {
"node_abi": 57,
"v8": "6.2"
},
"8.13.0": {
"node_abi": 57,
"v8": "6.2"
},
"8.14.0": {
"node_abi": 57,
"v8": "6.2"
},
"8.14.1": {
"node_abi": 57,
"v8": "6.2"
},
"8.15.0": {
"node_abi": 57,
"v8": "6.2"
},
"8.15.1": {
"node_abi": 57,
"v8": "6.2"
},
"8.16.0": {
"node_abi": 57,
"v8": "6.2"
},
"8.16.1": {
"node_abi": 57,
"v8": "6.2"
},
"8.16.2": {
"node_abi": 57,
"v8": "6.2"
},
"8.17.0": {
"node_abi": 57,
"v8": "6.2"
},
"9.0.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.1.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.2.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.2.1": {
"node_abi": 59,
"v8": "6.2"
},
"9.3.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.4.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.5.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.6.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.6.1": {
"node_abi": 59,
"v8": "6.2"
},
"9.7.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.7.1": {
"node_abi": 59,
"v8": "6.2"
},
"9.8.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.9.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.10.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.10.1": {
"node_abi": 59,
"v8": "6.2"
},
"9.11.0": {
"node_abi": 59,
"v8": "6.2"
},
"9.11.1": {
"node_abi": 59,
"v8": "6.2"
},
"9.11.2": {
"node_abi": 59,
"v8": "6.2"
},
"10.0.0": {
"node_abi": 64,
"v8": "6.6"
},
"10.1.0": {
"node_abi": 64,
"v8": "6.6"
},
"10.2.0": {
"node_abi": 64,
"v8": "6.6"
},
"10.2.1": {
"node_abi": 64,
"v8": "6.6"
},
"10.3.0": {
"node_abi": 64,
"v8": "6.6"
},
"10.4.0": {
"node_abi": 64,
"v8": "6.7"
},
"10.4.1": {
"node_abi": 64,
"v8": "6.7"
},
"10.5.0": {
"node_abi": 64,
"v8": "6.7"
},
"10.6.0": {
"node_abi": 64,
"v8": "6.7"
},
"10.7.0": {
"node_abi": 64,
"v8": "6.7"
},
"10.8.0": {
"node_abi": 64,
"v8": "6.7"
},
"10.9.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.10.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.11.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.12.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.13.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.14.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.14.1": {
"node_abi": 64,
"v8": "6.8"
},
"10.14.2": {
"node_abi": 64,
"v8": "6.8"
},
"10.15.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.15.1": {
"node_abi": 64,
"v8": "6.8"
},
"10.15.2": {
"node_abi": 64,
"v8": "6.8"
},
"10.15.3": {
"node_abi": 64,
"v8": "6.8"
},
"10.16.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.16.1": {
"node_abi": 64,
"v8": "6.8"
},
"10.16.2": {
"node_abi": 64,
"v8": "6.8"
},
"10.16.3": {
"node_abi": 64,
"v8": "6.8"
},
"10.17.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.18.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.18.1": {
"node_abi": 64,
"v8": "6.8"
},
"10.19.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.20.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.20.1": {
"node_abi": 64,
"v8": "6.8"
},
"10.21.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.22.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.22.1": {
"node_abi": 64,
"v8": "6.8"
},
"10.23.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.23.1": {
"node_abi": 64,
"v8": "6.8"
},
"10.23.2": {
"node_abi": 64,
"v8": "6.8"
},
"10.23.3": {
"node_abi": 64,
"v8": "6.8"
},
"10.24.0": {
"node_abi": 64,
"v8": "6.8"
},
"10.24.1": {
"node_abi": 64,
"v8": "6.8"
},
"11.0.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.1.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.2.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.3.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.4.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.5.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.6.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.7.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.8.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.9.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.10.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.10.1": {
"node_abi": 67,
"v8": "7.0"
},
"11.11.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.12.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.13.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.14.0": {
"node_abi": 67,
"v8": "7.0"
},
"11.15.0": {
"node_abi": 67,
"v8": "7.0"
},
"12.0.0": {
"node_abi": 72,
"v8": "7.4"
},
"12.1.0": {
"node_abi": 72,
"v8": "7.4"
},
"12.2.0": {
"node_abi": 72,
"v8": "7.4"
},
"12.3.0": {
"node_abi": 72,
"v8": "7.4"
},
"12.3.1": {
"node_abi": 72,
"v8": "7.4"
},
"12.4.0": {
"node_abi": 72,
"v8": "7.4"
},
"12.5.0": {
"node_abi": 72,
"v8": "7.5"
},
"12.6.0": {
"node_abi": 72,
"v8": "7.5"
},
"12.7.0": {
"node_abi": 72,
"v8": "7.5"
},
"12.8.0": {
"node_abi": 72,
"v8": "7.5"
},
"12.8.1": {
"node_abi": 72,
"v8": "7.5"
},
"12.9.0": {
"node_abi": 72,
"v8": "7.6"
},
"12.9.1": {
"node_abi": 72,
"v8": "7.6"
},
"12.10.0": {
"node_abi": 72,
"v8": "7.6"
},
"12.11.0": {
"node_abi": 72,
"v8": "7.7"
},
"12.11.1": {
"node_abi": 72,
"v8": "7.7"
},
"12.12.0": {
"node_abi": 72,
"v8": "7.7"
},
"12.13.0": {
"node_abi": 72,
"v8": "7.7"
},
"12.13.1": {
"node_abi": 72,
"v8": "7.7"
},
"12.14.0": {
"node_abi": 72,
"v8": "7.7"
},
"12.14.1": {
"node_abi": 72,
"v8": "7.7"
},
"12.15.0": {
"node_abi": 72,
"v8": "7.7"
},
"12.16.0": {
"node_abi": 72,
"v8": "7.8"
},
"12.16.1": {
"node_abi": 72,
"v8": "7.8"
},
"12.16.2": {
"node_abi": 72,
"v8": "7.8"
},
"12.16.3": {
"node_abi": 72,
"v8": "7.8"
},
"12.17.0": {
"node_abi": 72,
"v8": "7.8"
},
"12.18.0": {
"node_abi": 72,
"v8": "7.8"
},
"12.18.1": {
"node_abi": 72,
"v8": "7.8"
},
"12.18.2": {
"node_abi": 72,
"v8": "7.8"
},
"12.18.3": {
"node_abi": 72,
"v8": "7.8"
},
"12.18.4": {
"node_abi": 72,
"v8": "7.8"
},
"12.19.0": {
"node_abi": 72,
"v8": "7.8"
},
"12.19.1": {
"node_abi": 72,
"v8": "7.8"
},
"12.20.0": {
"node_abi": 72,
"v8": "7.8"
},
"12.20.1": {
"node_abi": 72,
"v8": "7.8"
},
"12.20.2": {
"node_abi": 72,
"v8": "7.8"
},
"12.21.0": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.0": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.1": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.2": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.3": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.4": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.5": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.6": {
"node_abi": 72,
"v8": "7.8"
},
"12.22.7": {
"node_abi": 72,
"v8": "7.8"
},
"13.0.0": {
"node_abi": 79,
"v8": "7.8"
},
"13.0.1": {
"node_abi": 79,
"v8": "7.8"
},
"13.1.0": {
"node_abi": 79,
"v8": "7.8"
},
"13.2.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.3.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.4.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.5.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.6.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.7.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.8.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.9.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.10.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.10.1": {
"node_abi": 79,
"v8": "7.9"
},
"13.11.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.12.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.13.0": {
"node_abi": 79,
"v8": "7.9"
},
"13.14.0": {
"node_abi": 79,
"v8": "7.9"
},
"14.0.0": {
"node_abi": 83,
"v8": "8.1"
},
"14.1.0": {
"node_abi": 83,
"v8": "8.1"
},
"14.2.0": {
"node_abi": 83,
"v8": "8.1"
},
"14.3.0": {
"node_abi": 83,
"v8": "8.1"
},
"14.4.0": {
"node_abi": 83,
"v8": "8.1"
},
"14.5.0": {
"node_abi": 83,
"v8": "8.3"
},
"14.6.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.7.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.8.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.9.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.10.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.10.1": {
"node_abi": 83,
"v8": "8.4"
},
"14.11.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.12.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.13.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.13.1": {
"node_abi": 83,
"v8": "8.4"
},
"14.14.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.15.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.15.1": {
"node_abi": 83,
"v8": "8.4"
},
"14.15.2": {
"node_abi": 83,
"v8": "8.4"
},
"14.15.3": {
"node_abi": 83,
"v8": "8.4"
},
"14.15.4": {
"node_abi": 83,
"v8": "8.4"
},
"14.15.5": {
"node_abi": 83,
"v8": "8.4"
},
"14.16.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.16.1": {
"node_abi": 83,
"v8": "8.4"
},
"14.17.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.17.1": {
"node_abi": 83,
"v8": "8.4"
},
"14.17.2": {
"node_abi": 83,
"v8": "8.4"
},
"14.17.3": {
"node_abi": 83,
"v8": "8.4"
},
"14.17.4": {
"node_abi": 83,
"v8": "8.4"
},
"14.17.5": {
"node_abi": 83,
"v8": "8.4"
},
"14.17.6": {
"node_abi": 83,
"v8": "8.4"
},
"14.18.0": {
"node_abi": 83,
"v8": "8.4"
},
"14.18.1": {
"node_abi": 83,
"v8": "8.4"
},
"15.0.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.0.1": {
"node_abi": 88,
"v8": "8.6"
},
"15.1.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.2.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.2.1": {
"node_abi": 88,
"v8": "8.6"
},
"15.3.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.4.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.5.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.5.1": {
"node_abi": 88,
"v8": "8.6"
},
"15.6.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.7.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.8.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.9.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.10.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.11.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.12.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.13.0": {
"node_abi": 88,
"v8": "8.6"
},
"15.14.0": {
"node_abi": 88,
"v8": "8.6"
},
"16.0.0": {
"node_abi": 93,
"v8": "9.0"
},
"16.1.0": {
"node_abi": 93,
"v8": "9.0"
},
"16.2.0": {
"node_abi": 93,
"v8": "9.0"
},
"16.3.0": {
"node_abi": 93,
"v8": "9.0"
},
"16.4.0": {
"node_abi": 93,
"v8": "9.1"
},
"16.4.1": {
"node_abi": 93,
"v8": "9.1"
},
"16.4.2": {
"node_abi": 93,
"v8": "9.1"
},
"16.5.0": {
"node_abi": 93,
"v8": "9.1"
},
"16.6.0": {
"node_abi": 93,
"v8": "9.2"
},
"16.6.1": {
"node_abi": 93,
"v8": "9.2"
},
"16.6.2": {
"node_abi": 93,
"v8": "9.2"
},
"16.7.0": {
"node_abi": 93,
"v8": "9.2"
},
"16.8.0": {
"node_abi": 93,
"v8": "9.2"
},
"16.9.0": {
"node_abi": 93,
"v8": "9.3"
},
"16.9.1": {
"node_abi": 93,
"v8": "9.3"
},
"16.10.0": {
"node_abi": 93,
"v8": "9.3"
},
"16.11.0": {
"node_abi": 93,
"v8": "9.4"
},
"16.11.1": {
"node_abi": 93,
"v8": "9.4"
},
"16.12.0": {
"node_abi": 93,
"v8": "9.4"
},
"16.13.0": {
"node_abi": 93,
"v8": "9.4"
},
"17.0.0": {
"node_abi": 102,
"v8": "9.5"
},
"17.0.1": {
"node_abi": 102,
"v8": "9.5"
},
"17.1.0": {
"node_abi": 102,
"v8": "9.5"
}
}
\ No newline at end of file
'use strict';
module.exports = exports;
const fs = require('fs');
const path = require('path');
const win = process.platform === 'win32';
const existsSync = fs.existsSync || path.existsSync;
const cp = require('child_process');
// try to build up the complete path to node-gyp
/* priority:
- node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887)
- node-gyp on NODE_PATH
- node-gyp inside npm on NODE_PATH (ignore on iojs)
- node-gyp inside npm beside node exe
*/
function which_node_gyp() {
let node_gyp_bin;
if (process.env.npm_config_node_gyp) {
try {
node_gyp_bin = process.env.npm_config_node_gyp;
if (existsSync(node_gyp_bin)) {
return node_gyp_bin;
}
} catch (err) {
// do nothing
}
}
try {
const node_gyp_main = require.resolve('node-gyp'); // eslint-disable-line node/no-missing-require
node_gyp_bin = path.join(path.dirname(
path.dirname(node_gyp_main)),
'bin/node-gyp.js');
if (existsSync(node_gyp_bin)) {
return node_gyp_bin;
}
} catch (err) {
// do nothing
}
if (process.execPath.indexOf('iojs') === -1) {
try {
const npm_main = require.resolve('npm'); // eslint-disable-line node/no-missing-require
node_gyp_bin = path.join(path.dirname(
path.dirname(npm_main)),
'node_modules/node-gyp/bin/node-gyp.js');
if (existsSync(node_gyp_bin)) {
return node_gyp_bin;
}
} catch (err) {
// do nothing
}
}
const npm_base = path.join(path.dirname(
path.dirname(process.execPath)),
'lib/node_modules/npm/');
node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js');
if (existsSync(node_gyp_bin)) {
return node_gyp_bin;
}
}
module.exports.run_gyp = function(args, opts, callback) {
let shell_cmd = '';
const cmd_args = [];
if (opts.runtime && opts.runtime === 'node-webkit') {
shell_cmd = 'nw-gyp';
if (win) shell_cmd += '.cmd';
} else {
const node_gyp_path = which_node_gyp();
if (node_gyp_path) {
shell_cmd = process.execPath;
cmd_args.push(node_gyp_path);
} else {
shell_cmd = 'node-gyp';
if (win) shell_cmd += '.cmd';
}
}
const final_args = cmd_args.concat(args);
const cmd = cp.spawn(shell_cmd, final_args, { cwd: undefined, env: process.env, stdio: [0, 1, 2] });
cmd.on('error', (err) => {
if (err) {
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ')'));
}
callback(null, opts);
});
cmd.on('close', (code) => {
if (code && code !== 0) {
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + code + ')'));
}
callback(null, opts);
});
};
'use strict';
module.exports = exports = handle_gyp_opts;
const versioning = require('./versioning.js');
const napi = require('./napi.js');
/*
Here we gather node-pre-gyp generated options (from versioning) and pass them along to node-gyp.
We massage the args and options slightly to account for differences in what commands mean between
node-pre-gyp and node-gyp (e.g. see the difference between "build" and "rebuild" below)
Keep in mind: the values inside `argv` and `gyp.opts` below are different depending on whether
node-pre-gyp is called directory, or if it is called in a `run-script` phase of npm.
We also try to preserve any command line options that might have been passed to npm or node-pre-gyp.
But this is fairly difficult without passing way to much through. For example `gyp.opts` contains all
the process.env and npm pushes a lot of variables into process.env which node-pre-gyp inherits. So we have
to be very selective about what we pass through.
For example:
`npm install --build-from-source` will give:
argv == [ 'rebuild' ]
gyp.opts.argv == { remain: [ 'install' ],
cooked: [ 'install', '--fallback-to-build' ],
original: [ 'install', '--fallback-to-build' ] }
`./bin/node-pre-gyp build` will give:
argv == []
gyp.opts.argv == { remain: [ 'build' ],
cooked: [ 'build' ],
original: [ '-C', 'test/app1', 'build' ] }
*/
// select set of node-pre-gyp versioning info
// to share with node-gyp
const share_with_node_gyp = [
'module',
'module_name',
'module_path',
'napi_version',
'node_abi_napi',
'napi_build_version',
'node_napi_label'
];
function handle_gyp_opts(gyp, argv, callback) {
// Collect node-pre-gyp specific variables to pass to node-gyp
const node_pre_gyp_options = [];
// generate custom node-pre-gyp versioning info
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
const opts = versioning.evaluate(gyp.package_json, gyp.opts, napi_build_version);
share_with_node_gyp.forEach((key) => {
const val = opts[key];
if (val) {
node_pre_gyp_options.push('--' + key + '=' + val);
} else if (key === 'napi_build_version') {
node_pre_gyp_options.push('--' + key + '=0');
} else {
if (key !== 'napi_version' && key !== 'node_abi_napi')
return callback(new Error('Option ' + key + ' required but not found by node-pre-gyp'));
}
});
// Collect options that follow the special -- which disables nopt parsing
const unparsed_options = [];
let double_hyphen_found = false;
gyp.opts.argv.original.forEach((opt) => {
if (double_hyphen_found) {
unparsed_options.push(opt);
}
if (opt === '--') {
double_hyphen_found = true;
}
});
// We try respect and pass through remaining command
// line options (like --foo=bar) to node-gyp
const cooked = gyp.opts.argv.cooked;
const node_gyp_options = [];
cooked.forEach((value) => {
if (value.length > 2 && value.slice(0, 2) === '--') {
const key = value.slice(2);
const val = cooked[cooked.indexOf(value) + 1];
if (val && val.indexOf('--') === -1) { // handle '--foo=bar' or ['--foo','bar']
node_gyp_options.push('--' + key + '=' + val);
} else { // pass through --foo
node_gyp_options.push(value);
}
}
});
const result = { 'opts': opts, 'gyp': node_gyp_options, 'pre': node_pre_gyp_options, 'unparsed': unparsed_options };
return callback(null, result);
}
'use strict';
const fs = require('fs');
module.exports = exports;
const versionArray = process.version
.substr(1)
.replace(/-.*$/, '')
.split('.')
.map((item) => {
return +item;
});
const napi_multiple_commands = [
'build',
'clean',
'configure',
'package',
'publish',
'reveal',
'testbinary',
'testpackage',
'unpublish'
];
const napi_build_version_tag = 'napi_build_version=';
module.exports.get_napi_version = function() {
// returns the non-zero numeric napi version or undefined if napi is not supported.
// correctly supporting target requires an updated cross-walk
let version = process.versions.napi; // can be undefined
if (!version) { // this code should never need to be updated
if (versionArray[0] === 9 && versionArray[1] >= 3) version = 2; // 9.3.0+
else if (versionArray[0] === 8) version = 1; // 8.0.0+
}
return version;
};
module.exports.get_napi_version_as_string = function(target) {
// returns the napi version as a string or an empty string if napi is not supported.
const version = module.exports.get_napi_version(target);
return version ? '' + version : '';
};
module.exports.validate_package_json = function(package_json, opts) { // throws Error
const binary = package_json.binary;
const module_path_ok = pathOK(binary.module_path);
const remote_path_ok = pathOK(binary.remote_path);
const package_name_ok = pathOK(binary.package_name);
const napi_build_versions = module.exports.get_napi_build_versions(package_json, opts, true);
const napi_build_versions_raw = module.exports.get_napi_build_versions_raw(package_json);
if (napi_build_versions) {
napi_build_versions.forEach((napi_build_version)=> {
if (!(parseInt(napi_build_version, 10) === napi_build_version && napi_build_version > 0)) {
throw new Error('All values specified in napi_versions must be positive integers.');
}
});
}
if (napi_build_versions && (!module_path_ok || (!remote_path_ok && !package_name_ok))) {
throw new Error('When napi_versions is specified; module_path and either remote_path or ' +
"package_name must contain the substitution string '{napi_build_version}`.");
}
if ((module_path_ok || remote_path_ok || package_name_ok) && !napi_build_versions_raw) {
throw new Error("When the substitution string '{napi_build_version}` is specified in " +
'module_path, remote_path, or package_name; napi_versions must also be specified.');
}
if (napi_build_versions && !module.exports.get_best_napi_build_version(package_json, opts) &&
module.exports.build_napi_only(package_json)) {
throw new Error(
'The Node-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' +
'This module supports Node-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' +
'This Node instance cannot run this module.');
}
if (napi_build_versions_raw && !napi_build_versions && module.exports.build_napi_only(package_json)) {
throw new Error(
'The Node-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' +
'This module supports Node-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' +
'This Node instance cannot run this module.');
}
};
function pathOK(path) {
return path && (path.indexOf('{napi_build_version}') !== -1 || path.indexOf('{node_napi_label}') !== -1);
}
module.exports.expand_commands = function(package_json, opts, commands) {
const expanded_commands = [];
const napi_build_versions = module.exports.get_napi_build_versions(package_json, opts);
commands.forEach((command)=> {
if (napi_build_versions && command.name === 'install') {
const napi_build_version = module.exports.get_best_napi_build_version(package_json, opts);
const args = napi_build_version ? [napi_build_version_tag + napi_build_version] : [];
expanded_commands.push({ name: command.name, args: args });
} else if (napi_build_versions && napi_multiple_commands.indexOf(command.name) !== -1) {
napi_build_versions.forEach((napi_build_version)=> {
const args = command.args.slice();
args.push(napi_build_version_tag + napi_build_version);
expanded_commands.push({ name: command.name, args: args });
});
} else {
expanded_commands.push(command);
}
});
return expanded_commands;
};
module.exports.get_napi_build_versions = function(package_json, opts, warnings) { // opts may be undefined
const log = require('npmlog');
let napi_build_versions = [];
const supported_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined);
// remove duplicates, verify each napi version can actaully be built
if (package_json.binary && package_json.binary.napi_versions) {
package_json.binary.napi_versions.forEach((napi_version) => {
const duplicated = napi_build_versions.indexOf(napi_version) !== -1;
if (!duplicated && supported_napi_version && napi_version <= supported_napi_version) {
napi_build_versions.push(napi_version);
} else if (warnings && !duplicated && supported_napi_version) {
log.info('This Node instance does not support builds for Node-API version', napi_version);
}
});
}
if (opts && opts['build-latest-napi-version-only']) {
let latest_version = 0;
napi_build_versions.forEach((napi_version) => {
if (napi_version > latest_version) latest_version = napi_version;
});
napi_build_versions = latest_version ? [latest_version] : [];
}
return napi_build_versions.length ? napi_build_versions : undefined;
};
module.exports.get_napi_build_versions_raw = function(package_json) {
const napi_build_versions = [];
// remove duplicates
if (package_json.binary && package_json.binary.napi_versions) {
package_json.binary.napi_versions.forEach((napi_version) => {
if (napi_build_versions.indexOf(napi_version) === -1) {
napi_build_versions.push(napi_version);
}
});
}
return napi_build_versions.length ? napi_build_versions : undefined;
};
module.exports.get_command_arg = function(napi_build_version) {
return napi_build_version_tag + napi_build_version;
};
module.exports.get_napi_build_version_from_command_args = function(command_args) {
for (let i = 0; i < command_args.length; i++) {
const arg = command_args[i];
if (arg.indexOf(napi_build_version_tag) === 0) {
return parseInt(arg.substr(napi_build_version_tag.length), 10);
}
}
return undefined;
};
module.exports.swap_build_dir_out = function(napi_build_version) {
if (napi_build_version) {
const rm = require('rimraf');
rm.sync(module.exports.get_build_dir(napi_build_version));
fs.renameSync('build', module.exports.get_build_dir(napi_build_version));
}
};
module.exports.swap_build_dir_in = function(napi_build_version) {
if (napi_build_version) {
const rm = require('rimraf');
rm.sync('build');
fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build');
}
};
module.exports.get_build_dir = function(napi_build_version) {
return 'build-tmp-napi-v' + napi_build_version;
};
module.exports.get_best_napi_build_version = function(package_json, opts) {
let best_napi_build_version = 0;
const napi_build_versions = module.exports.get_napi_build_versions(package_json, opts);
if (napi_build_versions) {
const our_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined);
napi_build_versions.forEach((napi_build_version)=> {
if (napi_build_version > best_napi_build_version &&
napi_build_version <= our_napi_version) {
best_napi_build_version = napi_build_version;
}
});
}
return best_napi_build_version === 0 ? undefined : best_napi_build_version;
};
module.exports.build_napi_only = function(package_json) {
return package_json.binary && package_json.binary.package_name &&
package_json.binary.package_name.indexOf('{node_napi_label}') === -1;
};
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Node-webkit-based module test</title>
<script>
function nwModuleTest(){
var util = require('util');
var moduleFolder = require('nw.gui').App.argv[0];
try {
require(moduleFolder);
} catch(e) {
if( process.platform !== 'win32' ){
util.log('nw-pre-gyp error:');
util.log(e.stack);
}
process.exit(1);
}
process.exit(0);
}
</script>
</head>
<body onload="nwModuleTest()">
<h1>Node-webkit-based module test</h1>
</body>
</html>
{
"main": "index.html",
"name": "nw-pre-gyp-module-test",
"description": "Node-webkit-based module test.",
"version": "0.0.1",
"window": {
"show": false
}
}
'use strict';
module.exports = exports;
const url = require('url');
const fs = require('fs');
const path = require('path');
module.exports.detect = function(opts, config) {
const to = opts.hosted_path;
const uri = url.parse(to);
config.prefix = (!uri.pathname || uri.pathname === '/') ? '' : uri.pathname.replace('/', '');
if (opts.bucket && opts.region) {
config.bucket = opts.bucket;
config.region = opts.region;
config.endpoint = opts.host;
config.s3ForcePathStyle = opts.s3ForcePathStyle;
} else {
const parts = uri.hostname.split('.s3');
const bucket = parts[0];
if (!bucket) {
return;
}
if (!config.bucket) {
config.bucket = bucket;
}
if (!config.region) {
const region = parts[1].slice(1).split('.')[0];
if (region === 'amazonaws') {
config.region = 'us-east-1';
} else {
config.region = region;
}
}
}
};
module.exports.get_s3 = function(config) {
if (process.env.node_pre_gyp_mock_s3) {
// here we're mocking. node_pre_gyp_mock_s3 is the scratch directory
// for the mock code.
const AWSMock = require('mock-aws-s3');
const os = require('os');
AWSMock.config.basePath = `${os.tmpdir()}/mock`;
const s3 = AWSMock.S3();
// wrapped callback maker. fs calls return code of ENOENT but AWS.S3 returns
// NotFound.
const wcb = (fn) => (err, ...args) => {
if (err && err.code === 'ENOENT') {
err.code = 'NotFound';
}
return fn(err, ...args);
};
return {
listObjects(params, callback) {
return s3.listObjects(params, wcb(callback));
},
headObject(params, callback) {
return s3.headObject(params, wcb(callback));
},
deleteObject(params, callback) {
return s3.deleteObject(params, wcb(callback));
},
putObject(params, callback) {
return s3.putObject(params, wcb(callback));
}
};
}
// if not mocking then setup real s3.
const AWS = require('aws-sdk');
AWS.config.update(config);
const s3 = new AWS.S3();
// need to change if additional options need to be specified.
return {
listObjects(params, callback) {
return s3.listObjects(params, callback);
},
headObject(params, callback) {
return s3.headObject(params, callback);
},
deleteObject(params, callback) {
return s3.deleteObject(params, callback);
},
putObject(params, callback) {
return s3.putObject(params, callback);
}
};
};
//
// function to get the mocking control function. if not mocking it returns a no-op.
//
// if mocking it sets up the mock http interceptors that use the mocked s3 file system
// to fulfill reponses.
module.exports.get_mockS3Http = function() {
let mock_s3 = false;
if (!process.env.node_pre_gyp_mock_s3) {
return () => mock_s3;
}
const nock = require('nock');
// the bucket used for testing, as addressed by https.
const host = 'https://mapbox-node-pre-gyp-public-testing-bucket.s3.us-east-1.amazonaws.com';
const mockDir = process.env.node_pre_gyp_mock_s3 + '/mapbox-node-pre-gyp-public-testing-bucket';
// function to setup interceptors. they are "turned off" by setting mock_s3 to false.
const mock_http = () => {
// eslint-disable-next-line no-unused-vars
function get(uri, requestBody) {
const filepath = path.join(mockDir, uri.replace('%2B', '+'));
try {
fs.accessSync(filepath, fs.constants.R_OK);
} catch (e) {
return [404, 'not found\n'];
}
// the mock s3 functions just write to disk, so just read from it.
return [200, fs.createReadStream(filepath)];
}
// eslint-disable-next-line no-unused-vars
return nock(host)
.persist()
.get(() => mock_s3) // mock any uri for s3 when true
.reply(get);
};
// setup interceptors. they check the mock_s3 flag to determine whether to intercept.
mock_http(nock, host, mockDir);
// function to turn matching all requests to s3 on/off.
const mockS3Http = (action) => {
const previous = mock_s3;
if (action === 'off') {
mock_s3 = false;
} else if (action === 'on') {
mock_s3 = true;
} else if (action !== 'get') {
throw new Error(`illegal action for setMockHttp ${action}`);
}
return previous;
};
// call mockS3Http with the argument
// - 'on' - turn it on
// - 'off' - turn it off (used by fetch.test.js so it doesn't interfere with redirects)
// - 'get' - return true or false for 'on' or 'off'
return mockS3Http;
};
'use strict';
module.exports = exports;
const path = require('path');
const semver = require('semver');
const url = require('url');
const detect_libc = require('detect-libc');
const napi = require('./napi.js');
let abi_crosswalk;
// This is used for unit testing to provide a fake
// ABI crosswalk that emulates one that is not updated
// for the current version
if (process.env.NODE_PRE_GYP_ABI_CROSSWALK) {
abi_crosswalk = require(process.env.NODE_PRE_GYP_ABI_CROSSWALK);
} else {
abi_crosswalk = require('./abi_crosswalk.json');
}
const major_versions = {};
Object.keys(abi_crosswalk).forEach((v) => {
const major = v.split('.')[0];
if (!major_versions[major]) {
major_versions[major] = v;
}
});
function get_electron_abi(runtime, target_version) {
if (!runtime) {
throw new Error('get_electron_abi requires valid runtime arg');
}
if (typeof target_version === 'undefined') {
// erroneous CLI call
throw new Error('Empty target version is not supported if electron is the target.');
}
// Electron guarantees that patch version update won't break native modules.
const sem_ver = semver.parse(target_version);
return runtime + '-v' + sem_ver.major + '.' + sem_ver.minor;
}
module.exports.get_electron_abi = get_electron_abi;
function get_node_webkit_abi(runtime, target_version) {
if (!runtime) {
throw new Error('get_node_webkit_abi requires valid runtime arg');
}
if (typeof target_version === 'undefined') {
// erroneous CLI call
throw new Error('Empty target version is not supported if node-webkit is the target.');
}
return runtime + '-v' + target_version;
}
module.exports.get_node_webkit_abi = get_node_webkit_abi;
function get_node_abi(runtime, versions) {
if (!runtime) {
throw new Error('get_node_abi requires valid runtime arg');
}
if (!versions) {
throw new Error('get_node_abi requires valid process.versions object');
}
const sem_ver = semver.parse(versions.node);
if (sem_ver.major === 0 && sem_ver.minor % 2) { // odd series
// https://github.com/mapbox/node-pre-gyp/issues/124
return runtime + '-v' + versions.node;
} else {
// process.versions.modules added in >= v0.10.4 and v0.11.7
// https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e
return versions.modules ? runtime + '-v' + (+versions.modules) :
'v8-' + versions.v8.split('.').slice(0, 2).join('.');
}
}
module.exports.get_node_abi = get_node_abi;
function get_runtime_abi(runtime, target_version) {
if (!runtime) {
throw new Error('get_runtime_abi requires valid runtime arg');
}
if (runtime === 'node-webkit') {
return get_node_webkit_abi(runtime, target_version || process.versions['node-webkit']);
} else if (runtime === 'electron') {
return get_electron_abi(runtime, target_version || process.versions.electron);
} else {
if (runtime !== 'node') {
throw new Error("Unknown Runtime: '" + runtime + "'");
}
if (!target_version) {
return get_node_abi(runtime, process.versions);
} else {
let cross_obj;
// abi_crosswalk generated with ./scripts/abi_crosswalk.js
if (abi_crosswalk[target_version]) {
cross_obj = abi_crosswalk[target_version];
} else {
const target_parts = target_version.split('.').map((i) => { return +i; });
if (target_parts.length !== 3) { // parse failed
throw new Error('Unknown target version: ' + target_version);
}
/*
The below code tries to infer the last known ABI compatible version
that we have recorded in the abi_crosswalk.json when an exact match
is not possible. The reasons for this to exist are complicated:
- We support passing --target to be able to allow developers to package binaries for versions of node
that are not the same one as they are running. This might also be used in combination with the
--target_arch or --target_platform flags to also package binaries for alternative platforms
- When --target is passed we can't therefore determine the ABI (process.versions.modules) from the node
version that is running in memory
- So, therefore node-pre-gyp keeps an "ABI crosswalk" (lib/util/abi_crosswalk.json) to be able to look
this info up for all versions
- But we cannot easily predict what the future ABI will be for released versions
- And node-pre-gyp needs to be a `bundledDependency` in apps that depend on it in order to work correctly
by being fully available at install time.
- So, the speed of node releases and the bundled nature of node-pre-gyp mean that a new node-pre-gyp release
need to happen for every node.js/io.js/node-webkit/nw.js/atom-shell/etc release that might come online if
you want the `--target` flag to keep working for the latest version
- Which is impractical ^^
- Hence the below code guesses about future ABI to make the need to update node-pre-gyp less demanding.
In practice then you can have a dependency of your app like `node-sqlite3` that bundles a `node-pre-gyp` that
only knows about node v0.10.33 in the `abi_crosswalk.json` but target node v0.10.34 (which is assumed to be
ABI compatible with v0.10.33).
TODO: use semver module instead of custom version parsing
*/
const major = target_parts[0];
let minor = target_parts[1];
let patch = target_parts[2];
// io.js: yeah if node.js ever releases 1.x this will break
// but that is unlikely to happen: https://github.com/iojs/io.js/pull/253#issuecomment-69432616
if (major === 1) {
// look for last release that is the same major version
// e.g. we assume io.js 1.x is ABI compatible with >= 1.0.0
while (true) {
if (minor > 0) --minor;
if (patch > 0) --patch;
const new_iojs_target = '' + major + '.' + minor + '.' + patch;
if (abi_crosswalk[new_iojs_target]) {
cross_obj = abi_crosswalk[new_iojs_target];
console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
console.log('Warning: but node-pre-gyp successfully choose ' + new_iojs_target + ' as ABI compatible target');
break;
}
if (minor === 0 && patch === 0) {
break;
}
}
} else if (major >= 2) {
// look for last release that is the same major version
if (major_versions[major]) {
cross_obj = abi_crosswalk[major_versions[major]];
console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
console.log('Warning: but node-pre-gyp successfully choose ' + major_versions[major] + ' as ABI compatible target');
}
} else if (major === 0) { // node.js
if (target_parts[1] % 2 === 0) { // for stable/even node.js series
// look for the last release that is the same minor release
// e.g. we assume node 0.10.x is ABI compatible with >= 0.10.0
while (--patch > 0) {
const new_node_target = '' + major + '.' + minor + '.' + patch;
if (abi_crosswalk[new_node_target]) {
cross_obj = abi_crosswalk[new_node_target];
console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
console.log('Warning: but node-pre-gyp successfully choose ' + new_node_target + ' as ABI compatible target');
break;
}
}
}
}
}
if (!cross_obj) {
throw new Error('Unsupported target version: ' + target_version);
}
// emulate process.versions
const versions_obj = {
node: target_version,
v8: cross_obj.v8 + '.0',
// abi_crosswalk uses 1 for node versions lacking process.versions.modules
// process.versions.modules added in >= v0.10.4 and v0.11.7
modules: cross_obj.node_abi > 1 ? cross_obj.node_abi : undefined
};
return get_node_abi(runtime, versions_obj);
}
}
}
module.exports.get_runtime_abi = get_runtime_abi;
const required_parameters = [
'module_name',
'module_path',
'host'
];
function validate_config(package_json, opts) {
const msg = package_json.name + ' package.json is not node-pre-gyp ready:\n';
const missing = [];
if (!package_json.main) {
missing.push('main');
}
if (!package_json.version) {
missing.push('version');
}
if (!package_json.name) {
missing.push('name');
}
if (!package_json.binary) {
missing.push('binary');
}
const o = package_json.binary;
if (o) {
required_parameters.forEach((p) => {
if (!o[p] || typeof o[p] !== 'string') {
missing.push('binary.' + p);
}
});
}
if (missing.length >= 1) {
throw new Error(msg + 'package.json must declare these properties: \n' + missing.join('\n'));
}
if (o) {
// enforce https over http
const protocol = url.parse(o.host).protocol;
if (protocol === 'http:') {
throw new Error("'host' protocol (" + protocol + ") is invalid - only 'https:' is accepted");
}
}
napi.validate_package_json(package_json, opts);
}
module.exports.validate_config = validate_config;
function eval_template(template, opts) {
Object.keys(opts).forEach((key) => {
const pattern = '{' + key + '}';
while (template.indexOf(pattern) > -1) {
template = template.replace(pattern, opts[key]);
}
});
return template;
}
// url.resolve needs single trailing slash
// to behave correctly, otherwise a double slash
// may end up in the url which breaks requests
// and a lacking slash may not lead to proper joining
function fix_slashes(pathname) {
if (pathname.slice(-1) !== '/') {
return pathname + '/';
}
return pathname;
}
// remove double slashes
// note: path.normalize will not work because
// it will convert forward to back slashes
function drop_double_slashes(pathname) {
return pathname.replace(/\/\//g, '/');
}
function get_process_runtime(versions) {
let runtime = 'node';
if (versions['node-webkit']) {
runtime = 'node-webkit';
} else if (versions.electron) {
runtime = 'electron';
}
return runtime;
}
module.exports.get_process_runtime = get_process_runtime;
const default_package_name = '{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz';
const default_remote_path = '';
module.exports.evaluate = function(package_json, options, napi_build_version) {
options = options || {};
validate_config(package_json, options); // options is a suitable substitute for opts in this case
const v = package_json.version;
const module_version = semver.parse(v);
const runtime = options.runtime || get_process_runtime(process.versions);
const opts = {
name: package_json.name,
configuration: options.debug ? 'Debug' : 'Release',
debug: options.debug,
module_name: package_json.binary.module_name,
version: module_version.version,
prerelease: module_version.prerelease.length ? module_version.prerelease.join('.') : '',
build: module_version.build.length ? module_version.build.join('.') : '',
major: module_version.major,
minor: module_version.minor,
patch: module_version.patch,
runtime: runtime,
node_abi: get_runtime_abi(runtime, options.target),
node_abi_napi: napi.get_napi_version(options.target) ? 'napi' : get_runtime_abi(runtime, options.target),
napi_version: napi.get_napi_version(options.target), // non-zero numeric, undefined if unsupported
napi_build_version: napi_build_version || '',
node_napi_label: napi_build_version ? 'napi-v' + napi_build_version : get_runtime_abi(runtime, options.target),
target: options.target || '',
platform: options.target_platform || process.platform,
target_platform: options.target_platform || process.platform,
arch: options.target_arch || process.arch,
target_arch: options.target_arch || process.arch,
libc: options.target_libc || detect_libc.familySync() || 'unknown',
module_main: package_json.main,
toolset: options.toolset || '', // address https://github.com/mapbox/node-pre-gyp/issues/119
bucket: package_json.binary.bucket,
region: package_json.binary.region,
s3ForcePathStyle: package_json.binary.s3ForcePathStyle || false
};
// support host mirror with npm config `--{module_name}_binary_host_mirror`
// e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25
// > npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
const validModuleName = opts.module_name.replace('-', '_');
const host = process.env['npm_config_' + validModuleName + '_binary_host_mirror'] || package_json.binary.host;
opts.host = fix_slashes(eval_template(host, opts));
opts.module_path = eval_template(package_json.binary.module_path, opts);
// now we resolve the module_path to ensure it is absolute so that binding.gyp variables work predictably
if (options.module_root) {
// resolve relative to known module root: works for pre-binding require
opts.module_path = path.join(options.module_root, opts.module_path);
} else {
// resolve relative to current working directory: works for node-pre-gyp commands
opts.module_path = path.resolve(opts.module_path);
}
opts.module = path.join(opts.module_path, opts.module_name + '.node');
opts.remote_path = package_json.binary.remote_path ? drop_double_slashes(fix_slashes(eval_template(package_json.binary.remote_path, opts))) : default_remote_path;
const package_name = package_json.binary.package_name ? package_json.binary.package_name : default_package_name;
opts.package_name = eval_template(package_name, opts);
opts.staged_tarball = path.join('build/stage', opts.remote_path, opts.package_name);
opts.hosted_path = url.resolve(opts.host, opts.remote_path);
opts.hosted_tarball = url.resolve(opts.hosted_path, opts.package_name);
return opts;
};
{
"name": "@mapbox/node-pre-gyp",
"description": "Node.js native addon binary install tool",
"version": "1.0.11",
"keywords": [
"native",
"addon",
"module",
"c",
"c++",
"bindings",
"binary"
],
"license": "BSD-3-Clause",
"author": "Dane Springmeyer <dane@mapbox.com>",
"repository": {
"type": "git",
"url": "git://github.com/mapbox/node-pre-gyp.git"
},
"bin": "./bin/node-pre-gyp",
"main": "./lib/node-pre-gyp.js",
"dependencies": {
"detect-libc": "^2.0.0",
"https-proxy-agent": "^5.0.0",
"make-dir": "^3.1.0",
"node-fetch": "^2.6.7",
"nopt": "^5.0.0",
"npmlog": "^5.0.1",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"tar": "^6.1.11"
},
"devDependencies": {
"@mapbox/cloudfriend": "^5.1.0",
"@mapbox/eslint-config-mapbox": "^3.0.0",
"aws-sdk": "^2.1087.0",
"codecov": "^3.8.3",
"eslint": "^7.32.0",
"eslint-plugin-node": "^11.1.0",
"mock-aws-s3": "^4.0.2",
"nock": "^12.0.3",
"node-addon-api": "^4.3.0",
"nyc": "^15.1.0",
"tape": "^5.5.2",
"tar-fs": "^2.1.1"
},
"nyc": {
"all": true,
"skip-full": false,
"exclude": [
"test/**"
]
},
"scripts": {
"coverage": "nyc --all --include index.js --include lib/ npm test",
"upload-coverage": "nyc report --reporter json && codecov --clear --flags=unit --file=./coverage/coverage-final.json",
"lint": "eslint bin/node-pre-gyp lib/*js lib/util/*js test/*js scripts/*js",
"fix": "npm run lint -- --fix",
"update-crosswalk": "node scripts/abi_crosswalk.js",
"test": "tape test/*test.js"
}
}
This software is dual-licensed under the ISC and MIT licenses.
You may use this software under EITHER of the following licenses.
----------
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
----------
Copyright Isaac Z. Schlueter and Contributors
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
# abbrev-js
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
Usage:
var abbrev = require("abbrev");
abbrev("foo", "fool", "folding", "flop");
// returns:
{ fl: 'flop'
, flo: 'flop'
, flop: 'flop'
, fol: 'folding'
, fold: 'folding'
, foldi: 'folding'
, foldin: 'folding'
, folding: 'folding'
, foo: 'foo'
, fool: 'fool'
}
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
module.exports = exports = abbrev.abbrev = abbrev
abbrev.monkeyPatch = monkeyPatch
function monkeyPatch () {
Object.defineProperty(Array.prototype, 'abbrev', {
value: function () { return abbrev(this) },
enumerable: false, configurable: true, writable: true
})
Object.defineProperty(Object.prototype, 'abbrev', {
value: function () { return abbrev(Object.keys(this)) },
enumerable: false, configurable: true, writable: true
})
}
function abbrev (list) {
if (arguments.length !== 1 || !Array.isArray(list)) {
list = Array.prototype.slice.call(arguments, 0)
}
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
}
// sort them lexicographically, so that they're next to their nearest kin
args = args.sort(lexSort)
// walk through each, seeing how much it has in common with the next and previous
var abbrevs = {}
, prev = ""
for (var i = 0, l = args.length ; i < l ; i ++) {
var current = args[i]
, next = args[i + 1] || ""
, nextMatches = true
, prevMatches = true
if (current === next) continue
for (var j = 0, cl = current.length ; j < cl ; j ++) {
var curChar = current.charAt(j)
nextMatches = nextMatches && curChar === next.charAt(j)
prevMatches = prevMatches && curChar === prev.charAt(j)
if (!nextMatches && !prevMatches) {
j ++
break
}
}
prev = current
if (j === cl) {
abbrevs[current] = current
continue
}
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
abbrevs[a] = current
a += current.charAt(j)
}
}
return abbrevs
}
function lexSort (a, b) {
return a === b ? 0 : a > b ? 1 : -1
}
{
"name": "abbrev",
"version": "1.1.1",
"description": "Like ruby's abbrev module, but in js",
"author": "Isaac Z. Schlueter <i@izs.me>",
"main": "abbrev.js",
"scripts": {
"test": "tap test.js --100",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags"
},
"repository": "http://github.com/isaacs/abbrev-js",
"license": "ISC",
"devDependencies": {
"tap": "^10.1"
},
"files": [
"abbrev.js"
]
}
1.3.8 / 2022-02-02
==================
* deps: mime-types@~2.1.34
- deps: mime-db@~1.51.0
* deps: negotiator@0.6.3
1.3.7 / 2019-04-29
==================
* deps: negotiator@0.6.2
- Fix sorting charset, encoding, and language with extra parameters
1.3.6 / 2019-04-28
==================
* deps: mime-types@~2.1.24
- deps: mime-db@~1.40.0
1.3.5 / 2018-02-28
==================
* deps: mime-types@~2.1.18
- deps: mime-db@~1.33.0
1.3.4 / 2017-08-22
==================
* deps: mime-types@~2.1.16
- deps: mime-db@~1.29.0
1.3.3 / 2016-05-02
==================
* deps: mime-types@~2.1.11
- deps: mime-db@~1.23.0
* deps: negotiator@0.6.1
- perf: improve `Accept` parsing speed
- perf: improve `Accept-Charset` parsing speed
- perf: improve `Accept-Encoding` parsing speed
- perf: improve `Accept-Language` parsing speed
1.3.2 / 2016-03-08
==================
* deps: mime-types@~2.1.10
- Fix extension of `application/dash+xml`
- Update primary extension for `audio/mp4`
- deps: mime-db@~1.22.0
1.3.1 / 2016-01-19
==================
* deps: mime-types@~2.1.9
- deps: mime-db@~1.21.0
1.3.0 / 2015-09-29
==================
* deps: mime-types@~2.1.7
- deps: mime-db@~1.19.0
* deps: negotiator@0.6.0
- Fix including type extensions in parameters in `Accept` parsing
- Fix parsing `Accept` parameters with quoted equals
- Fix parsing `Accept` parameters with quoted semicolons
- Lazy-load modules from main entry point
- perf: delay type concatenation until needed
- perf: enable strict mode
- perf: hoist regular expressions
- perf: remove closures getting spec properties
- perf: remove a closure from media type parsing
- perf: remove property delete from media type parsing
1.2.13 / 2015-09-06
===================
* deps: mime-types@~2.1.6
- deps: mime-db@~1.18.0
1.2.12 / 2015-07-30
===================
* deps: mime-types@~2.1.4
- deps: mime-db@~1.16.0
1.2.11 / 2015-07-16
===================
* deps: mime-types@~2.1.3
- deps: mime-db@~1.15.0
1.2.10 / 2015-07-01
===================
* deps: mime-types@~2.1.2
- deps: mime-db@~1.14.0
1.2.9 / 2015-06-08
==================
* deps: mime-types@~2.1.1
- perf: fix deopt during mapping
1.2.8 / 2015-06-07
==================
* deps: mime-types@~2.1.0
- deps: mime-db@~1.13.0
* perf: avoid argument reassignment & argument slice
* perf: avoid negotiator recursive construction
* perf: enable strict mode
* perf: remove unnecessary bitwise operator
1.2.7 / 2015-05-10
==================
* deps: negotiator@0.5.3
- Fix media type parameter matching to be case-insensitive
1.2.6 / 2015-05-07
==================
* deps: mime-types@~2.0.11
- deps: mime-db@~1.9.1
* deps: negotiator@0.5.2
- Fix comparing media types with quoted values
- Fix splitting media types with quoted commas
1.2.5 / 2015-03-13
==================
* deps: mime-types@~2.0.10
- deps: mime-db@~1.8.0
1.2.4 / 2015-02-14
==================
* Support Node.js 0.6
* deps: mime-types@~2.0.9
- deps: mime-db@~1.7.0
* deps: negotiator@0.5.1
- Fix preference sorting to be stable for long acceptable lists
1.2.3 / 2015-01-31
==================
* deps: mime-types@~2.0.8
- deps: mime-db@~1.6.0
1.2.2 / 2014-12-30
==================
* deps: mime-types@~2.0.7
- deps: mime-db@~1.5.0
1.2.1 / 2014-12-30
==================
* deps: mime-types@~2.0.5
- deps: mime-db@~1.3.1
1.2.0 / 2014-12-19
==================
* deps: negotiator@0.5.0
- Fix list return order when large accepted list
- Fix missing identity encoding when q=0 exists
- Remove dynamic building of Negotiator class
1.1.4 / 2014-12-10
==================
* deps: mime-types@~2.0.4
- deps: mime-db@~1.3.0
1.1.3 / 2014-11-09
==================
* deps: mime-types@~2.0.3
- deps: mime-db@~1.2.0
1.1.2 / 2014-10-14
==================
* deps: negotiator@0.4.9
- Fix error when media type has invalid parameter
1.1.1 / 2014-09-28
==================
* deps: mime-types@~2.0.2
- deps: mime-db@~1.1.0
* deps: negotiator@0.4.8
- Fix all negotiations to be case-insensitive
- Stable sort preferences of same quality according to client order
1.1.0 / 2014-09-02
==================
* update `mime-types`
1.0.7 / 2014-07-04
==================
* Fix wrong type returned from `type` when match after unknown extension
1.0.6 / 2014-06-24
==================
* deps: negotiator@0.4.7
1.0.5 / 2014-06-20
==================
* fix crash when unknown extension given
1.0.4 / 2014-06-19
==================
* use `mime-types`
1.0.3 / 2014-06-11
==================
* deps: negotiator@0.4.6
- Order by specificity when quality is the same
1.0.2 / 2014-05-29
==================
* Fix interpretation when header not in request
* deps: pin negotiator@0.4.5
1.0.1 / 2014-01-18
==================
* Identity encoding isn't always acceptable
* deps: negotiator@~0.4.0
1.0.0 / 2013-12-27
==================
* Genesis
(The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# accepts
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
In addition to negotiator, it allows:
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
as well as `('text/html', 'application/json')`.
- Allows type shorthands such as `json`.
- Returns `false` when no types match
- Treats non-existent headers as `*`
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh
$ npm install accepts
```
## API
```js
var accepts = require('accepts')
```
### accepts(req)
Create a new `Accepts` object for the given `req`.
#### .charset(charsets)
Return the first accepted charset. If nothing in `charsets` is accepted,
then `false` is returned.
#### .charsets()
Return the charsets that the request accepts, in the order of the client's
preference (most preferred first).
#### .encoding(encodings)
Return the first accepted encoding. If nothing in `encodings` is accepted,
then `false` is returned.
#### .encodings()
Return the encodings that the request accepts, in the order of the client's
preference (most preferred first).
#### .language(languages)
Return the first accepted language. If nothing in `languages` is accepted,
then `false` is returned.
#### .languages()
Return the languages that the request accepts, in the order of the client's
preference (most preferred first).
#### .type(types)
Return the first accepted type (and it is returned as the same text as what
appears in the `types` array). If nothing in `types` is accepted, then `false`
is returned.
The `types` array can contain full MIME types or file extensions. Any value
that is not a full MIME types is passed to `require('mime-types').lookup`.
#### .types()
Return the types that the request accepts, in the order of the client's
preference (most preferred first).
## Examples
### Simple type negotiation
This simple example shows how to use `accepts` to return a different typed
respond body based on what the client wants to accept. The server lists it's
preferences in order and will get back the best match between the client and
server.
```js
var accepts = require('accepts')
var http = require('http')
function app (req, res) {
var accept = accepts(req)
// the order of this list is significant; should be server preferred order
switch (accept.type(['json', 'html'])) {
case 'json':
res.setHeader('Content-Type', 'application/json')
res.write('{"hello":"world!"}')
break
case 'html':
res.setHeader('Content-Type', 'text/html')
res.write('<b>hello, world!</b>')
break
default:
// the fallback is text/plain, so no need to specify it above
res.setHeader('Content-Type', 'text/plain')
res.write('hello, world!')
break
}
res.end()
}
http.createServer(app).listen(3000)
```
You can test this out with the cURL program:
```sh
curl -I -H'Accept: text/html' http://localhost:3000/
```
## License
[MIT](LICENSE)
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
[node-version-image]: https://badgen.net/npm/node/accepts
[node-version-url]: https://nodejs.org/en/download
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
[npm-url]: https://npmjs.org/package/accepts
[npm-version-image]: https://badgen.net/npm/v/accepts
/*!
* accepts
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var Negotiator = require('negotiator')
var mime = require('mime-types')
/**
* Module exports.
* @public
*/
module.exports = Accepts
/**
* Create a new Accepts object for the given req.
*
* @param {object} req
* @public
*/
function Accepts (req) {
if (!(this instanceof Accepts)) {
return new Accepts(req)
}
this.headers = req.headers
this.negotiator = new Negotiator(req)
}
/**
* Check if the given `type(s)` is acceptable, returning
* the best match when true, otherwise `undefined`, in which
* case you should respond with 406 "Not Acceptable".
*
* The `type` value may be a single mime type string
* such as "application/json", the extension name
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
* or array is given the _best_ match, if any is returned.
*
* Examples:
*
* // Accept: text/html
* this.types('html');
* // => "html"
*
* // Accept: text/*, application/json
* this.types('html');
* // => "html"
* this.types('text/html');
* // => "text/html"
* this.types('json', 'text');
* // => "json"
* this.types('application/json');
* // => "application/json"
*
* // Accept: text/*, application/json
* this.types('image/png');
* this.types('png');
* // => undefined
*
* // Accept: text/*;q=.5, application/json
* this.types(['html', 'json']);
* this.types('html', 'json');
* // => "json"
*
* @param {String|Array} types...
* @return {String|Array|Boolean}
* @public
*/
Accepts.prototype.type =
Accepts.prototype.types = function (types_) {
var types = types_
// support flattened arguments
if (types && !Array.isArray(types)) {
types = new Array(arguments.length)
for (var i = 0; i < types.length; i++) {
types[i] = arguments[i]
}
}
// no types, return all requested types
if (!types || types.length === 0) {
return this.negotiator.mediaTypes()
}
// no accept header, return first given type
if (!this.headers.accept) {
return types[0]
}
var mimes = types.map(extToMime)
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
var first = accepts[0]
return first
? types[mimes.indexOf(first)]
: false
}
/**
* Return accepted encodings or best fit based on `encodings`.
*
* Given `Accept-Encoding: gzip, deflate`
* an array sorted by quality is returned:
*
* ['gzip', 'deflate']
*
* @param {String|Array} encodings...
* @return {String|Array}
* @public
*/
Accepts.prototype.encoding =
Accepts.prototype.encodings = function (encodings_) {
var encodings = encodings_
// support flattened arguments
if (encodings && !Array.isArray(encodings)) {
encodings = new Array(arguments.length)
for (var i = 0; i < encodings.length; i++) {
encodings[i] = arguments[i]
}
}
// no encodings, return all requested encodings
if (!encodings || encodings.length === 0) {
return this.negotiator.encodings()
}
return this.negotiator.encodings(encodings)[0] || false
}
/**
* Return accepted charsets or best fit based on `charsets`.
*
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
* an array sorted by quality is returned:
*
* ['utf-8', 'utf-7', 'iso-8859-1']
*
* @param {String|Array} charsets...
* @return {String|Array}
* @public
*/
Accepts.prototype.charset =
Accepts.prototype.charsets = function (charsets_) {
var charsets = charsets_
// support flattened arguments
if (charsets && !Array.isArray(charsets)) {
charsets = new Array(arguments.length)
for (var i = 0; i < charsets.length; i++) {
charsets[i] = arguments[i]
}
}
// no charsets, return all requested charsets
if (!charsets || charsets.length === 0) {
return this.negotiator.charsets()
}
return this.negotiator.charsets(charsets)[0] || false
}
/**
* Return accepted languages or best fit based on `langs`.
*
* Given `Accept-Language: en;q=0.8, es, pt`
* an array sorted by quality is returned:
*
* ['es', 'pt', 'en']
*
* @param {String|Array} langs...
* @return {Array|String}
* @public
*/
Accepts.prototype.lang =
Accepts.prototype.langs =
Accepts.prototype.language =
Accepts.prototype.languages = function (languages_) {
var languages = languages_
// support flattened arguments
if (languages && !Array.isArray(languages)) {
languages = new Array(arguments.length)
for (var i = 0; i < languages.length; i++) {
languages[i] = arguments[i]
}
}
// no languages, return all requested languages
if (!languages || languages.length === 0) {
return this.negotiator.languages()
}
return this.negotiator.languages(languages)[0] || false
}
/**
* Convert extnames to mime.
*
* @param {String} type
* @return {String}
* @private
*/
function extToMime (type) {
return type.indexOf('/') === -1
? mime.lookup(type)
: type
}
/**
* Check if mime is valid.
*
* @param {String} type
* @return {String}
* @private
*/
function validMime (type) {
return typeof type === 'string'
}
{
"name": "accepts",
"description": "Higher-level content negotiation",
"version": "1.3.8",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
],
"license": "MIT",
"repository": "jshttp/accepts",
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"devDependencies": {
"deep-equal": "1.0.1",
"eslint": "7.32.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-markdown": "2.2.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.3.1",
"eslint-plugin-standard": "4.1.0",
"mocha": "9.2.0",
"nyc": "15.1.0"
},
"files": [
"LICENSE",
"HISTORY.md",
"index.js"
],
"engines": {
"node": ">= 0.6"
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
},
"keywords": [
"content",
"negotiation",
"accept",
"accepts"
]
}