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

harmonizr

v0.2.0

Published

bring tomorrow's Harmony to today's JavaScript

Downloads

8

Readme

Harmonizr

A "transpiler" that brings tomorrow's Harmony to today's JavaScript.

Features:

  • Harmony modules to AMD, Node.js, or Revealing Module Pattern
  • Maintains line numbers

Demo

Look in the demo directory or try it here.

Installation

$ npm install harmonizr

Usage

$ ./node_modules/.bin/harmonizr [options] path/to/input

If you install Harmonizr globally or have ./node_modules/.bin in your PATH, you can omit the path to the harmonizr script.

Specify --amd, --node, or --revealing to transform Harmony-style modules into AMD, Node.js, or JavaScript Revealing Module Pattern- style modules.

This transpiles src/foo.js into a Node.js-compatible version at lib/foo.js:

$ harmonizr --node --output lib/foo.js src/foo.js

Use --module to implicitly wrap the entire file in a module declaration. The name of the module is required, but only appears in the output when using --revealing.

Use --relatives with --node to indicate what modules should be loaded from the local directory and not the node_modules directory.

For example, if a foo module needs to load bar and baz modules from the same directory as it (not from node_modules), you could do this:

$ harmonizr --node --relatives bar,baz --output lib/foo.js src/foo.js

Limitations

  • No nested modules.
  • No import * from module;.
  • export is only allowed when in front of a simple function or variable declaration.
  • Probably bugged.

Code

The actual source code is in the src directory. The Makefile transpiles that into a Node.js-style module in lib, AMD-style in demo, and Revealing Module Pattern-style in test.

Harmonizr transpiles itself. Since Node.js doesn't support the newer syntax harmonizr.js uses in the src directory, it loads the harmonizr module out of the lib directory. Be careful when building.

Tests are the test directory. Run them with npm test or by opening test.html.

If you'd like to contribute, please try to include tests, ensure the code coverage stays at 100%, and that JSHint doesn't complain.

Execute make to build, run JSHint, and run the tests (with code coverage).