function parsePackage(p, hide = true) {
        // Parse the package.json file of this package
        const packageJson = path.posix.join(p, 'package.json');
        const pkg = isFile(packageJson) ? JSON.parse(fs.readFileSync(packageJson, { encoding: 'utf8' })) :
            { version: '0.0.0' };
        // Trim the leading node_modules from the path and
        // assign to _dir for future use
        pkg._dir = p.replace(/^node_modules\//, '');
        // Stash the package directory name for future use
        pkg._name = pkg._dir.split('/').pop();
        // Module name of the package. Unlike "_name" this represents the
        // full package name (including scope name).
        pkg._moduleName = pkg.name || `${pkg._dir}/${pkg._name}`;
        // Keep track of whether or not this is a nested package
        pkg._isNested = /\/node_modules\//.test(p);
        // List all the files in the npm package for later use
        pkg._files = listFiles(p);
        // Initialize _dependencies to an empty array
        // which is later filled with the flattened dependency list
        pkg._dependencies = [];
        // Hide bazel files in this package. We do this before parsing
        // the next package to prevent issues caused by symlinks between
        // package and nested packages setup by the package manager.
        if (hide)
            hideBazelFiles(pkg);
        return pkg;
    }
/**
     * Given the name of a top-level folder in node_modules, parse the
     * package json and return it as an object along with
     * some additional internal attributes prefixed with '_'.
     */
Given the name of a top-level folder in node_modules, parse the
package json and return it as an object along with
some additional internal attributes prefixed with '_'.
Given the name of a top - level folder in node_modules parse the package json and return it as an object along with some additional internal attributes prefixed with ' _ ' .
function parsePackage(p, hide = true) {
        const packageJson = path.posix.join(p, 'package.json');
        const pkg = isFile(packageJson) ? JSON.parse(fs.readFileSync(packageJson, { encoding: 'utf8' })) :
            { version: '0.0.0' };
        pkg._dir = p.replace(/^node_modules\//, '');
        pkg._name = pkg._dir.split('/').pop();
        pkg._moduleName = pkg.name || `${pkg._dir}/${pkg._name}`;
        pkg._isNested = /\/node_modules\//.test(p);
        pkg._files = listFiles(p);
        pkg._dependencies = [];
        if (hide)
            hideBazelFiles(pkg);
        return pkg;
    }
function parsePackage ( p , hide = true ) { const packageJson = path . posix . join ( p , 'package.json' ) ; const pkg = isFile ( packageJson ) ? JSON . parse ( fs . readFileSync ( packageJson , { encoding : 'utf8' } ) ) : { version : '0.0.0' } ; pkg . _dir = p . replace ( / ^node_modules\/ / , '' ) ; pkg . _name = pkg . _dir . split ( '/' ) . pop ( ) ; pkg . _moduleName = pkg . name || ` ${ pkg . _dir } ${ pkg . _name } ` ; pkg . _isNested = / \/node_modules\/ / . test ( p ) ; pkg . _files = listFiles ( p ) ; pkg . _dependencies = [ ] ; if ( hide ) hideBazelFiles ( pkg ) ; return pkg ; }
Given the name of a top-level folder in node_modules, parse the
 package json and return it as an object along with
 some additional internal attributes prefixed with '_'.
Given the name of a top - level folder in node_modules parse the package json and return it as an object along with some additional internal attributes prefixed with ' _ ' .
// Parse the package.json file of this package // Trim the leading node_modules from the path and // assign to _dir for future use // Stash the package directory name for future use // Module name of the package. Unlike "_name" this represents the // full package name (including scope name). // Keep track of whether or not this is a nested package // List all the files in the npm package for later use // Initialize _dependencies to an empty array // which is later filled with the flattened dependency list // Hide bazel files in this package. We do this before parsing // the next package to prevent issues caused by symlinks between // package and nested packages setup by the package manager.