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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ir2js

v0.1.2

Published

Converter from ir to JavaScript.

Readme

ir2js

ir2js converts source code written in ir syntax to JavaScript code with Google Closure annotations. ir is a statically typed language with concise grammar and focus on class design, but otherwise very similar to JavaScript.

Features of the ir language

  • Statically typed (type checking provided by the Closure compiler). Types are requierd for function parameters and class members variables.
  • Concise grammar -- much smaller than the equivalent JavaScript code with Closure annotations. Smaller code lowers refactoring barrier.
  • Explicit class system. Smaller overhead of defining a new class promotes designing code based on classes and how they interact with each other.
  • Indentations to express code blocks (as in Python) as well as data structures (like YAML). This makes the code and data structures visually clearer.

Features of the converter

  • ir2js converter itself is written in ir and runs on Node. (although there is no reason it can not run on a modern browser).
  • The conversion is per file -- one ir file gets converted to one js independently from other ir or js files.
  • The converter can read metadata to sort the output js files in the order that satisfies the inheritance dependencies.
  • The Closure compiler is required for the static type checking, but otherwise the generated js files run without further compilations.
  • The compiled js files do not require the Closure library.
  • The produced js files are reasonably readable and variable names are preserved, so one can debug on them and find the corresponding code in the original ir files easily.
  • The output js is tested on V8 (Node.js and Chrome browser).

How to use

To comple, run node.js (the command maybe different for your installation) with ir2js as the first parameter, followed by the input ir file names.

$ node ir2js --outdir=output_dir input_file1.ir input_file2.ir ...

The generated files can be loaded into HTML with tags.

<script src="output_dir/output_file1.js"></script>
<script src="output_dir/output_file2.js"></script>

Closure compiler can be used to do the static type checking on the output js files.

java -jar closure/compiler.jar \
--compilation_level ADVANCED_OPTIMIZATIONS \
--summary_detail_level 3 \
--warning_level VERBOSE \
--js_output_file compiled/_ir2js_test.js \
--js closure-library/closure/goog/base.js \
--js output_file1.js \
--js output_file2.js

See the Makeifle of ir2js for how this can be set up.