syntactical
Browserify transform for validating the javascript source. Some browserify transformations emit syntax errors which are missing some basic information like filename and line number. Syntactical uses the syntax-error module to validate the source before passing it to the next transform.
Usage
Add it at the beginning of the transform chain.
var browserify = ; ;
The buffer: true
option buffers the individual chunks and emits the whole input at once if there are no syntax errors. This prevents transforms down the chain to work on the source if it's invalid. The buffer: false
option (default) keeps emitting the chunks as they are received, and emits a syntax error at the end on invalid source.
err.toString()
will return something like the following.
/home/substack/projects/node-syntax-error/example/src.js:5
if (Array.isArray(x) res.push.apply(res, x);
^
ParseError: Unexpected identifier