espower-source
Power Assert instrumentor from code to code, with SourceMap.
DESCRIPTION
espower-source
is a source code transformer that applies espower to target code.
espower
manipulates assertion expression in the form of ECMAScript AST defined in The ESTree Spec (formerly known as Mozilla SpiderMonkey Parser API), to instrument power-assert feature into the code. SourceMap information is appended in SourceMap Comment syntax at the end of returned code.
Pull-requests, issue reports and patches are always welcomed. See power-assert project for more documentation.
CHANGELOG
See CHANGELOG
API
var modifiedCode = espowerSource(originalCode, [filepath], [options])
espowerSource
function manipulates originalCode
then returns (transformed) JavaScript code as string. SourceMap information is appended in SourceMap Comment syntax at the end of returned code.
originalCode
type | default value |
---|
string | N/A |
Original JavaScript source code that is a source of code transformation. If not specified, then EspowerError
will be thrown.
filepath (optional but recommended)
type | default value |
---|
string | N/A |
Filepath of originalCode
. espower-source stores filepath information for later reporting. If not specified, options.path
will be used. If neither filepath nor options.path are not specified, espower-source transforms code as usual but SourceMap will not be generated and attached.
options (optional)
type | default value |
---|
object | (return value of espower.defaultOptions() but with destructive option is true ) |
Configuration options for espower
module. If not passed, default options (Same as espower.defaultOptions()) will be used, but options.destructive
is set to true
, and if options.path
is falsy, options.path
is set to value of filepath
argument by espower-source module.
INSTALL
via npm
Install
$ npm install --save-dev espower-source
use espower-source npm module on browser
espowerSource
function is exported
<script type="text/javascript" src="./path/to/node_modules/espower-source/build/espower-source.js"></script>
via bower
Install
$ bower install --save-dev espower-source
Then load (espowerSource
function is exported)
<script type="text/javascript" src="./path/to/bower_components/espower-source/build/espower-source.js"></script>
AUTHOR
CONTRIBUTORS
LICENSE
Licensed under the MIT license.