first commit

This commit is contained in:
s.golasch
2023-08-01 13:49:46 +02:00
commit 1fc239fd54
20238 changed files with 3112246 additions and 0 deletions

64
build/node_modules/natives/README.md generated vendored Normal file
View File

@@ -0,0 +1,64 @@
# 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.

126
build/node_modules/natives/index.js generated vendored Normal file
View File

@@ -0,0 +1,126 @@
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;
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
}
}
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
}
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
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]
}

54
build/node_modules/natives/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"_from": "natives@^1.1.0",
"_id": "natives@1.1.1",
"_inBundle": false,
"_integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==",
"_location": "/natives",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "natives@^1.1.0",
"name": "natives",
"escapedName": "natives",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/pngout-bin/graceful-fs"
],
"_resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz",
"_shasum": "011acce1f7cbd87f7ba6b3093d6cd9392be1c574",
"_spec": "natives@^1.1.0",
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/pngout-bin/node_modules/graceful-fs",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/natives/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Do stuff with Node.js's native JavaScript modules",
"devDependencies": {
"tap": "^11.0.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/isaacs/natives#readme",
"license": "ISC",
"main": "index.js",
"name": "natives",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/natives.git"
},
"scripts": {
"test": "tap test/*.js --100"
},
"version": "1.1.1"
}