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

grunt-babel-helpers

v1.0.1

Published

Consolidates Babel helper functions

Downloads

942

Readme

grunt-babel-helpers v1.0.0

Consolidates Babel helper functions generated in a typical Browserify workflow.

This is a Grunt plugin to help consolidate the numerous and often duplicated Babel helper functions that are created in a typical Browserify workflow.

There are several other modules/plugins out there that do similar things, however they typically "require" a massive amount of dependencies that ultimately bloat the final output.

This plugin simply aims to find all the helper functions and move them to the top of the file, inside the UMD wrapper if one exists.

Getting Started

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-babel-helpers --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-babel-helpers');

Options

Below are some basic options to override the default behavior of this plugin.

helpers

Type: Array Function
Default: Predefined list from the babel-helpers module.

An array of Babel helper functions that should be consolidated. Note: none of the Babel helper function should be prefixed with an underscore (_).

index

Type: Number 'after' 'before' 'replace' Function
Default: 'before'

The character index to use for injecting the consolidated helpers.

This can be either a numeric value, a string value containing: 'after', 'before' or 'replace' or a function that returns one of those values.

If the value is 'after', 'before' or 'replace' then it will attempt to automatically determine the index position based on the above marker's position.

If the value passed is invalid or if a position could not be determined from the provided marker, then this option's value will default to 0.

marker

Type: RegExp String Function
Default: /var\s+define,\s*module,\s*exports;?/

The marker that determines where to inject the consolidated helpers.

prefix

Type: String Function
Default: '_'

The prefix prepended to babel-helper functions.

Usage example

grunt.initConfig({
  babelHelpers: {
    dist: {
      src: 'dist/build.js'
    }
  }
});