Power Assert instrumentor from source to source, with source-map
Last updated a year ago by twada .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install espower-source 
SYNC missed versions from official npm registry.


Build Status NPM package Dependency Status License

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])

return type

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.


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.


type default value
number 2018

The ECMAScript version to parse and analyze. Must be either 3, 5, 6 (2015), 2016, 2017, or 2018.


type default value
string 'module'

The source type of the code. Must be either "script" or "module".


via npm


$ npm install --save-dev espower-source


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.




Licensed under the MIT license.

Current Tags

  • 2.3.0                                ...           latest (a year ago)

19 Versions

  • 2.3.0                                ...           a year ago
  • 2.2.0                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.10.0                                ...           5 years ago
  • 0.9.1                                ...           5 years ago
  • 0.9.0                                ...           5 years ago
  • 0.8.0                                ...           5 years ago
  • 0.7.3                                ...           5 years ago
  • 0.7.1                                ...           6 years ago
  • 0.7.0                                ...           6 years ago
  • 0.6.1                                ...           6 years ago
  • 0.6.0                                ...           6 years ago
  • 0.4.1                                ...           6 years ago
  • 0.4.0                                ...           6 years ago
Maintainers (1)
Today 753
This Week 1,729
This Month 13,722
Last Day 976
Last Week 5,356
Last Month 22,383
Dependencies (11)
Dev Dependencies (8)

Copyright 2014 - 2016 © |