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 🙏

© 2024 – Pkg Stats / Ryan Hefner

broccoli-dep-filter

v0.3.5

Published

Broccoli filtered processing with dependency tracking

Downloads

24

Readme

Dependency-tracking multiple-tree processing for Broccoli

  • Tracks dependencies of each file automatically, even files included during compilation (using fs-history)
  • Takes in multiple trees, allows to name them (you can pass an object instead of an array), only chosen ones are iterated over
  • Bit like broccoli-filter but more

Usage (function style)

var filter = require("broccoli-dep-filter");

var tree = filter(config);

Configuration

Input trees options:

  • trees: array or object, one or more indexed or named trees,
  • iterated: iterated trees, indexes or names from the trees option (optional, defaults to all indexes or keys from trees)

Filtering options:

  • extensions: list of extensions of input files (optional)
  • target: extension of produced output files (optional, only applies to extensions)
  • filter: extra filtering, either a function or a regular expression (optional)

Various options:

  • dest_dir: move output files to a subdirectory of the output tree
  • read: by default process receives file contents, set read to false if you want just the file path
  • binary: read and save file as binary buffer instead of a UTF-8 string
  • name: label the tree (used for reporting performance metrics by broccoli)

Processing options:

  • process(src : String) : String
  • init(trees : Array || Object) : process

You pass only one of init or process.

The process function is invoked for every input file, as argument it gets file contents (if read: false) as a string or a buffer (when binary: true). process can return file's content either directly or as a promise (it has to be the same type as input: buffer or string).

The init function is invoked once all input trees are resolved. As an argument it gets an array or object (depending on the type of the trees option) mapping the tree names or indexes to trees' root directories. init has to return a process function.

Example:

var filter = require("broccoli-dep-filter");

function setup (input_tree, less_config) {
  return filter({
    trees: [input_tree],
    extensions: ["less"],
    target: "css",
    process: compile_less
  });

  function compile_less (src) {
    //…
  }
}

Usage (prototype style)

Planned to work as a drop-in replacement for broccoli-filter.

How does the dependency-tracking work?

Files that are read during a build of a target (an output file) are observed (with the fs-history fs-history module) and remembered. Before the rebuild all dependencies are checked if they have changed.

Copying

MIT licence, see COPYING.