nl_tokens: Walks a directory and returns a list of metadata about locator packages installed in that directory ( including the package for the directory itself ) .
pl_tokens: function ( dir , _depth ) { var self = this , pkg , seed , seeds = [ ] , subdirs ; _depth = _depth || 0 ; try { pkg = require ( libpath . resolve ( dir , 'package.json' ) ) ; // top level package doesn't require a locator flag in package.json if ( ( 0 === _depth ) && ( ! pkg . locator ) ) { pkg . locator = { } ; } seed = this . _makeBundleSeed ( dir , libpath . basename ( dir ) , DEFAULT_VERSION , pkg ) ; if ( <mask> . options ) { seed . npmDepth = _depth ; seeds . push ( seed ) ; } } catch ( packageErr ) { // Some build environments leave extraneous directories in // node_modules and we should ignore them gracefully. // (trello board:Modown card:124) if ( 'MODULE_NOT_FOUND' !== packageErr . code ) { throw packageErr ; } return seeds ; } if ( _depth < this . _options . maxPackageDepth ) { try { subdirs = libfs . readdirSync ( libpath . join ( dir , 'node_modules' ) ) ; } catch ( readdirErr ) { if ( 'ENOENT' === readdirErr . code ) { // missing node_modules/ directory is OK return seeds ; } throw readdirErr ; } subdirs . reduce ( function ( memo , subdir ) { return memo . concat ( '@' === subdir . substring ( 0 , 1 ) ? libfs . readdirSync ( libpath . join ( dir , 'node_modules' , subdir ) ) . map ( function ( scopeddir ) { return libpath . join ( subdir , scopeddir ) ; } ) : [ subdir ] ) ; } , [ ] ) . forEach ( function ( subdir ) { var subpkgResults ; if ( '.' === subdir . substring ( 0 , 1 ) ) { return ; } subpkgResults = self . _walkNPMTree ( libpath . join ( dir , 'node_modules' , subdir ) , _depth + 1 ) ; // merge in found packages if ( subpkgResults && subpkgResults . length ) { seeds = seeds . concat ( subpkgResults ) ; } } ) ; } return seeds ; }