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

babel-autonode

v2.0.0

Published

Automatically and transparently use as little babel as possible with whatever version of node is in use.

Downloads

13

Readme

babel-autonode

Automatically and transparently use as little babel as possible with whatever version of node is in use.

Installing with a global helper:

npm install -g babel-autonode-init

And in a new project:

babel-autonode-init

THE BIG ASSUMPTION

WARNING WARNING WARNING

We only make one big assumption and that's that you keep your project js files in src/. Now, I don't ordinarily do that, but it makes the integration work this module has to do MUCH easier. I would love a patch that made it not care, but I'm probably not going to be motivated to write it myself.

FRONTEND

The way the loader works is node specific and not appropriate for the frontend. I would be open to patches to make this more frontend friendly.

Installing by hand:

The above is the equivalent of:

npm install --save-dev babel babel-autonode
npm install --save babel-autonode-loader

and then adding this to your package.json file:

"scripts": {
  "transpile": "babel-autonode",
  "prestart": "npm run transpile",
  "prepublish": "npm run transpile"
},

And the final bit it does is a little more complicated. It creates a file named loader.js, which is just:

module.exports = require('babel-autonode-loader')

And then it patches your package.json copying the main field (the entry point for your module, which defaults to index.js) to babel-autonode.main and sets main to loader.js

Using:

Any time you run npm install (with no arguments), npm pack or npm publish then babel-autonode will be called to refresh your compiles. Don't worry though, it should be very fast if nothing has changed.

If you want to manually do a build, run npm run transpile.

babel-autonode

The babel-autonode expects to be run from your module root (where your package.json is) and scans your src folder for files that have changed since it was last run. Any changed files are recompiled with babel into each version supported by autonode. Compile targets look like:

v8/#.#.#.#/filename.js

The provided loader.js, will load your entry point from the appropriate v8 folder for you automatically.

What's missing?

Probably a lot of documentation on using this thing, but I wanted to get it out there!