diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/natives | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) | |
download | wallet-core-bbff7403fbf46f9ad92240ac213df8d30ef31b64.tar.xz |
update packages
Diffstat (limited to 'node_modules/natives')
-rw-r--r-- | node_modules/natives/index.js | 51 | ||||
-rw-r--r-- | node_modules/natives/package.json | 12 |
2 files changed, 53 insertions, 10 deletions
diff --git a/node_modules/natives/index.js b/node_modules/natives/index.js index 67513909e..90950a0e8 100644 --- a/node_modules/natives/index.js +++ b/node_modules/natives/index.js @@ -10,9 +10,14 @@ var runInThisContext, ContextifyScript, Script /*istanbul ignore next*/ try { ContextifyScript = process.binding('contextify').ContextifyScript; - runInThisContext = function runInThisContext(code, options) { - var script = new ContextifyScript(code, options); - return script.runInThisContext(); + /*istanbul ignore next*/ + if (process.version.split('.')[0].length > 2) { // v10.0.0 and above + runInThisContext = vm.runInThisContext; + } else { + runInThisContext = function runInThisContext(code, options) { + var script = new ContextifyScript(code, options); + return script.runInThisContext(); + } } } catch (er) { Script = process.binding('evals').NodeScript; @@ -65,7 +70,11 @@ function req_ (id, cache) { return wrap[0] + script + wrap[1] }, wrapper: wrap, - _cache: cache + _cache: cache, + _source: natives, + nonInternalExists: function (id) { + return id.indexOf('internal/') !== 0; + } } } @@ -79,6 +88,28 @@ function req_ (id, cache) { if (cache[id]) { return cache[id].exports } + if (id === 'internal/bootstrap/loaders' || id === 'internal/process') { + // Provide just enough to keep `graceful-fs@3` working and tests passing. + // For now. + return { + internalBinding: function(name) { + if (name === 'types') { + return process.binding('util'); + } else { + try { + return process.binding(name); + } catch (e) {} + return {}; + } + }, + NativeModule: { + _source: process.binding('natives'), + nonInternalExists: function(id) { + return !id.startsWith('internal/'); + } + } + }; + } return req_(id, cache) } @@ -90,6 +121,11 @@ function req_ (id, cache) { } cache[id] = nm var fn + var setV8Flags = false + try { + require('v8').setFlagsFromString('--allow_natives_syntax') + setV8Flags = true + } catch (e) {} try { /* istanbul ignore else */ if (ContextifyScript) { @@ -105,6 +141,13 @@ function req_ (id, cache) { nm.loaded = true } finally { nm.loading = false + /*istanbul ignore next*/ + if (setV8Flags) { + // Ref: https://github.com/nodejs/node/blob/591a24b819d53a555463b1cbf9290a6d8bcc1bcb/lib/internal/bootstrap_node.js#L429-L434 + var re = /^--allow[-_]natives[-_]syntax$/ + if (!process.execArgv.some(function (s) { return re.test(s) })) + require('v8').setFlagsFromString('--noallow_natives_syntax') + } } return nm.exports diff --git a/node_modules/natives/package.json b/node_modules/natives/package.json index f1a72d23d..aa1e1bb97 100644 --- a/node_modules/natives/package.json +++ b/node_modules/natives/package.json @@ -1,23 +1,23 @@ { "name": "natives", - "version": "1.1.0", + "version": "1.1.5", "description": "Do stuff with Node.js's native JavaScript modules", "main": "index.js", "scripts": { - "test": "tap test/*.js --100" + "test": "tap test/*.js" }, "repository": { "type": "git", - "url": "git+https://github.com/isaacs/natives.git" + "url": "git+https://github.com/addaleax/natives.git" }, "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", "license": "ISC", "bugs": { - "url": "https://github.com/isaacs/natives/issues" + "url": "https://github.com/addaleax/natives/issues" }, - "homepage": "https://github.com/isaacs/natives#readme", + "homepage": "https://github.com/addaleax/natives#readme", "devDependencies": { - "tap": "^7.0.0" + "tap": "^11.0.0" }, "files": [ "index.js" |