src/main.js
function(options) {
    options = extend({
        src: '',
        output: '',
        is3d: false,
        failOnWarn: false,
        overwrite: false,
        reporter: 'default'
    }, options);

    if (!options.src || !options.output) {
        throw new Error('Must specify source file and output directory');
    }

    var reporterConstructor;
    if (options.reporter === 'default') {
        reporterConstructor = require('./reporter.js').Reporter;
    } else {
        reporterConstructor = require('./reporters/' + options.reporter + '.js');
    }

    if (reporterConstructor === undefined) {
        throw new Error('Invalid reporter given');
    }

    this.reporter = new reporterConstructor(options.failOnWarn);
    this.sourceCode = fs.readFileSync(options.src, 'utf-8');
    this.psykickVersion = (options.is3d) ? '3d' : '2d';
    this.sourcePath = options.src;
    this.outputPath = options.output;
    this.overwrite = options.overwrite;
    this.ast = null;
    this.compiler = null;
    this.writer = null;
}
function(options) {
    options = extend({
        src: '',
        output: '',
        is3d: false,
        failOnWarn: false,
        overwrite: false,
        reporter: 'default'
    }, options);

    if (!options.src || !options.output) {
        throw new Error('Must specify source file and output directory');
    }

    var reporterConstructor;
    if (options.reporter === 'default') {
        reporterConstructor = require('./reporter.js').Reporter;
    } else {
        reporterConstructor = require('./reporters/' + options.reporter + '.js');
    }

    if (reporterConstructor === undefined) {
        throw new Error('Invalid reporter given');
    }

    this.reporter = new reporterConstructor(options.failOnWarn);
    this.sourceCode = fs.readFileSync(options.src, 'utf-8');
    this.psykickVersion = (options.is3d) ? '3d' : '2d';
    this.sourcePath = options.src;
    this.outputPath = options.output;
    this.overwrite = options.overwrite;
    this.ast = null;
    this.compiler = null;
    this.writer = null;
}
function ( options ) { options = extend ( { src : '' , output : '' , is3d : false , failOnWarn : false , overwrite : false , reporter : 'default' } , options ) ; if ( ! options . src || ! options . output ) { throw new Error ( 'Must specify source file and output directory' ) ; } var reporterConstructor ; if ( options . reporter === 'default' ) { reporterConstructor = require ( './reporter.js' ) . Reporter ; } else { reporterConstructor = require ( './reporters/' + options . reporter + '.js' ) ; } if ( reporterConstructor === undefined ) { throw new Error ( 'Invalid reporter given' ) ; } this . reporter = new reporterConstructor ( options . failOnWarn ) ; this . sourceCode = fs . readFileSync ( options . src , 'utf-8' ) ; this . psykickVersion = ( options . is3d ) ? '3d' : '2d' ; this . sourcePath = options . src ; this . outputPath = options . output ; this . overwrite = options . overwrite ; this . ast = null ; this . compiler = null ; this . writer = null ; }
Exposes Clairvoyant as a module to use programatically
@param {object}   options
@param {string}   options.src                 - Source file
@param {string}   options.output              - Path to the file to place the project in
@param {boolean} [options.is3d=false]         - If true, will compile for Psykick3D
@param {boolean} [options.failOnWarn=false]   - If true, will fail when a warning is issued
@param {boolean} [options.overwrite=false]    - If true, will overwrite existing files
@param {string}  [options.reporter='default'] - Specify which reporter to load
@constructor
Exposes Clairvoyant as a module to use programatically