Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

read-installed

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-installed - npm Package Compare versions

Comparing version 0.1.1 to 0.2.1

7

package.json
{
"name": "read-installed",
"description": "Read all the installed packages in a folder, and return a tree structure with all the data.",
"version": "0.1.1",
"version": "0.2.1",
"repository": {

@@ -16,9 +16,8 @@ "type": "git",

"slide": "~1.1.3",
"read-package-json": "0"
"read-package-json": "1"
},
"optionalDependencies": {
"graceful-fs": "~1.2.0",
"npmlog": "0"
"graceful-fs": "~1.2.0"
},
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)"
}

@@ -96,9 +96,2 @@

try {
var log = require("npmlog")
} catch (_) {
var log = { verbose: noop, info: noop, warn: noop, error: noop }
function noop () {}
}
var path = require("path")

@@ -112,4 +105,12 @@ var asyncMap = require("slide").asyncMap

function readInstalled (folder, depth, cb) {
if (typeof cb !== "function") cb = depth, depth = Infinity
function readInstalled (folder, depth_, log_, cb_) {
var depth = Infinity, log = function () {}, cb
for (var i = 1; i < arguments.length - 1; i++) {
if (typeof arguments[i] === 'number')
depth = arguments[i]
else if (typeof arguments[i] === 'function')
log = arguments[i]
}
cb = arguments[i]
readInstalled_(folder, null, null, null, 0, depth, function (er, obj) {

@@ -119,3 +120,3 @@ if (er) return cb(er)

// figure out the inheritance links, now that the object is built.
resolveInheritance(obj)
resolveInheritance(obj, log)
cb(null, obj)

@@ -242,3 +243,3 @@ })

var riSeen = []
function resolveInheritance (obj) {
function resolveInheritance (obj, log) {
if (typeof obj !== "object") return

@@ -251,8 +252,8 @@ if (riSeen.indexOf(obj) !== -1) return

Object.keys(obj.dependencies).forEach(function (dep) {
findUnmet(obj.dependencies[dep])
findUnmet(obj.dependencies[dep], log)
})
Object.keys(obj.dependencies).forEach(function (dep) {
resolveInheritance(obj.dependencies[dep])
resolveInheritance(obj.dependencies[dep], log)
})
findUnmet(obj)
findUnmet(obj, log)
}

@@ -263,3 +264,3 @@

var fuSeen = []
function findUnmet (obj) {
function findUnmet (obj, log) {
if (fuSeen.indexOf(obj) !== -1) return

@@ -291,6 +292,6 @@ fuSeen.push(obj)

// the bad thing will happen
log.warn("unmet dependency", obj.path + " requires "+d+"@'"+deps[d]
+"' but will load\n"
+found.path+",\nwhich is version "+found.version
)
log("unmet dependency", obj.path + " requires "+d+"@'"+deps[d]
+"' but will load\n"
+found.path+",\nwhich is version "+found.version
)
found.invalid = true

@@ -329,3 +330,2 @@ } else {

log.verbose("readInstalled", "returning", obj._id)
return obj

@@ -332,0 +332,0 @@ }

@@ -13,5 +13,5 @@ # read-installed

// depth is optional, defaults to Infinity
readInstalled(folder, depth, function (er, data) {
readInstalled(folder, depth, logFunction, function (er, data) {
...
})
```

@@ -6,3 +6,3 @@ var readInstalled = require("../read-installed.js")

var called = 0
readInstalled(process.cwd(), function (er, map) {
readInstalled(process.cwd(), console.error, function (er, map) {
console.error(called ++)

@@ -9,0 +9,0 @@ if (er) return console.error(er.stack || er.message)

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