New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

natives

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

natives - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

19

index.js

@@ -34,5 +34,20 @@ var natives = process.binding('natives')

// calls made throughout the internal module load IS cached.
function req (id) {
return req_(id, Object.create(null))
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) {

@@ -39,0 +54,0 @@ // Buffer is special, because it's a type rather than a "normal"

6

package.json
{
"name": "natives",
"version": "1.0.2",
"version": "1.1.0",
"description": "Do stuff with Node.js's native JavaScript modules",
"main": "index.js",
"scripts": {
"test": "tap test/*.js --branches=100 --lines=100 --statements=100 --functions=100"
"test": "tap test/*.js --100"
},

@@ -20,3 +20,3 @@ "repository": {

"devDependencies": {
"tap": "^6.3.2"
"tap": "^7.0.0"
},

@@ -23,0 +23,0 @@ "files": [

@@ -50,2 +50,5 @@ # natives

// 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

@@ -52,0 +55,0 @@ assert(fsCopy !== require('fs'))

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc