|
|
|
@ -27,6 +27,25 @@ var deriveSandboxOrigin = function (unsafe, port) {
|
|
|
|
|
return url.origin;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var isRecentVersion = function () {
|
|
|
|
|
var V = process.version;
|
|
|
|
|
if (typeof(V) !== 'string') { return false; }
|
|
|
|
|
var parts = V.replace(/^v/, '').split('.').map(Number);
|
|
|
|
|
if (parts.length < 3) { return false; }
|
|
|
|
|
if (!parts.every(n => typeof(n) === 'number' && !isNaN(n))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (parts[0] < 16) { return false; }
|
|
|
|
|
if (parts[0] > 16) { return true; }
|
|
|
|
|
|
|
|
|
|
// v16
|
|
|
|
|
if (parts[1] < 14) { return false; }
|
|
|
|
|
if (parts[1] > 14) { return true; }
|
|
|
|
|
if (parts[2] >= 2) { return true; }
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports.create = function (config) {
|
|
|
|
|
var httpUnsafeOrigin = canonicalizeOrigin(config.httpUnsafeOrigin);
|
|
|
|
|
|
|
|
|
@ -53,6 +72,8 @@ module.exports.create = function (config) {
|
|
|
|
|
NO_SANDBOX: NO_SANDBOX,
|
|
|
|
|
httpSafePort: httpSafePort,
|
|
|
|
|
|
|
|
|
|
shouldUpdateNode: !isRecentVersion(),
|
|
|
|
|
|
|
|
|
|
version: Package.version,
|
|
|
|
|
installMethod: config.installMethod || undefined,
|
|
|
|
|
|
|
|
|
|