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

JSDev

v0.0.84

Published

JSDev is a simple JavaScript preprocessor. It implements a tiny macro language that is written in the form of tagged comments. These comments are normally ignored, and will be removed by JSMin. But JSDev will activate these comments, replacing them with executable forms that can be used to do debugging, testing, logging, or tracing. JSDev scans a source looking for and replacing patterns. A pattern is a slashstar comment containing a tag and some stuff, and optionally a condition wrapped in parens. There must be no space between the slashstar and the <tag>.

Downloads

39

Readme

JSDev, A JavaScript Development Tool

Douglas Crockford [email protected]

2012-01-05

JSDev is a filter that activates selected comments, making them executable. This makes it possible to put development, performance, and testing scaffolding into a source file. The scaffolding is removed by minification, but is activated by JSDev.

JSDev is a filter that takes a source file and looks for tagged comments in either of these forms:

/*<tag> <stuff>*/

/*<tag>(<condition>) <stuff>*/

There can be no space between the /* and the . There can be no space between the and the (. The content of tagged comment may not include comments, nor can it contain strings or regular expression literals that contain */. So, write

/*debug(/[a-z][a-z0-9]*/.test(variable))
    console.log("*/ test");
*/

as

/*debug(/[a-z][a-z0-9]*(?:)/.test(variable))
    console.log("*\/ test");
*/

JSDev is given a list the names of the tags that should be activated. Also, methods can be defined by following the tag name with : and a method name. There can be no spaces around the :.

Replacement     /*<tag>         */

tag form        {               }
method form     {<method>(      );}

If a condition was included, then the replacement will be preceded with an if statement.

The implementation in C obtains the input from stdin, and provides the result to stdout. The tag list is taken from the command line. The command line can also include a -comment specification. JSDev will exit(1) if there is an error.

In JavaScript, it is available as the JSDEV function that takes a source, an array of tags, and an optional array of comments. It will throw an exception if there is an error.

C command line example:

jsdev -comment "Devel Edition." <input >output test_expose enter:trace.enter exit:trace.exit unless:alert

JavaScript:

output = JSDEV(input, [
    "test_expose",
    "enter:trace.enter",
    "exit:trace.exit",
    "unless:alert"
] , ["Devel Edition."]);

input:

// This is a sample file.

function Constructor(number) {
    /*enter 'Constructor'*/
    /*unless(typeof number !== 'number') 'number', "Type error"*/
    function private_method() {
        /*enter 'private_method'*/
        /*exit 'private_method'*/
    }
    /*test_expose
        this.private_method = private_method;
    */
    this.priv = function () {
        /*enter 'priv'*/
        private_method();
        /*exit 'priv'*/
    }
    /*exit "Constructor"*/
}

output:

// Devel Edition.
// This is a sample file.

function Constructor(number) {
    {trace.enter('Constructor');}
    if (typeof number !== 'number') {alert('number', "Type error");}
    function private_method() {
        {trace.enter('private_method');}
        {trace.exit('private_method');}
    }
    {
        this.private_method = private_method;
    }
    this.priv = function () {
        {trace.enter('priv');}
        private_method();
        {trace.exit('priv');}
    }
    {trace.exit("Constructor");}
}

lightly minified:

function Constructor(number) {
    function private_method() {
    }
    this.priv = function () {
        private_method();
    }
}