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 🙏

© 2025 – Pkg Stats / Ryan Hefner

spike-util

v1.3.0

Published

utilities for spike plugins

Downloads

50

Readme

Spike Util

npm tests dependencies coverage

A grab bag of utilities for spike plugins

Note: This project is in early development, and versioning is a little different. Read this for more details.

Why should you care?

Spike uses webpack as its core compiler, but fundamentally behaves a bit differently from webpack, as it's a full static site compiler rather than a javascript bundler. As such, plugins for spike frequently need to make use of a couple specific utilities. In fact, each of these utilities are used in spike's core plugins.

If you are making a spike plugin, check out the documentation below, and one of these functions might be able to save you a bunch of code :grin:

Installation

npm install spike-util -S

Usage

All of the utilities require access to spike/webpack's options in order to work correctly. As such, the plugins are bundled in a class that must be initialized with the config.

const SpikeUtils = require('spike-util')

// webpack plugin apply function
apply (compiler) {
  const util = new SpikeUtils(compiler.options)
}

With it initialized, you can use any of the following functions:

  • util.addFilesAsWebpackEntries(compilation, files) - adds one or more files to webpack's pipeline so that it is processed without having to be require'd in an entry.
  • util.getSpikeOptions() - returns spike-specific options that are not easily accessed on the primary webpack config object
  • util.getOutputPath(path) - given a relative or absolute path to a file in a spike project, return it's output path relative to the project root.
  • util.removeAssets(compilation, files) - removes assets from webpack's pipeline so that they are not written as entries.
  • util.resolveRelativeSourcePath(path) - resolves a relative output path from a spike project to an absolute path to the source file.
  • util.isFileIgnored(file) - given a path to a file in a spike project, returns a boolean for whether the file is ignored or not.
  • util.runAll(compiler, cb) - run the given function when webpack's compiler initializes, bound to both the run and run-watch events.
  • util.pathsToRegex(paths) - given an array of file paths, builds a regex that will match only those paths
  • util.modifyOutputPath(file, outPath) - Given an absolute or relative (to the project root) path to a file that's being processed by spike, changes the output path to absolute or relative (recommended) path provided. Recommended to use in the emit plugin stage.

For more details on any given function, check out the source! I would never say this for any other library, but this is only one simple file, with fairly small functions that are extremely thoroughly documented, so I think it's worth jumping in.

License & Contributing