Skip to content
nene edited this page Aug 1, 2012 · 15 revisions

(Updated for beta 2 release.)

JSDuck 4.0 beta is now out and brings with it a new JavaScript parser.

Using Esprima.js internally, JSDuck 4 has much improved auto-detection capabilities.

Example

/** My panel */
Ext.define("MyPanel", {
    extend: "Ext.panel.Panel",

    config: {
        /**
         * Title for the panel
         */
        title: "Untitled"
    },

    inheritableStatics: {
        /**
         * Registers the panel globally.
         * @param {MyPanel} panel
         */
        register: function(panel) {
        }
    },
    
    floating: false
});

From the above code JSDuck 4 detects config option title, static method register and private property floating. In JSDuck 3 you would have needed to explicitly use @cfg + @accessor tags for the config option, @static + @inheritable tag for static method, and the private property would have needed a doc-comment with @private tag.

Getting it

To install 4.0 beta, run:

$ gem install jsduck --pre

Additionally you should install therubyracer gem which provides a fast v8 bridge for running esprima.js:

$ gem install therubyracer

In Windows the easiest option is to download the jsduck-4.0.beta2.exe binary. It should work out of the box. (The previous beta also offered a JRuby version, but this was just an experiment, and has been discontinued.)

Hacking

Check out the esprima-parser branch:

$ cd jsduck
$ git checkout esprima-parser

Clone my fork of esprima.js into a subdir and check out linenr-in-range branch:

$ git clone git://github.com/nene/esprima.git
$ cd esprima
$ git checkout linenr-in-range

Ensure unit tests are passing:

$ cd ..
$ rake

Have fun :)

Clone this wiki locally