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

@style.tools/async-iife

v2.0.4

Published

Node.js IIFE generator for @style.tools/async. Module and CLI program.

Readme

Build Status Version npm version

$async IIFE generator

A Node.js IIFE generator for @style.tools/async.

An online version of the IIFE generator is available on https://style.tools/iife/

Documentation is available on docs.style.tools/async/iife-generator.

Install

npm install @style.tools/async-iife

What is IIFE?

IIFE (Immediately-invoked Function Expressions) is a coding pattern for loading a script. An IIFE can be used in the browser safely.

The IIFE generator makes it easy to generate an IIFE with a selection of $async modules. The IIFE generator provides compression via Google Closure Compiler (GCC) with Advanced mode for the best performance in all browsers.

The IIFE generator can be executed as a CLI program from the command-line, as a Node.js module and as a browser script (see https://style.tools/iife/ for an online version).

Usage

CLI

The provided iife-cli.js script can be used from the command-line. The NPM package contains a npm run iife script.

Examples

Display usage information and a list with available modules.

npm run iife -- --help

image

The following command shows how to create an IIFE with unary format, output to path/to/iife.js and with 3 modules that automatically load the required dependencies.

npm run iife --  --format unary --compress --output path/to/iife.js --modules css-loader,localstorage,timing

Short flags and a space separated module list are supported.

npm run iife --  -f unary -c -o path/to/iife.js -m "css-loader localstorage timing"

When omitting the --output flag the script is printed to the console, e.g. for > output.js.

Node.js module

// load Node.js module
const iife = require('@style.tools/async-iife');

// return script text for inlining
// uses memory-cache @link https://www.npmjs.com/package/memory-cache
iife.generate(['css-loader', 'timing'], {
   debug: true, // debug sources
   format: 'unary' // !function(){ ... }()
}).then(function(iife_script) {
	
   // iife_script contains the IIFE script text

});

// output to file
iife.generate(['css-loader', 'timing'], {
   compress: true, // Google Closure Compiler API compression
   format: 'wrap', // (function(){ ... })()
   output: 'path/to/iife.js',
   output_stats: true // return { modules:[], size:0, gzip_size:0 }
}).then(function(stats) {
	
   // iife.js written
   console.log(stats);

});

The Node.js module can be used efficiently within a Node.js CMS. IIFE's are cached in memory using memory-cache.

Warning: the generator depends on the free Google Closure Compiler API that may not be 100% reliable. When using the generator in production it may be an option to use a local Google Closure Compiler service.