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

traceurified-module

v0.0.1

Published

Write Node.js packages in ES6.

Downloads

3

Readme

traceurified-module

** NOTE: this project isn't ready for use yet. **

Write Node.js packages in ES6 that can be used in production today.

Quickstart

Add a dev-dependency on traceurified-module to your package.

npm install traceurified-module --save-dev
npm install traceurified-module-runtime --save

Add traceurified-dist/ to your .gitignore / .hgignore / whatever SVN uses (you're still using SVN?!).

echo "traceurified-dist/" >> .gitignore

Make sure you have a .npmignore file present, you don't want it defaulting to .gitignore (traceurified-dist/ won't be included in your package tarball, which would be bad).

touch .npmignore

Create a bootstrap.js file and declare it to be your main entrypoint in your package.json. Also configure a "prepublish" script to call traceurified-module-compile.

package.json

{
    // ...
    "main": "bootstrap.js",
    "scripts": {
      "prepublish": "traceurified-module-compile",
    }
    // ...
}

bootstrap.js

var traceurified = require("traceurified-module");

// Second argument is the path to your actual package entrypoint
// (that is, what your package.json "main" was before you pointed it at bootstrap.js)
traceurified.entrypoint(module, "index.js");

... Voila! You may now start writing ES6 code in your package.

Why use traceurified-module

Most of the magic happens in Traceur. Traceur handles parsing ES6 code and transforming it into valid ES5 code, along with polyfilling ES6 standard library support. So, why use this project? What does it actually do?

  • Simplifies transpiling your ES6 code into ES5 for distribution.
  • Sandboxes your code so that ES6 polyfills and other traceur-runtime code does not affect other packages / application code running in the Node.js process.
  • Basically, does its best to make writing ES6 code that targets ES5 runtimes as seamless as possible from a development and distribution perspective.
  • Integrates with your project in such a way that removing it and shipping ES6 code is extremely simple (once Node.js itself ships a V8 version that implements all of the ES6 you need).

How It Works

Traceur compiles your ES6 code into ES5. It also provides a runtime to support ES6 constructs and polyfill new ES6 APIs.

Due to the nature of these polyfills, and the fact that built-in prototypes such as String / Array / etc are modified, it is not safe to use Traceur in Node.js packages in the main context.

For this reason, traceurified-module isolates your package into a Node.js sandbox, using the built-in vm module. It is important to be aware of this.

traceurified-module does its best to make the sandboxed environment seem like a regular Node.js environment. require is available. process is available. However, there are some caveats. For example, all of the built-ins, like String, Array, etc, will be pristine copies from V8, with Traceur's polyfills augmented.