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

mako-tree

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mako-tree - npm Package Compare versions

Comparing version 0.14.4 to 0.14.5

5

HISTORY.md
0.14.5 / 2016-06-26
===================
* adding more timer-based debug logs
0.14.4 / 2016-06-19

@@ -3,0 +8,0 @@ ===================

60

lib/tree.js

@@ -5,2 +5,3 @@ 'use strict'

let bytes = require('bytes')
let debug = require('debug')('mako-tree')

@@ -11,2 +12,3 @@ let defaults = require('defaults')

let Graph = require('graph.js/dist/graph.js')
let pretty = require('pretty-time')
let relative = require('relative')

@@ -79,2 +81,3 @@ let toposort = require('graph-toposort')

findFile (file) {
let timer = time()
let path = typeof file === 'string' ? file : file.path

@@ -85,7 +88,7 @@ debug('searching for file with path %s', relative(path))

if (file.hasPath(path)) {
debug('match found: %s', relative(file.path))
debug('match found: %s (took %s)', relative(file.path), timer())
return file
}
}
debug('file not found')
debug('file not found (took %s)', timer())
}

@@ -104,7 +107,11 @@

let config = defaults(options, { topological: false })
let timer = time()
debug('getting %d files: %j', this.size(), config)
return config.topological
let files = config.topological
? toposort(this.graph).map(id => this.getFile(id))
: Array.from(this.graph.vertices()).map(v => v[1])
debug('finished getting %d files (took %s)', files.length, timer())
return files
}

@@ -184,2 +191,3 @@

dependenciesOf (node, options) {
let timer = time()
let config = defaults(options, { recursive: false })

@@ -193,3 +201,3 @@ let file = this.getFile(id(node))

debug('%d dependencies found', deps.length)
debug('%d dependencies found (took %s)', deps.length, timer())
return deps.map(v => v[1])

@@ -251,2 +259,3 @@ }

dependantsOf (node, options) {
let timer = time()
let config = defaults(options, { recursive: false })

@@ -260,3 +269,3 @@ let file = this.getFile(id(node))

debug('%d dependants found', deps.length)
debug('%d dependants found (took %s)', deps.length, timer())
return deps.map(v => v[1])

@@ -281,5 +290,6 @@ }

debug('cloning tree')
let timer = time()
let tree = new Tree()
tree.graph = this.graph.clone(file => file.clone(tree), value => value)
debug('done cloning tree')
debug('cloned tree (took %s)', timer())
return tree

@@ -294,2 +304,3 @@ }

prune (anchors) {
let timer = time()
let initialSize = this.size()

@@ -311,3 +322,3 @@ let files = anchors.map(file => this.getFile(id(file)))

debug('%d files pruned from tree (new size: %d)', initialSize, this.size())
debug('%d files pruned from tree (took %s)', initialSize, timer())
}

@@ -319,5 +330,7 @@

removeCycles () {
debug('removing cycles from tree')
let timer = time()
let graph = this.graph
debug('removing cycles from tree')
Array.from(graph.cycles()).forEach(cycle => {
let cycles = Array.from(graph.cycles())
cycles.forEach(cycle => {
let files = cycle.map(file => this.getFile(file))

@@ -334,2 +347,3 @@ debug('cycle detected:')

})
debug('removed %d cycles (took %s)', cycles.length, timer())
}

@@ -344,3 +358,5 @@

toJSON () {
return {
debug('convert to json')
let timer = time()
let o = {
root: this.root,

@@ -350,2 +366,4 @@ files: this.getFiles(),

}
debug('converted to json (took %s)', timer())
return o
}

@@ -361,4 +379,7 @@

toString (space) {
debug('stringify tree')
return JSON.stringify(this, null, space)
debug('convert to string')
let timer = time()
let str = JSON.stringify(this, null, space)
debug('converted to %s string (took %s)', bytes(str.length), timer())
return str
}

@@ -374,3 +395,4 @@

static fromString (input) {
debug('creating from string')
debug('convert from string')
let timer = time()
let parsed = JSON.parse(input, reviver)

@@ -390,3 +412,3 @@ let tree = new Tree(parsed.root)

debug('done creating tree from string')
debug('converted from %s string (took %s)', bytes(input.length), timer())
return tree

@@ -427,1 +449,11 @@ }

}
/**
* Start a timer that we can use for logging timing information.
*
* @return {Function}
*/
function time () {
let start = process.hrtime()
return () => pretty(process.hrtime(start))
}
{
"name": "mako-tree",
"version": "0.14.4",
"version": "0.14.5",
"main": "./lib/tree",

@@ -13,2 +13,3 @@ "description": "The build tree structure used internally by mako",

"babel-polyfill-safe": "^1.0.1",
"bytes": "^2.4.0",
"clone": "^1.0.2",

@@ -20,2 +21,3 @@ "debug": "^2.2.0",

"graph.js": "^1.20.1",
"pretty-time": "^0.2.0",
"regex-iso-date": "^1.0.0",

@@ -22,0 +24,0 @@ "relative": "^3.0.2",

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