aboutsummaryrefslogtreecommitdiff
path: root/node_modules/natives
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/natives
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
downloadwallet-core-cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585.tar.xz
remove node_modules
Diffstat (limited to 'node_modules/natives')
-rw-r--r--node_modules/natives/README.md64
-rw-r--r--node_modules/natives/index.js158
-rw-r--r--node_modules/natives/package.json25
3 files changed, 0 insertions, 247 deletions
diff --git a/node_modules/natives/README.md b/node_modules/natives/README.md
deleted file mode 100644
index 6fc442435..000000000
--- a/node_modules/natives/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# natives
-
-Do stuff with Node.js's native JavaScript modules
-
-## Caveat
-
-Dear Beloved User,
-
-I feel compelled to give you a word of warning if you are considering
-using this module.
-
-This module lets you do some creative things with the JavaScript code
-in Node.js. There are some things here that are basically a recipe
-for memory leaks, or at the very least, being broken with each new
-release of Node, since none of these API surfaces are "technically"
-"supported" by the team managing the Node.js project.
-
-This module does not ship a _copy_ of Node's internals. It does its
-thing by using the exposed source code that lives in Node.js itself.
-So, running this on different versions of Node.js will produce
-different results.
-
-When your program is broken by changes to Node's internals, or when
-Node changes in such a way that this module becomes fundamentally
-broken, you will likely get little sympathy. Many people in the Node
-community consider this sort of behavior to be unwise and unseemly, if
-not outright hostile and morally wrong.
-
-At the very least, you probably just want to run Node with the
-(undocumented!) `--expose-internals` flag, rather than go to such
-lengths.
-
-Don't use unless you know what you're doing, or at least, are ok with
-the risks. Don't say I didn't warn you.
-
-Eternally Yours in OSS,
-Isaac Z. Schlueter
-
-## USAGE
-
-```javascript
-var natives = require('natives')
-
-// get the source code
-var fsCode = natives.source('fs')
-
-// get a evaluated copy of the module
-var fsCopy = natives.require('fs')
-
-// you can pass in a whitelist to NOT shim certain things
-var fsCopyWithNativeStreams = natives.require('fs', ['stream'])
-
-// note that this is not the same as the "real" fs
-assert(fsCopy !== require('fs'))
-
-// but it does have all the same entries
-fsCopy.readFileSync(__filename, 'utf8') // etc
-```
-
-## Another Caveat
-
-You can't use this to override `require("buffer")` because everything
-depends on `Buffer.isBuffer` working properly, so it's important for
-that one to be given a pass.
diff --git a/node_modules/natives/index.js b/node_modules/natives/index.js
deleted file mode 100644
index 90950a0e8..000000000
--- a/node_modules/natives/index.js
+++ /dev/null
@@ -1,158 +0,0 @@
-var natives = process.binding('natives')
-var module = require('module')
-var normalRequire = require
-exports.source = src
-exports.require = req
-var vm = require('vm')
-
-// fallback for 0.x support
-var runInThisContext, ContextifyScript, Script
-/*istanbul ignore next*/
-try {
- ContextifyScript = process.binding('contextify').ContextifyScript;
- /*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;
- runInThisContext = Script.runInThisContext;
-}
-
-var wrap = [
- '(function (exports, require, module, __filename, __dirname) { ',
- '\n});'
-];
-
-
-// Basically the same functionality as node's (buried deep)
-// NativeModule class, but without caching, or internal/ blocking,
-// or a class, since that's not really necessary. I assume that if
-// you're loading something with this module, it's because you WANT
-// a separate copy. However, to preserve semantics, any require()
-// calls made throughout the internal module load IS cached.
-function req (id, whitelist) {
- var cache = Object.create(null)
-
- if (Array.isArray(whitelist)) {
- // a whitelist of things to pull from the "actual" native modules
- whitelist.forEach(function (id) {
- cache[id] = {
- loading: false,
- loaded: true,
- filename: id + '.js',
- exports: require(id)
- }
- })
- }
-
- return req_(id, cache)
-}
-
-function req_ (id, cache) {
- // Buffer is special, because it's a type rather than a "normal"
- // class, and many things depend on `Buffer.isBuffer` working.
- if (id === 'buffer') {
- return require('buffer')
- }
-
- // native_module isn't actually a natives binding.
- // weird, right?
- if (id === 'native_module') {
- return {
- getSource: src,
- wrap: function (script) {
- return wrap[0] + script + wrap[1]
- },
- wrapper: wrap,
- _cache: cache,
- _source: natives,
- nonInternalExists: function (id) {
- return id.indexOf('internal/') !== 0;
- }
- }
- }
-
- var source = src(id)
- if (!source) {
- return undefined
- }
- source = wrap[0] + source + wrap[1]
-
- var cachingRequire = function require (id) {
- 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)
- }
-
- var nm = {
- exports: {},
- loading: true,
- loaded: false,
- filename: id + '.js'
- }
- 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) {
- fn = runInThisContext(source, {
- filename: nm.filename,
- lineOffset: 0,
- displayErrors: true
- });
- } else {
- fn = runInThisContext(source, nm.filename, true);
- }
- fn(nm.exports, cachingRequire, nm, nm.filename)
- 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
-}
-
-function src (id) {
- return natives[id]
-}
diff --git a/node_modules/natives/package.json b/node_modules/natives/package.json
deleted file mode 100644
index aa1e1bb97..000000000
--- a/node_modules/natives/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "natives",
- "version": "1.1.5",
- "description": "Do stuff with Node.js's native JavaScript modules",
- "main": "index.js",
- "scripts": {
- "test": "tap test/*.js"
- },
- "repository": {
- "type": "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/addaleax/natives/issues"
- },
- "homepage": "https://github.com/addaleax/natives#readme",
- "devDependencies": {
- "tap": "^11.0.0"
- },
- "files": [
- "index.js"
- ]
-}