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-caching-writer

v3.0.3

Published

Broccoli plugin that allows simple caching (while still allowing N:N) based on the input tree hash.

Downloads

884,518

Readme

Broccoli Caching Writer

Build Status Build status

Drop-in-replacement for broccoli-writer adding a thin caching layer based on the computed hash of the input directory trees. If any file in an input node has changed, the build method will be called, otherwise (if input is the same) the results of the last build call will be used instead.

Example

var Plugin = require('broccoli-caching-writer');

MyPlugin.prototype = Object.create(Plugin.prototype);
MyPlugin.prototype.constructor = MyPlugin;
function MyPlugin(inputNodes, options) {
  options = options || {};
  // options.inputFiles === array of globs, to consider for the cache key
  Plugin.call(this, inputNodes, {
    annotation: options.annotation
  });
}

MyPlugin.prototype.build = function() {
  // cache has been busted
  // do anything, for example:
  //   1. read from this.inputPaths
  //   2. do something based on the result
  //   3. and then, write to this.outputPath
};

Documentation

new CachingWriter(inputNodes, options)

Call this base class constructor from your subclass constructor.

  • inputNodes: An array of input nodes.

  • options:

    • name, annotation, persistentOutput: Same as broccoli-plugin; see there.

    • cacheInclude (default: []): An array of regular expressions that files and directories in an input node must pass (match at least one pattern) in order to be included in the cache hash for rebuilds. In other words, a whitelist of patterns that identify which files and/or directories can trigger a rebuild.

    • cacheExclude (default: []): An array of regular expressions that files and directories in an input node cannot pass in order to be included in the cache hash for rebuilds. In other words, a blacklist of patterns that identify which files and/or directories will never trigger a rebuild.

      Note, in the case when a file or directory matches both an include and exlude pattern, the exclude pattern wins

plugin.listFiles

list files matched, helpful as it allows us avoid a second glob, lexicographically sorted by relativePath.

plugin.listEntries

list entries (stat objects) of files matched, helpful when further FS information is required on rebuild, lexicographically sorted by relativePath.

ZOMG!!! TESTS?!?!!?

I know, right?

Running the tests:

npm install
npm test

License

This project is distributed under the MIT license.