Socket
Socket
Sign inDemoInstall

babel-plugin-espower

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-espower - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

CHANGELOG.md

@@ -0,1 +1,9 @@

### [1.0.1](https://github.com/power-assert-js/babel-plugin-espower/releases/tag/v1.0.1) (2015-11-07)
#### Bug Fixes
* pin espower dependency to >=1.0.0 <=1.2.0 since there was a little breaking change ([6420b3dc](https://github.com/power-assert-js/babel-plugin-espower/commit/6420b3dc49a00f731eebbee695c90be8f13d5e73), closes [#8](https://github.com/power-assert-js/babel-plugin-espower/issues/8))
## [1.0.0](https://github.com/power-assert-js/babel-plugin-espower/releases/tag/v1.0.0) (2015-05-25)

@@ -2,0 +10,0 @@

18

lib/babel-estree-path.js

@@ -8,8 +8,8 @@ 'use strict';

function traverseUp (ancestors, traversalPath) {
ancestors.push(traversalPath.key);
if (Array.isArray(traversalPath.container)) { // traversing array via TraversalContext#visitMultiple
var parentNode = traversalPath.parent;
function traverseUp (ancestors, nodePath) {
ancestors.push(nodePath.key);
if (Array.isArray(nodePath.container)) { // traversing array via TraversalContext#visitMultiple
var parentNode = nodePath.parent;
var currentTraversingKey = find(types.VISITOR_KEYS[parentNode.type], function (key) {
return parentNode[key] === traversalPath.container; // searching for current key in parentNode
return parentNode[key] === nodePath.container; // searching for current key in parentNode
});

@@ -20,10 +20,10 @@ if (currentTraversingKey) { // ex. 'arguments' in CallExpression

}
if (traversalPath.parentPath) {
traverseUp(ancestors, traversalPath.parentPath);
if (nodePath.parentPath) {
traverseUp(ancestors, nodePath.parentPath);
}
}
return function estreePath (traversalPath) {
return function estreePath (nodePath) {
var ancestors = [];
traverseUp(ancestors, traversalPath);
traverseUp(ancestors, nodePath);
ancestors.reverse();

@@ -30,0 +30,0 @@ return ancestors;

@@ -8,5 +8,5 @@ 'use strict';

function enterTraversalPath (traversalPath, currentNode, parentNode, scope, file, matchers, esTreePath, options) {
function enterNodePath (nodePath, currentNode, parentNode, scope, file, matchers, esTreePath, options) {
var treePath;
var currentKey = traversalPath.key;
var currentKey = nodePath.key;
var assertionVisitor = file.get('espowerAssertionVisitor');

@@ -17,3 +17,3 @@ if (assertionVisitor) {

// MEMO: exit() will not be called when skip() is called
traversalPath.skip();
nodePath.skip();
return;

@@ -23,3 +23,3 @@ }

// entering argument
treePath = esTreePath(traversalPath);
treePath = esTreePath(nodePath);
assertionVisitor.enterArgument(currentNode, parentNode, treePath);

@@ -35,3 +35,3 @@ }

}, options);
treePath = esTreePath(traversalPath);
treePath = esTreePath(nodePath);
assertionVisitor = new espower.AssertionVisitor(matcher, treePath, espowerOptions);

@@ -44,4 +44,4 @@ assertionVisitor.enter(currentNode, parentNode);

function exitTraversalPath (traversalPath, currentNode, parentNode, scope, file, esTreePath, options) {
var currentKey = traversalPath.key;
function exitNodePath (nodePath, currentNode, parentNode, scope, file, esTreePath, options) {
var currentKey = nodePath.key;
var resultTree = currentNode;

@@ -53,3 +53,3 @@ var isTreeModified = false;

}
var treePath = esTreePath(traversalPath);
var treePath = esTreePath(nodePath);
if (assertionVisitor.isLeavingAssertion(treePath)) {

@@ -75,4 +75,4 @@ // leaving assertion

if (isTreeModified) {
traversalPath.replaceWith(resultTree);
traversalPath.skip();
nodePath.replaceWith(resultTree);
nodePath.skip();
}

@@ -95,6 +95,6 @@ }

enter: function (currentNode, parentNode, scope, file) {
enterTraversalPath(this, currentNode, parentNode, scope, file, matchers, esTreePath, opts);
enterNodePath(this, currentNode, parentNode, scope, file, matchers, esTreePath, opts);
},
exit: function (currentNode, parentNode, scope, file) {
exitTraversalPath(this, currentNode, parentNode, scope, file, esTreePath, opts);
exitNodePath(this, currentNode, parentNode, scope, file, esTreePath, opts);
}

@@ -101,0 +101,0 @@ };

{
"name": "babel-plugin-espower",
"description": "Babel plugin for power-assert",
"version": "1.0.0",
"version": "1.0.1",
"author": {

@@ -13,4 +13,4 @@ "name": "Takuto Wada",

"array-find": "^1.0.0",
"escallmatch": "^1.4.1",
"espower": "^1.0.0",
"escallmatch": "^1.4.2",
"espower": ">=1.0.0 <=1.2.0",
"xtend": "^4.0.0"

@@ -17,0 +17,0 @@ },

@@ -81,3 +81,3 @@ babel-plugin-espower

```javascript
require('babel-core/register')({
require('babel/register')({
only: /test\/tobe_instrumented/,

@@ -96,2 +96,62 @@ plugins: ['babel-plugin-espower'],

### with [babelify](https://github.com/babel/babelify)
```javascript
var fs = require('fs');
var browserify = require('browserify');
var babelify = require('babelify');
var glob = require('glob'),
browserify({ entries: glob.sync('./test/*_test.js'), debug: true })
.transform(babelify.configure({ plugins: ['babel-plugin-espower'] }))
.bundle()
.on('error', function (err) { console.log('Error : ' + err.message); })
.pipe(fs.createWriteStream('all_test.js'));
```
```
$ $(npm bin)/browserify -d -e ./test/*_test.js -t [ babelify --plugins babel-plugin-espower ]
```
### with [babelify](https://github.com/babel/babelify) and [gulp](http://gulpjs.com/)
```javascript
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var glob = require('glob'),
gulp.task('build_test', function() {
var files = glob.sync('./test/*_test.js');
var b = browserify({entries: files, debug: true});
b.transform(babelify.configure({
plugins: ['babel-plugin-espower']
}));
return b.bundle()
.pipe(source('all_test.js'))
.pipe(gulp.dest('./build'));
});
```
### with [babelify](https://github.com/babel/babelify) and [Karma](http://karma-runner.github.io)
```javascript
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'browserify'],
files: [
"test/**/*.js"
],
preprocessors: {
"test/**/*.js": "browserify"
},
browserify: {
debug: true,
transform: [
['babelify', {plugins: ['babel-plugin-espower']}]
]
},
// ...
```
EXAMPLE

@@ -229,3 +289,3 @@ ---------------------------------------

var createEspowerPlugin = require('babel-plugin-espower/create');
require('babel-core/register')({
require('babel/register')({
only: /test\/tobe_instrumented/,

@@ -232,0 +292,0 @@ plugins: [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc