Power Assert instrumentor from code to code, with SourceMap.
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.
var modifiedCode = espowerSource(originalCode, [filepath], [options])
espowerSource function manipulates
EspowerError will be thrown.
filepath (optional but recommended)
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.
||(return value of
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.
The ECMAScript version to parse and analyze. Must be either 3, 5, 6 (2015), 2016, 2017, or 2018.
The source type of the code. Must be either
$ npm install --save-dev espower-source
OUR SUPPORT POLICY
We support Node under maintenance. In other words, we stop supporting old Node version when their maintenance ends.
This means that any other environment is not supported.
NOTE: If espower-source works in any of the unsupported environments, it is purely coincidental and has no bearing on future compatibility. Use at your own risk.
- James Talmage (jamestalmage)
- Yoshiki Shibukawa (shibukawa)
- Yiyu He (dead-horse)
- Eward Song (shepherdwind)
Licensed under the MIT license.