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

jsx

v0.9.89

Published

a faster, safer, easier JavaScript

Downloads

6,517

Readme

NAME Build Status

JSX - a faster, safer, easier JavaScript

INSTALLATION

The JSX compiler toolkit is released as a npm package, so you can install it with npm install -g jsx.

  • https://npmjs.org/package/jsx

COMPILATION

There's jsx(1) command to compile JSX source code into JavaScript.

Type the following commands and see what happens:

# run Hello World in JSX
jsx --run example/hello.jsx

# compile it and output the generated code to stdout
jsx example/hello.jsx

# compile it with fully optimizations
jsx --release --output hello.jsx.js example/hello.jsx

# compile it for node and execute it
jsx --executable node --output hello.jsx.js example/hello.jsx
./hello.jsx.js # displays "Hello, world!"

# run a test, calling _Test#test*()
jsx --test example/import.jsx # import.jsx has _Test

jsx --help shows how to to use the jsx command.

INTRODUCTION

Here is a fizzbuzz problem, which can be executed by jsx --run fizzbuzz.jsx, showing a basic syntax of JSX.

class _Main {
	static function main(args :string[]) : void {
		for (var i = 1; i <= 100; ++i) {
			if (i % 15 == 0)
				log "FizzBuzz";
			else if (i % 3 == 0)
				log "Fizz";
			else if (i % 5 == 0)
				log "Buzz";
			else
				log i;
		}
	}
}

See the documentation for details.

EXAMPLES

There are JSX source files in example/ and web/example/, and the the test directory t/.

DEVELOPMENT OF JSX COMPILER

If you are interested in development of the JSX compiler, you should set up your environment after cloning the repo. The SDK development requires LSB 4.1 (Perl 5.8.8 and some UNIX commands) as well as NodeJS 0.8.0 or later.

To setup JSX SDK, type the following command:

git clone --recursive git://github.com/jsx/JSX.git
cd JSX
make # to build bin/jsx
# edit JSX compiler source files
make test # to make sure it works

We recommend to install jsx(1) as a link of $JSX/bin/jsx to ~/bin/jsx.

ln -s "$PWD/bin/jsx" ~/bin

DEVELOPMENT WEB SERVER

There's a web interface, which provides a web compiler and web application examples. Type the following commands to run the server:

make server # to run an HTTP daemon
open http://localhost:2012/

This server is also used to show results of JSX profiler. See Using the Profiler for details.

TESTING

There are unit tests in t/ directory. Just type the following command to run the tests:

make test

These test cases are executed by prove(1) and dispatched by t/util/test-runner, and also requires phantomjs(1)

Note that if you make a pull-requst you have to make sure make test-all for complete tests.

NOTE: There are some TODO tests, which should be resolved in a future. make show-todo shows such TODOs.

WINDOWS SUPPORT

npm install -g jsx should work even on Windows.

RESOURCES