npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

father2

v0.6.13

Published

A package parser that can resolve self and dependencies, supporting spm, component.

Downloads

2

Readme

father Build Status Coverage Status

A package parser that can resolve self and dependencies, supporting spm / component.


Install

$ npm install father -g

Usage

// using SpmPackage
var Package = require('father').SpmPackage;
var pkg = new Package('path/to/package')
console.log(pkg.name);
console.log(pkg.version);
console.log(pkg.main);
console.log(pkg.dependencies); // return a object contains dependencies
console.log(pkg.get('each')); // return a package named each

// using ComponentPackage
var Package = require('father').ComponentPackage;

Properties

The properties of Package instance

pkg.id

Unique id for each package

= {pkg.name}@{pkg.version}

pkg.name require

Package's name

pkg.version require

Package's version

pkg.main

Entry point of the package, default is index.js

pkg.dependencies

Package's dependencies, each one will return a Package instance

pkg.files

All used files will exist in pkg.files, it will be parsed from pkg.main. Each file contains dependent files (no deep dependencies).

Example below

{
  files: {
    'index.js': {
      dependencies: ['each', './feature']
    }
  }
}

pkg.dest

The base directory of the package

pkg.origin

The origin package info

pkg.output

Export files when build

Method

pkg.get(pkg.id)

Get a package of id

pkg.set(pkg)

Set a package

pkg.getPackages()

Get all dependent packages

Options

The options when instantiation

new Package('path/to/package', options);

extraDeps

Config an extension as key, when that extension is found, value will be added to deps

new Package('path/to/package', {
  extraDeps: {
    'handlebars': 'handlebars'
  }
});

If one file require('./xx.handlebars'), handlebars will be added to the dependencies ['./xx.handlebars', 'handlebars']

entry

Generally, files will be parsed from pkg.main, no dependent file will not be included. entry will be another entry point.

Files

// a.js <- pkg.main
console.log('no require');

// b.js
require('./c');

// c.js
console.log('no require');

Code

new Package('path/to/package', {
  entry: ['b.js']
});

Return

// without entry
{
  ...
  files: {
    'a.js': []
  }
}

// with entry
{
  ...
  files: {
    'a.js': [],
    'b.js': ['./c'],
    'c.js': []
  }
}

ignore

// a.js
require('b')

If you don't want to parse package b, you can specify ignore. And it won't parse the dependencies of b.

new Package('path/to/package', {
  ignore: ['b']
});

Custom

If you want to use it for your package, you can extend Package and override readPackage.

var Package = require('father').Package;
var Custom = Package.extend({
  readPackage: function() {
    // 1. read config file, E.g. component.json
    // 2. return a package contains id, name, version, dependencies, main, dest, files, origin
    // 3. dependencies should contain id, name, version, dest
  };
})

Example for returned object by readPackage

{
  id: 'a',
  name: 'a'  
  version: '1.0.0',
  main: 'index.js',
  dest: '/home/user/a',
  dependencies: {
    b: {
      id: '[email protected]',
      name: 'b',
      version: '1.1.0',
      dest: '/home/user/a/components/b'
    }
  }
}

LISENCE

Copyright (c) 2014 popomore. Licensed under the MIT license.